diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/CHANGELOG.md b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/CHANGELOG.md index dd2e44d09984..3b0cf3796849 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/CHANGELOG.md +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/CHANGELOG.md @@ -1,5 +1,428 @@ # Release History +## 2.0.0b1 (2026-04-27) + +### Features Added + + - Client `SiteRecoveryManagementClient` added parameter `cloud_setting` in method `__init__` + - Client `SiteRecoveryManagementClient` added method `send_request` + - Model `A2AEnableProtectionInput` added property `platform_fault_domain` + - Model `A2AReplicationDetails` added property `agent_reinstall_attempt_to_version` + - Model `A2AReplicationDetails` added property `os_family_name` + - Model `A2AReplicationDetails` added property `distro_name` + - Model `A2AReplicationDetails` added property `distro_name_for_which_agent_is_installed` + - Model `A2AReplicationDetails` added property `is_agent_upgradeable` + - Model `A2AReplicationDetails` added property `is_agent_reinstall_required` + - Model `A2AReplicationDetails` added property `reasons_blocking_re_install` + - Model `A2AReplicationDetails` added property `reasons_blocking_reinstall_details` + - Model `A2AReplicationDetails` added property `is_agent_upgrade_in_progress` + - Model `A2AReplicationDetails` added property `auto_agent_upgrade_retry_count` + - Model `A2AReplicationDetails` added property `is_agent_upgrade_retry_threshold_exhausted` + - Model `A2AReplicationDetails` added property `platform_fault_domain` + - Model `A2ASwitchProtectionInput` added property `platform_fault_domain` + - Model `A2AUpdateReplicationProtectedItemInput` added property `recovery_availability_zone` + - Model `A2AUpdateReplicationProtectedItemInput` added property `platform_fault_domain` + - Enum `AgentUpgradeBlockedReason` added member `RE_INSTALL_REQUIRED` + - Model `Alert` added property `system_data` + - Model `Event` added property `system_data` + - Model `Fabric` added property `system_data` + - Model `HyperVReplicaAzureDiskInputDetails` added property `iops` + - Model `HyperVReplicaAzureDiskInputDetails` added property `throughput_in_mbps` + - Model `HyperVReplicaAzureDiskInputDetails` added property `disk_size_in_gb` + - Model `HyperVReplicaAzureEnableProtectionInput` added property `target_capacity_reservation_group_id` + - Model `HyperVReplicaAzureManagedDiskDetails` added property `iops` + - Model `HyperVReplicaAzureManagedDiskDetails` added property `throughput_in_mbps` + - Model `HyperVReplicaAzureManagedDiskDetails` added property `disk_size_in_gb` + - Model `HyperVReplicaAzurePlannedFailoverProviderInput` added property `target_capacity_reservation_group_id` + - Model `HyperVReplicaAzureReplicationDetails` added property `target_capacity_reservation_group_id` + - Model `HyperVReplicaAzureUpdateReplicationProtectedItemInput` added property `target_capacity_reservation_group_id` + - Model `InMageRcmDiskInput` added property `iops` + - Model `InMageRcmDiskInput` added property `throughput_in_mbps` + - Model `InMageRcmDiskInput` added property `disk_size_in_gb` + - Model `InMageRcmDisksDefaultInput` added property `iops` + - Model `InMageRcmDisksDefaultInput` added property `throughput_in_mbps` + - Model `InMageRcmDisksDefaultInput` added property `disk_size_in_gb` + - Model `InMageRcmEnableProtectionInput` added property `target_capacity_reservation_group_id` + - Model `InMageRcmMobilityAgentDetails` added property `agent_reinstall_state` + - Model `InMageRcmMobilityAgentDetails` added property `last_agent_reinstall_type` + - Model `InMageRcmMobilityAgentDetails` added property `agent_reinstall_job_id` + - Model `InMageRcmMobilityAgentDetails` added property `agent_reinstall_attempt_to_version` + - Model `InMageRcmMobilityAgentDetails` added property `os_family_name` + - Model `InMageRcmMobilityAgentDetails` added property `distro_name` + - Model `InMageRcmMobilityAgentDetails` added property `distro_name_for_which_agent_is_installed` + - Model `InMageRcmMobilityAgentDetails` added property `is_agent_upgradeable` + - Model `InMageRcmMobilityAgentDetails` added property `is_agent_reinstall_required` + - Model `InMageRcmMobilityAgentDetails` added property `is_last_reinstall_successful` + - Model `InMageRcmMobilityAgentDetails` added property `reasons_blocking_reinstall` + - Model `InMageRcmMobilityAgentDetails` added property `reasons_blocking_reinstall_details` + - Model `InMageRcmProtectedDiskDetails` added property `iops` + - Model `InMageRcmProtectedDiskDetails` added property `throughput_in_mbps` + - Model `InMageRcmProtectedDiskDetails` added property `disk_size_in_gb` + - Model `InMageRcmReplicationDetails` added property `target_capacity_reservation_group_id` + - Model `InMageRcmUnplannedFailoverInput` added property `target_capacity_reservation_group_id` + - Model `InMageRcmUpdateReplicationProtectedItemInput` added property `vm_disks` + - Model `InMageRcmUpdateReplicationProtectedItemInput` added property `target_capacity_reservation_group_id` + - Model `Job` added property `system_data` + - Model `LogicalNetwork` added property `system_data` + - Model `MigrationItem` added property `system_data` + - Model `MigrationRecoveryPoint` added property `system_data` + - Model `Network` added property `system_data` + - Model `NetworkMapping` added property `system_data` + - Model `Policy` added property `system_data` + - Model `ProtectableItem` added property `system_data` + - Model `ProtectionContainer` added property `system_data` + - Model `ProtectionContainerMapping` added property `system_data` + - Model `RecoveryPlan` added property `system_data` + - Model `RecoveryPoint` added property `system_data` + - Model `RecoveryServicesProvider` added property `system_data` + - Model `ReplicationEligibilityResults` added property `system_data` + - Model `ReplicationProtectedItem` added property `system_data` + - Model `ReplicationProtectionCluster` added property `system_data` + - Model `ReplicationProtectionIntent` added property `system_data` + - Model `Resource` added property `system_data` + - Model `StorageClassification` added property `system_data` + - Model `StorageClassificationMapping` added property `system_data` + - Model `SupportedOperatingSystems` added property `system_data` + - Model `UpdateDiskInput` added property `iops` + - Model `UpdateDiskInput` added property `throughput_in_mbps` + - Model `UpdateDiskInput` added property `disk_size_in_gb` + - Model `VCenter` added property `system_data` + - Model `VMwareCbtDiskInput` added property `iops` + - Model `VMwareCbtDiskInput` added property `throughput_in_mbps` + - Model `VMwareCbtDiskInput` added property `disk_size_in_gb` + - Model `VMwareCbtEnableMigrationInput` added property `target_capacity_reservation_group_id` + - Model `VMwareCbtMigrateInput` added property `target_capacity_reservation_group_id` + - Model `VMwareCbtMigrationDetails` added property `target_capacity_reservation_group_id` + - Model `VMwareCbtProtectedDiskDetails` added property `iops` + - Model `VMwareCbtProtectedDiskDetails` added property `throughput_in_mbps` + - Model `VMwareCbtProtectedDiskDetails` added property `disk_size_in_gb` + - Model `VMwareCbtUpdateDiskInput` added property `iops` + - Model `VMwareCbtUpdateDiskInput` added property `throughput_in_mbps` + - Model `VMwareCbtUpdateDiskInput` added property `disk_size_in_gb` + - Model `VMwareCbtUpdateMigrationItemInput` added property `target_capacity_reservation_group_id` + - Model `VaultHealthDetails` added property `system_data` + - Model `VaultSetting` added property `system_data` + - Added model `A2AAgentReinstallBlockingErrorDetails` + - Added enum `AgentReinstallBlockedReason` + - Added enum `CreatedByType` + - Added model `InMageRcmAgentReinstallBlockingErrorDetails` + - Added enum `MobilityAgentReinstallType` + - Added model `ProxyResource` + - Added model `ReinstallMobilityServiceRequest` + - Added model `ReinstallMobilityServiceRequestProperties` + - Added model `SystemData` + - Operation group `ReplicationProtectedItemsOperations` added method `begin_reinstall_mobility_service` + +### Breaking Changes + + - 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. + - For the method breakings, please refer to https://aka.ms/azsdk/python/migrate/operations for migration. + - Method `SiteRecoveryManagementClient.__init__` deleted or renamed its parameter `resource_group_name` of kind `positional_or_keyword` + - Method `SiteRecoveryManagementClient.__init__` deleted or renamed its parameter `resource_name` of kind `positional_or_keyword` + - Model `Resource` deleted or renamed its instance variable `location` + - Deleted or renamed model `RoleAssignment` + - Method `ClusterRecoveryPointOperations.get` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ClusterRecoveryPointsOperations.list_by_replication_protection_cluster` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `MigrationRecoveryPointsOperations.get` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `MigrationRecoveryPointsOperations.get` inserted a `positional_or_keyword` parameter `resource_name` + - Method `MigrationRecoveryPointsOperations.list_by_replication_migration_items` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `MigrationRecoveryPointsOperations.list_by_replication_migration_items` inserted a `positional_or_keyword` parameter `resource_name` + - Method `Operations.list` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `RecoveryPointsOperations.get` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `RecoveryPointsOperations.get` inserted a `positional_or_keyword` parameter `resource_name` + - Method `RecoveryPointsOperations.list_by_replication_protected_items` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `RecoveryPointsOperations.list_by_replication_protected_items` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationAlertSettingsOperations.create` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationAlertSettingsOperations.create` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationAlertSettingsOperations.get` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationAlertSettingsOperations.get` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationAlertSettingsOperations.list` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationAlertSettingsOperations.list` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationAppliancesOperations.list` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationAppliancesOperations.list` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationEligibilityResultsOperations.get` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationEligibilityResultsOperations.list` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationEventsOperations.get` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationEventsOperations.get` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationEventsOperations.list` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationEventsOperations.list` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationFabricsOperations.begin_check_consistency` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationFabricsOperations.begin_check_consistency` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationFabricsOperations.begin_create` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationFabricsOperations.begin_create` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationFabricsOperations.begin_delete` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationFabricsOperations.begin_delete` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationFabricsOperations.begin_migrate_to_aad` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationFabricsOperations.begin_migrate_to_aad` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationFabricsOperations.begin_purge` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationFabricsOperations.begin_purge` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationFabricsOperations.begin_reassociate_gateway` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationFabricsOperations.begin_reassociate_gateway` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationFabricsOperations.begin_remove_infra` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationFabricsOperations.begin_renew_certificate` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationFabricsOperations.begin_renew_certificate` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationFabricsOperations.get` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationFabricsOperations.get` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationFabricsOperations.list` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationFabricsOperations.list` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationJobsOperations.begin_cancel` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationJobsOperations.begin_cancel` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationJobsOperations.begin_export` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationJobsOperations.begin_export` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationJobsOperations.begin_restart` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationJobsOperations.begin_restart` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationJobsOperations.begin_resume` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationJobsOperations.begin_resume` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationJobsOperations.get` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationJobsOperations.get` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationJobsOperations.list` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationJobsOperations.list` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationLogicalNetworksOperations.get` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationLogicalNetworksOperations.get` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationLogicalNetworksOperations.list_by_replication_fabrics` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationLogicalNetworksOperations.list_by_replication_fabrics` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationMigrationItemsOperations.begin_create` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationMigrationItemsOperations.begin_create` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationMigrationItemsOperations.begin_delete` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationMigrationItemsOperations.begin_delete` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationMigrationItemsOperations.begin_migrate` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationMigrationItemsOperations.begin_migrate` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationMigrationItemsOperations.begin_pause_replication` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationMigrationItemsOperations.begin_pause_replication` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationMigrationItemsOperations.begin_resume_replication` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationMigrationItemsOperations.begin_resume_replication` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationMigrationItemsOperations.begin_resync` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationMigrationItemsOperations.begin_resync` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationMigrationItemsOperations.begin_test_migrate` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationMigrationItemsOperations.begin_test_migrate` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationMigrationItemsOperations.begin_test_migrate_cleanup` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationMigrationItemsOperations.begin_test_migrate_cleanup` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationMigrationItemsOperations.begin_update` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationMigrationItemsOperations.begin_update` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationMigrationItemsOperations.get` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationMigrationItemsOperations.get` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationMigrationItemsOperations.list` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationMigrationItemsOperations.list` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationMigrationItemsOperations.list_by_replication_protection_containers` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationMigrationItemsOperations.list_by_replication_protection_containers` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationNetworkMappingsOperations.begin_create` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationNetworkMappingsOperations.begin_create` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationNetworkMappingsOperations.begin_delete` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationNetworkMappingsOperations.begin_delete` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationNetworkMappingsOperations.begin_update` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationNetworkMappingsOperations.begin_update` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationNetworkMappingsOperations.get` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationNetworkMappingsOperations.get` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationNetworkMappingsOperations.list` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationNetworkMappingsOperations.list` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationNetworkMappingsOperations.list_by_replication_networks` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationNetworkMappingsOperations.list_by_replication_networks` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationNetworksOperations.get` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationNetworksOperations.get` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationNetworksOperations.list` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationNetworksOperations.list` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationNetworksOperations.list_by_replication_fabrics` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationNetworksOperations.list_by_replication_fabrics` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationPoliciesOperations.begin_create` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationPoliciesOperations.begin_create` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationPoliciesOperations.begin_delete` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationPoliciesOperations.begin_delete` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationPoliciesOperations.begin_update` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationPoliciesOperations.begin_update` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationPoliciesOperations.get` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationPoliciesOperations.get` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationPoliciesOperations.list` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationPoliciesOperations.list` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationProtectableItemsOperations.get` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationProtectableItemsOperations.get` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationProtectableItemsOperations.list_by_replication_protection_containers` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationProtectableItemsOperations.list_by_replication_protection_containers` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationProtectedItemsOperations.begin_add_disks` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationProtectedItemsOperations.begin_add_disks` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationProtectedItemsOperations.begin_apply_recovery_point` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationProtectedItemsOperations.begin_apply_recovery_point` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationProtectedItemsOperations.begin_create` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationProtectedItemsOperations.begin_create` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationProtectedItemsOperations.begin_delete` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationProtectedItemsOperations.begin_delete` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationProtectedItemsOperations.begin_failover_cancel` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationProtectedItemsOperations.begin_failover_cancel` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationProtectedItemsOperations.begin_failover_commit` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationProtectedItemsOperations.begin_failover_commit` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationProtectedItemsOperations.begin_planned_failover` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationProtectedItemsOperations.begin_planned_failover` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationProtectedItemsOperations.begin_purge` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationProtectedItemsOperations.begin_purge` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationProtectedItemsOperations.begin_remove_disks` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationProtectedItemsOperations.begin_remove_disks` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationProtectedItemsOperations.begin_repair_replication` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationProtectedItemsOperations.begin_repair_replication` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationProtectedItemsOperations.begin_reprotect` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationProtectedItemsOperations.begin_reprotect` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationProtectedItemsOperations.begin_resolve_health_errors` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationProtectedItemsOperations.begin_resolve_health_errors` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationProtectedItemsOperations.begin_switch_provider` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationProtectedItemsOperations.begin_switch_provider` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationProtectedItemsOperations.begin_test_failover` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationProtectedItemsOperations.begin_test_failover` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationProtectedItemsOperations.begin_test_failover_cleanup` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationProtectedItemsOperations.begin_test_failover_cleanup` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationProtectedItemsOperations.begin_unplanned_failover` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationProtectedItemsOperations.begin_unplanned_failover` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationProtectedItemsOperations.begin_update` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationProtectedItemsOperations.begin_update` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationProtectedItemsOperations.begin_update_appliance` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationProtectedItemsOperations.begin_update_appliance` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationProtectedItemsOperations.begin_update_mobility_service` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationProtectedItemsOperations.begin_update_mobility_service` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationProtectedItemsOperations.get` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationProtectedItemsOperations.get` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationProtectedItemsOperations.list` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationProtectedItemsOperations.list` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationProtectedItemsOperations.list_by_replication_protection_containers` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationProtectedItemsOperations.list_by_replication_protection_containers` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationProtectionClustersOperations.begin_apply_recovery_point` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationProtectionClustersOperations.begin_create` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationProtectionClustersOperations.begin_create` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationProtectionClustersOperations.begin_failover_commit` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationProtectionClustersOperations.begin_purge` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationProtectionClustersOperations.begin_purge` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationProtectionClustersOperations.begin_repair_replication` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationProtectionClustersOperations.begin_test_failover` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationProtectionClustersOperations.begin_test_failover_cleanup` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationProtectionClustersOperations.begin_unplanned_failover` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationProtectionClustersOperations.get` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationProtectionClustersOperations.get_operation_results` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationProtectionClustersOperations.list` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationProtectionClustersOperations.list_by_replication_protection_containers` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationProtectionContainerMappingsOperations.begin_create` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationProtectionContainerMappingsOperations.begin_create` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationProtectionContainerMappingsOperations.begin_delete` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationProtectionContainerMappingsOperations.begin_delete` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationProtectionContainerMappingsOperations.begin_purge` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationProtectionContainerMappingsOperations.begin_purge` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationProtectionContainerMappingsOperations.begin_update` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationProtectionContainerMappingsOperations.begin_update` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationProtectionContainerMappingsOperations.get` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationProtectionContainerMappingsOperations.get` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationProtectionContainerMappingsOperations.list` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationProtectionContainerMappingsOperations.list` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationProtectionContainerMappingsOperations.list_by_replication_protection_containers` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationProtectionContainerMappingsOperations.list_by_replication_protection_containers` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationProtectionContainersOperations.begin_create` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationProtectionContainersOperations.begin_create` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationProtectionContainersOperations.begin_delete` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationProtectionContainersOperations.begin_delete` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationProtectionContainersOperations.begin_discover_protectable_item` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationProtectionContainersOperations.begin_discover_protectable_item` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationProtectionContainersOperations.begin_switch_cluster_protection` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationProtectionContainersOperations.begin_switch_protection` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationProtectionContainersOperations.begin_switch_protection` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationProtectionContainersOperations.get` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationProtectionContainersOperations.get` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationProtectionContainersOperations.list` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationProtectionContainersOperations.list` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationProtectionContainersOperations.list_by_replication_fabrics` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationProtectionContainersOperations.list_by_replication_fabrics` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationProtectionIntentsOperations.create` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationProtectionIntentsOperations.create` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationProtectionIntentsOperations.get` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationProtectionIntentsOperations.get` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationProtectionIntentsOperations.list` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationProtectionIntentsOperations.list` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationRecoveryPlansOperations.begin_create` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationRecoveryPlansOperations.begin_create` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationRecoveryPlansOperations.begin_delete` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationRecoveryPlansOperations.begin_delete` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationRecoveryPlansOperations.begin_failover_cancel` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationRecoveryPlansOperations.begin_failover_cancel` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationRecoveryPlansOperations.begin_failover_commit` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationRecoveryPlansOperations.begin_failover_commit` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationRecoveryPlansOperations.begin_planned_failover` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationRecoveryPlansOperations.begin_planned_failover` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationRecoveryPlansOperations.begin_reprotect` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationRecoveryPlansOperations.begin_reprotect` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationRecoveryPlansOperations.begin_test_failover` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationRecoveryPlansOperations.begin_test_failover` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationRecoveryPlansOperations.begin_test_failover_cleanup` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationRecoveryPlansOperations.begin_test_failover_cleanup` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationRecoveryPlansOperations.begin_unplanned_failover` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationRecoveryPlansOperations.begin_unplanned_failover` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationRecoveryPlansOperations.begin_update` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationRecoveryPlansOperations.begin_update` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationRecoveryPlansOperations.get` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationRecoveryPlansOperations.get` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationRecoveryPlansOperations.list` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationRecoveryPlansOperations.list` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationRecoveryServicesProvidersOperations.begin_create` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationRecoveryServicesProvidersOperations.begin_create` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationRecoveryServicesProvidersOperations.begin_delete` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationRecoveryServicesProvidersOperations.begin_delete` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationRecoveryServicesProvidersOperations.begin_purge` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationRecoveryServicesProvidersOperations.begin_purge` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationRecoveryServicesProvidersOperations.begin_refresh_provider` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationRecoveryServicesProvidersOperations.begin_refresh_provider` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationRecoveryServicesProvidersOperations.get` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationRecoveryServicesProvidersOperations.get` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationRecoveryServicesProvidersOperations.list` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationRecoveryServicesProvidersOperations.list` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationRecoveryServicesProvidersOperations.list_by_replication_fabrics` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationRecoveryServicesProvidersOperations.list_by_replication_fabrics` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationStorageClassificationMappingsOperations.begin_create` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationStorageClassificationMappingsOperations.begin_create` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationStorageClassificationMappingsOperations.begin_delete` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationStorageClassificationMappingsOperations.begin_delete` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationStorageClassificationMappingsOperations.get` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationStorageClassificationMappingsOperations.get` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationStorageClassificationMappingsOperations.list` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationStorageClassificationMappingsOperations.list` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationStorageClassificationMappingsOperations.list_by_replication_storage_classifications` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationStorageClassificationMappingsOperations.list_by_replication_storage_classifications` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationStorageClassificationsOperations.get` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationStorageClassificationsOperations.get` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationStorageClassificationsOperations.list` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationStorageClassificationsOperations.list` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationStorageClassificationsOperations.list_by_replication_fabrics` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationStorageClassificationsOperations.list_by_replication_fabrics` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationVaultHealthOperations.begin_refresh` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationVaultHealthOperations.begin_refresh` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationVaultHealthOperations.get` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationVaultHealthOperations.get` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationVaultSettingOperations.begin_create` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationVaultSettingOperations.begin_create` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationVaultSettingOperations.get` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationVaultSettingOperations.get` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationVaultSettingOperations.list` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationVaultSettingOperations.list` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationvCentersOperations.begin_create` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationvCentersOperations.begin_create` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationvCentersOperations.begin_delete` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationvCentersOperations.begin_delete` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationvCentersOperations.begin_update` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationvCentersOperations.begin_update` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationvCentersOperations.get` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationvCentersOperations.get` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationvCentersOperations.list` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationvCentersOperations.list` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationvCentersOperations.list_by_replication_fabrics` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `ReplicationvCentersOperations.list_by_replication_fabrics` inserted a `positional_or_keyword` parameter `resource_name` + - Method `SupportedOperatingSystemsOperations.get` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `SupportedOperatingSystemsOperations.get` inserted a `positional_or_keyword` parameter `resource_name` + - Method `TargetComputeSizesOperations.list_by_replication_protected_items` inserted a `positional_or_keyword` parameter `resource_group_name` + - Method `TargetComputeSizesOperations.list_by_replication_protected_items` inserted a `positional_or_keyword` parameter `resource_name` + - Method `ReplicationMigrationItemsOperations.begin_delete` changed its parameter `delete_option` from `positional_or_keyword` to `keyword_only` + - Method `ReplicationMigrationItemsOperations.list` changed its parameter `skip_token`/`take_token` from `positional_or_keyword` to `keyword_only` + - Method `ReplicationMigrationItemsOperations.list_by_replication_protection_containers` changed its parameter `skip_token`/`take_token` from `positional_or_keyword` to `keyword_only` + - Method `ReplicationProtectableItemsOperations.list_by_replication_protection_containers` changed its parameter `take`/`skip_token` from `positional_or_keyword` to `keyword_only` + - Method `ReplicationProtectedItemsOperations.list` changed its parameter `skip_token` from `positional_or_keyword` to `keyword_only` + - Method `ReplicationProtectionClustersOperations.list` changed its parameter `skip_token` from `positional_or_keyword` to `keyword_only` + - Method `ReplicationProtectionIntentsOperations.list` changed its parameter `skip_token`/`take_token` from `positional_or_keyword` to `keyword_only` + - Method `SupportedOperatingSystemsOperations.get` changed its parameter `instance_type` from `positional_or_keyword` to `keyword_only` + +### Other Changes + + - Deleted model `ApplianceQueryParameter`/`EventQueryParameter`/`FabricQueryParameter`/`MigrationItemsQueryParameter`/`ProtectableItemQueryParameter`/`ProtectedClustersQueryParameter`/`ProtectedItemsQueryParameter`/`AlertCollection`/`ApplianceCollection`/`ClusterRecoveryPointCollection`/`EventCollection`/`FabricCollection`/`JobCollection`/`LogicalNetworkCollection`/`MigrationItemCollection`/`MigrationRecoveryPointCollection`/`NetworkCollection`/`NetworkMappingCollection`/`OperationsDiscoveryCollection`/`PolicyCollection`/`ProtectableItemCollection`/`ProtectionContainerCollection`/`ProtectionContainerMappingCollection`/`RecoveryPlanCollection`/`RecoveryPointCollection`/`RecoveryServicesProviderCollection`/`ReplicationProtectedItemCollection`/`ReplicationProtectionClusterCollection`/`ReplicationProtectionIntentCollection`/`StorageClassificationCollection`/`StorageClassificationMappingCollection`/`TargetComputeSizeCollection`/`VCenterCollection`/`VaultSettingCollection` which actually were not used by SDK users + ## 1.3.0 (2025-04-23) ### Features Added diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/MANIFEST.in b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/MANIFEST.in index 33160570a1db..5710424820be 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/MANIFEST.in +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/MANIFEST.in @@ -1,8 +1,7 @@ -include _meta.json -recursive-include tests *.py *.json -recursive-include samples *.py *.md include *.md -include azure/__init__.py -include azure/mgmt/__init__.py include LICENSE include azure/mgmt/recoveryservicessiterecovery/py.typed +recursive-include tests *.py +recursive-include samples *.py *.md +include azure/__init__.py +include azure/mgmt/__init__.py diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/_meta.json b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/_meta.json deleted file mode 100644 index 23459987f673..000000000000 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "94c4a982497b2a8e982d32848bec417b5a029b4f", - "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest": "3.10.2", - "use": [ - "@autorest/python@6.32.3", - "@autorest/modelerfour@4.27.0" - ], - "autorest_command": "autorest specification/recoveryservicessiterecovery/resource-manager/readme.md --generate-sample=True --generate-test=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.32.3 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", - "readme": "specification/recoveryservicessiterecovery/resource-manager/readme.md" -} \ No newline at end of file diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/_metadata.json b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/_metadata.json new file mode 100644 index 000000000000..052eea7c5a13 --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/_metadata.json @@ -0,0 +1,10 @@ +{ + "apiVersion": "2025-08-01", + "apiVersions": { + "Microsoft.RecoveryServices": "2025-08-01" + }, + "commit": "1346e6b895a9091a6adbeec3505ee47f55d3ecee", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "typespec_src": "specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/SiteRecovery", + "emitterVersion": "0.61.3" +} \ No newline at end of file diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/apiview-properties.json b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/apiview-properties.json new file mode 100644 index 000000000000..0ed951628fcc --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/apiview-properties.json @@ -0,0 +1,909 @@ +{ + "CrossLanguagePackageId": "Microsoft.RecoveryServices", + "CrossLanguageDefinitionId": { + "azure.mgmt.recoveryservicessiterecovery.models.AddDisksProviderSpecificInput": "Microsoft.RecoveryServices.AddDisksProviderSpecificInput", + "azure.mgmt.recoveryservicessiterecovery.models.A2AAddDisksInput": "Microsoft.RecoveryServices.A2AAddDisksInput", + "azure.mgmt.recoveryservicessiterecovery.models.A2AAgentReinstallBlockingErrorDetails": "Microsoft.RecoveryServices.A2AAgentReinstallBlockingErrorDetails", + "azure.mgmt.recoveryservicessiterecovery.models.ApplyClusterRecoveryPointProviderSpecificInput": "Microsoft.RecoveryServices.ApplyClusterRecoveryPointProviderSpecificInput", + "azure.mgmt.recoveryservicessiterecovery.models.A2AApplyClusterRecoveryPointInput": "Microsoft.RecoveryServices.A2AApplyClusterRecoveryPointInput", + "azure.mgmt.recoveryservicessiterecovery.models.ApplyRecoveryPointProviderSpecificInput": "Microsoft.RecoveryServices.ApplyRecoveryPointProviderSpecificInput", + "azure.mgmt.recoveryservicessiterecovery.models.A2AApplyRecoveryPointInput": "Microsoft.RecoveryServices.A2AApplyRecoveryPointInput", + "azure.mgmt.recoveryservicessiterecovery.models.ClusterProviderSpecificRecoveryPointDetails": "Microsoft.RecoveryServices.ClusterProviderSpecificRecoveryPointDetails", + "azure.mgmt.recoveryservicessiterecovery.models.A2AClusterRecoveryPointDetails": "Microsoft.RecoveryServices.A2AClusterRecoveryPointDetails", + "azure.mgmt.recoveryservicessiterecovery.models.ClusterTestFailoverProviderSpecificInput": "Microsoft.RecoveryServices.ClusterTestFailoverProviderSpecificInput", + "azure.mgmt.recoveryservicessiterecovery.models.A2AClusterTestFailoverInput": "Microsoft.RecoveryServices.A2AClusterTestFailoverInput", + "azure.mgmt.recoveryservicessiterecovery.models.ClusterUnplannedFailoverProviderSpecificInput": "Microsoft.RecoveryServices.ClusterUnplannedFailoverProviderSpecificInput", + "azure.mgmt.recoveryservicessiterecovery.models.A2AClusterUnplannedFailoverInput": "Microsoft.RecoveryServices.A2AClusterUnplannedFailoverInput", + "azure.mgmt.recoveryservicessiterecovery.models.ReplicationProviderSpecificContainerCreationInput": "Microsoft.RecoveryServices.ReplicationProviderSpecificContainerCreationInput", + "azure.mgmt.recoveryservicessiterecovery.models.A2AContainerCreationInput": "Microsoft.RecoveryServices.A2AContainerCreationInput", + "azure.mgmt.recoveryservicessiterecovery.models.ReplicationProviderSpecificContainerMappingInput": "Microsoft.RecoveryServices.ReplicationProviderSpecificContainerMappingInput", + "azure.mgmt.recoveryservicessiterecovery.models.A2AContainerMappingInput": "Microsoft.RecoveryServices.A2AContainerMappingInput", + "azure.mgmt.recoveryservicessiterecovery.models.CreateProtectionIntentProviderSpecificDetails": "Microsoft.RecoveryServices.CreateProtectionIntentProviderSpecificDetails", + "azure.mgmt.recoveryservicessiterecovery.models.A2ACreateProtectionIntentInput": "Microsoft.RecoveryServices.A2ACreateProtectionIntentInput", + "azure.mgmt.recoveryservicessiterecovery.models.A2ACrossClusterMigrationApplyRecoveryPointInput": "Microsoft.RecoveryServices.A2ACrossClusterMigrationApplyRecoveryPointInput", + "azure.mgmt.recoveryservicessiterecovery.models.A2ACrossClusterMigrationContainerCreationInput": "Microsoft.RecoveryServices.A2ACrossClusterMigrationContainerCreationInput", + "azure.mgmt.recoveryservicessiterecovery.models.EnableProtectionProviderSpecificInput": "Microsoft.RecoveryServices.EnableProtectionProviderSpecificInput", + "azure.mgmt.recoveryservicessiterecovery.models.A2ACrossClusterMigrationEnableProtectionInput": "Microsoft.RecoveryServices.A2ACrossClusterMigrationEnableProtectionInput", + "azure.mgmt.recoveryservicessiterecovery.models.PolicyProviderSpecificInput": "Microsoft.RecoveryServices.PolicyProviderSpecificInput", + "azure.mgmt.recoveryservicessiterecovery.models.A2ACrossClusterMigrationPolicyCreationInput": "Microsoft.RecoveryServices.A2ACrossClusterMigrationPolicyCreationInput", + "azure.mgmt.recoveryservicessiterecovery.models.ReplicationProviderSpecificSettings": "Microsoft.RecoveryServices.ReplicationProviderSpecificSettings", + "azure.mgmt.recoveryservicessiterecovery.models.A2ACrossClusterMigrationReplicationDetails": "Microsoft.RecoveryServices.A2ACrossClusterMigrationReplicationDetails", + "azure.mgmt.recoveryservicessiterecovery.models.A2AEnableProtectionInput": "Microsoft.RecoveryServices.A2AEnableProtectionInput", + "azure.mgmt.recoveryservicessiterecovery.models.EventProviderSpecificDetails": "Microsoft.RecoveryServices.EventProviderSpecificDetails", + "azure.mgmt.recoveryservicessiterecovery.models.A2AEventDetails": "Microsoft.RecoveryServices.A2AEventDetails", + "azure.mgmt.recoveryservicessiterecovery.models.A2AExtendedLocationDetails": "Microsoft.RecoveryServices.A2AExtendedLocationDetails", + "azure.mgmt.recoveryservicessiterecovery.models.A2AFabricSpecificLocationDetails": "Microsoft.RecoveryServices.A2AFabricSpecificLocationDetails", + "azure.mgmt.recoveryservicessiterecovery.models.A2APolicyCreationInput": "Microsoft.RecoveryServices.A2APolicyCreationInput", + "azure.mgmt.recoveryservicessiterecovery.models.PolicyProviderSpecificDetails": "Microsoft.RecoveryServices.PolicyProviderSpecificDetails", + "azure.mgmt.recoveryservicessiterecovery.models.A2APolicyDetails": "Microsoft.RecoveryServices.A2APolicyDetails", + "azure.mgmt.recoveryservicessiterecovery.models.A2AProtectedDiskDetails": "Microsoft.RecoveryServices.A2AProtectedDiskDetails", + "azure.mgmt.recoveryservicessiterecovery.models.A2AProtectedItemDetail": "Microsoft.RecoveryServices.A2AProtectedItemDetail", + "azure.mgmt.recoveryservicessiterecovery.models.A2AProtectedManagedDiskDetails": "Microsoft.RecoveryServices.A2AProtectedManagedDiskDetails", + "azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerMappingProviderSpecificDetails": "Microsoft.RecoveryServices.ProtectionContainerMappingProviderSpecificDetails", + "azure.mgmt.recoveryservicessiterecovery.models.A2AProtectionContainerMappingDetails": "Microsoft.RecoveryServices.A2AProtectionContainerMappingDetails", + "azure.mgmt.recoveryservicessiterecovery.models.A2AProtectionIntentDiskInputDetails": "Microsoft.RecoveryServices.A2AProtectionIntentDiskInputDetails", + "azure.mgmt.recoveryservicessiterecovery.models.A2AProtectionIntentManagedDiskInputDetails": "Microsoft.RecoveryServices.A2AProtectionIntentManagedDiskInputDetails", + "azure.mgmt.recoveryservicessiterecovery.models.ProviderSpecificRecoveryPointDetails": "Microsoft.RecoveryServices.ProviderSpecificRecoveryPointDetails", + "azure.mgmt.recoveryservicessiterecovery.models.A2ARecoveryPointDetails": "Microsoft.RecoveryServices.A2ARecoveryPointDetails", + "azure.mgmt.recoveryservicessiterecovery.models.RemoveDisksProviderSpecificInput": "Microsoft.RecoveryServices.RemoveDisksProviderSpecificInput", + "azure.mgmt.recoveryservicessiterecovery.models.A2ARemoveDisksInput": "Microsoft.RecoveryServices.A2ARemoveDisksInput", + "azure.mgmt.recoveryservicessiterecovery.models.A2AReplicationDetails": "Microsoft.RecoveryServices.A2AReplicationDetails", + "azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionIntentProviderSpecificSettings": "Microsoft.RecoveryServices.ReplicationProtectionIntentProviderSpecificSettings", + "azure.mgmt.recoveryservicessiterecovery.models.A2AReplicationIntentDetails": "Microsoft.RecoveryServices.A2AReplicationIntentDetails", + "azure.mgmt.recoveryservicessiterecovery.models.ReplicationClusterProviderSpecificSettings": "Microsoft.RecoveryServices.ReplicationClusterProviderSpecificSettings", + "azure.mgmt.recoveryservicessiterecovery.models.A2AReplicationProtectionClusterDetails": "Microsoft.RecoveryServices.A2AReplicationProtectionClusterDetails", + "azure.mgmt.recoveryservicessiterecovery.models.ReverseReplicationProviderSpecificInput": "Microsoft.RecoveryServices.ReverseReplicationProviderSpecificInput", + "azure.mgmt.recoveryservicessiterecovery.models.A2AReprotectInput": "Microsoft.RecoveryServices.A2AReprotectInput", + "azure.mgmt.recoveryservicessiterecovery.models.A2ASharedDiskIRErrorDetails": "Microsoft.RecoveryServices.A2ASharedDiskIRErrorDetails", + "azure.mgmt.recoveryservicessiterecovery.models.SharedDiskReplicationProviderSpecificSettings": "Microsoft.RecoveryServices.SharedDiskReplicationProviderSpecificSettings", + "azure.mgmt.recoveryservicessiterecovery.models.A2ASharedDiskReplicationDetails": "Microsoft.RecoveryServices.A2ASharedDiskReplicationDetails", + "azure.mgmt.recoveryservicessiterecovery.models.SwitchClusterProtectionProviderSpecificInput": "Microsoft.RecoveryServices.SwitchClusterProtectionProviderSpecificInput", + "azure.mgmt.recoveryservicessiterecovery.models.A2ASwitchClusterProtectionInput": "Microsoft.RecoveryServices.A2ASwitchClusterProtectionInput", + "azure.mgmt.recoveryservicessiterecovery.models.SwitchProtectionProviderSpecificInput": "Microsoft.RecoveryServices.SwitchProtectionProviderSpecificInput", + "azure.mgmt.recoveryservicessiterecovery.models.A2ASwitchProtectionInput": "Microsoft.RecoveryServices.A2ASwitchProtectionInput", + "azure.mgmt.recoveryservicessiterecovery.models.TestFailoverProviderSpecificInput": "Microsoft.RecoveryServices.TestFailoverProviderSpecificInput", + "azure.mgmt.recoveryservicessiterecovery.models.A2ATestFailoverInput": "Microsoft.RecoveryServices.A2ATestFailoverInput", + "azure.mgmt.recoveryservicessiterecovery.models.UnplannedFailoverProviderSpecificInput": "Microsoft.RecoveryServices.UnplannedFailoverProviderSpecificInput", + "azure.mgmt.recoveryservicessiterecovery.models.A2AUnplannedFailoverInput": "Microsoft.RecoveryServices.A2AUnplannedFailoverInput", + "azure.mgmt.recoveryservicessiterecovery.models.A2AUnprotectedDiskDetails": "Microsoft.RecoveryServices.A2AUnprotectedDiskDetails", + "azure.mgmt.recoveryservicessiterecovery.models.ReplicationProviderSpecificUpdateContainerMappingInput": "Microsoft.RecoveryServices.ReplicationProviderSpecificUpdateContainerMappingInput", + "azure.mgmt.recoveryservicessiterecovery.models.A2AUpdateContainerMappingInput": "Microsoft.RecoveryServices.A2AUpdateContainerMappingInput", + "azure.mgmt.recoveryservicessiterecovery.models.UpdateReplicationProtectedItemProviderInput": "Microsoft.RecoveryServices.UpdateReplicationProtectedItemProviderInput", + "azure.mgmt.recoveryservicessiterecovery.models.A2AUpdateReplicationProtectedItemInput": "Microsoft.RecoveryServices.A2AUpdateReplicationProtectedItemInput", + "azure.mgmt.recoveryservicessiterecovery.models.A2AVmDiskInputDetails": "Microsoft.RecoveryServices.A2AVmDiskInputDetails", + "azure.mgmt.recoveryservicessiterecovery.models.A2AVmManagedDiskInputDetails": "Microsoft.RecoveryServices.A2AVmManagedDiskInputDetails", + "azure.mgmt.recoveryservicessiterecovery.models.A2AVmManagedDiskUpdateDetails": "Microsoft.RecoveryServices.A2AVmManagedDiskUpdateDetails", + "azure.mgmt.recoveryservicessiterecovery.models.A2AZoneDetails": "Microsoft.RecoveryServices.A2AZoneDetails", + "azure.mgmt.recoveryservicessiterecovery.models.AddDisksInput": "Microsoft.RecoveryServices.AddDisksInput", + "azure.mgmt.recoveryservicessiterecovery.models.AddDisksInputProperties": "Microsoft.RecoveryServices.AddDisksInputProperties", + "azure.mgmt.recoveryservicessiterecovery.models.AddRecoveryServicesProviderInput": "Microsoft.RecoveryServices.AddRecoveryServicesProviderInput", + "azure.mgmt.recoveryservicessiterecovery.models.AddRecoveryServicesProviderInputProperties": "Microsoft.RecoveryServices.AddRecoveryServicesProviderInputProperties", + "azure.mgmt.recoveryservicessiterecovery.models.AddVCenterRequest": "Microsoft.RecoveryServices.AddVCenterRequest", + "azure.mgmt.recoveryservicessiterecovery.models.AddVCenterRequestProperties": "Microsoft.RecoveryServices.AddVCenterRequestProperties", + "azure.mgmt.recoveryservicessiterecovery.models.AgentDetails": "Microsoft.RecoveryServices.AgentDetails", + "azure.mgmt.recoveryservicessiterecovery.models.AgentDiskDetails": "Microsoft.RecoveryServices.AgentDiskDetails", + "azure.mgmt.recoveryservicessiterecovery.models.Resource": "Azure.ResourceManager.CommonTypes.Resource", + "azure.mgmt.recoveryservicessiterecovery.models.ProxyResource": "Azure.ResourceManager.CommonTypes.ProxyResource", + "azure.mgmt.recoveryservicessiterecovery.models.Alert": "Microsoft.RecoveryServices.Alert", + "azure.mgmt.recoveryservicessiterecovery.models.AlertProperties": "Microsoft.RecoveryServices.AlertProperties", + "azure.mgmt.recoveryservicessiterecovery.models.ApplianceMonitoringDetails": "Microsoft.RecoveryServices.ApplianceMonitoringDetails", + "azure.mgmt.recoveryservicessiterecovery.models.ApplianceResourceDetails": "Microsoft.RecoveryServices.ApplianceResourceDetails", + "azure.mgmt.recoveryservicessiterecovery.models.ApplianceSpecificDetails": "Microsoft.RecoveryServices.ApplianceSpecificDetails", + "azure.mgmt.recoveryservicessiterecovery.models.ApplyClusterRecoveryPointInput": "Microsoft.RecoveryServices.ApplyClusterRecoveryPointInput", + "azure.mgmt.recoveryservicessiterecovery.models.ApplyClusterRecoveryPointInputProperties": "Microsoft.RecoveryServices.ApplyClusterRecoveryPointInputProperties", + "azure.mgmt.recoveryservicessiterecovery.models.ApplyRecoveryPointInput": "Microsoft.RecoveryServices.ApplyRecoveryPointInput", + "azure.mgmt.recoveryservicessiterecovery.models.ApplyRecoveryPointInputProperties": "Microsoft.RecoveryServices.ApplyRecoveryPointInputProperties", + "azure.mgmt.recoveryservicessiterecovery.models.JobDetails": "Microsoft.RecoveryServices.JobDetails", + "azure.mgmt.recoveryservicessiterecovery.models.AsrJobDetails": "Microsoft.RecoveryServices.AsrJobDetails", + "azure.mgmt.recoveryservicessiterecovery.models.ASRTask": "Microsoft.RecoveryServices.ASRTask", + "azure.mgmt.recoveryservicessiterecovery.models.TaskTypeDetails": "Microsoft.RecoveryServices.TaskTypeDetails", + "azure.mgmt.recoveryservicessiterecovery.models.AutomationRunbookTaskDetails": "Microsoft.RecoveryServices.AutomationRunbookTaskDetails", + "azure.mgmt.recoveryservicessiterecovery.models.FabricSpecificCreationInput": "Microsoft.RecoveryServices.FabricSpecificCreationInput", + "azure.mgmt.recoveryservicessiterecovery.models.AzureFabricCreationInput": "Microsoft.RecoveryServices.AzureFabricCreationInput", + "azure.mgmt.recoveryservicessiterecovery.models.FabricSpecificDetails": "Microsoft.RecoveryServices.FabricSpecificDetails", + "azure.mgmt.recoveryservicessiterecovery.models.AzureFabricSpecificDetails": "Microsoft.RecoveryServices.AzureFabricSpecificDetails", + "azure.mgmt.recoveryservicessiterecovery.models.FabricSpecificCreateNetworkMappingInput": "Microsoft.RecoveryServices.FabricSpecificCreateNetworkMappingInput", + "azure.mgmt.recoveryservicessiterecovery.models.AzureToAzureCreateNetworkMappingInput": "Microsoft.RecoveryServices.AzureToAzureCreateNetworkMappingInput", + "azure.mgmt.recoveryservicessiterecovery.models.NetworkMappingFabricSpecificSettings": "Microsoft.RecoveryServices.NetworkMappingFabricSpecificSettings", + "azure.mgmt.recoveryservicessiterecovery.models.AzureToAzureNetworkMappingSettings": "Microsoft.RecoveryServices.AzureToAzureNetworkMappingSettings", + "azure.mgmt.recoveryservicessiterecovery.models.FabricSpecificUpdateNetworkMappingInput": "Microsoft.RecoveryServices.FabricSpecificUpdateNetworkMappingInput", + "azure.mgmt.recoveryservicessiterecovery.models.AzureToAzureUpdateNetworkMappingInput": "Microsoft.RecoveryServices.AzureToAzureUpdateNetworkMappingInput", + "azure.mgmt.recoveryservicessiterecovery.models.AzureToAzureVmSyncedConfigDetails": "Microsoft.RecoveryServices.AzureToAzureVmSyncedConfigDetails", + "azure.mgmt.recoveryservicessiterecovery.models.AzureVmDiskDetails": "Microsoft.RecoveryServices.AzureVmDiskDetails", + "azure.mgmt.recoveryservicessiterecovery.models.ClusterFailoverJobDetails": "Microsoft.RecoveryServices.ClusterFailoverJobDetails", + "azure.mgmt.recoveryservicessiterecovery.models.ClusterRecoveryPoint": "Microsoft.RecoveryServices.ClusterRecoveryPoint", + "azure.mgmt.recoveryservicessiterecovery.models.ClusterRecoveryPointProperties": "Microsoft.RecoveryServices.ClusterRecoveryPointProperties", + "azure.mgmt.recoveryservicessiterecovery.models.ClusterSwitchProtectionJobDetails": "Microsoft.RecoveryServices.ClusterSwitchProtectionJobDetails", + "azure.mgmt.recoveryservicessiterecovery.models.ClusterTestFailoverCleanupInput": "Microsoft.RecoveryServices.ClusterTestFailoverCleanupInput", + "azure.mgmt.recoveryservicessiterecovery.models.ClusterTestFailoverCleanupInputProperties": "Microsoft.RecoveryServices.ClusterTestFailoverCleanupInputProperties", + "azure.mgmt.recoveryservicessiterecovery.models.ClusterTestFailoverInput": "Microsoft.RecoveryServices.ClusterTestFailoverInput", + "azure.mgmt.recoveryservicessiterecovery.models.ClusterTestFailoverInputProperties": "Microsoft.RecoveryServices.ClusterTestFailoverInputProperties", + "azure.mgmt.recoveryservicessiterecovery.models.ClusterTestFailoverJobDetails": "Microsoft.RecoveryServices.ClusterTestFailoverJobDetails", + "azure.mgmt.recoveryservicessiterecovery.models.ClusterUnplannedFailoverInput": "Microsoft.RecoveryServices.ClusterUnplannedFailoverInput", + "azure.mgmt.recoveryservicessiterecovery.models.ClusterUnplannedFailoverInputProperties": "Microsoft.RecoveryServices.ClusterUnplannedFailoverInputProperties", + "azure.mgmt.recoveryservicessiterecovery.models.ComputeSizeErrorDetails": "Microsoft.RecoveryServices.ComputeSizeErrorDetails", + "azure.mgmt.recoveryservicessiterecovery.models.ConfigurationSettings": "Microsoft.RecoveryServices.ConfigurationSettings", + "azure.mgmt.recoveryservicessiterecovery.models.ConfigureAlertRequest": "Microsoft.RecoveryServices.ConfigureAlertRequest", + "azure.mgmt.recoveryservicessiterecovery.models.ConfigureAlertRequestProperties": "Microsoft.RecoveryServices.ConfigureAlertRequestProperties", + "azure.mgmt.recoveryservicessiterecovery.models.ConsistencyCheckTaskDetails": "Microsoft.RecoveryServices.ConsistencyCheckTaskDetails", + "azure.mgmt.recoveryservicessiterecovery.models.CreateNetworkMappingInput": "Microsoft.RecoveryServices.CreateNetworkMappingInput", + "azure.mgmt.recoveryservicessiterecovery.models.CreateNetworkMappingInputProperties": "Microsoft.RecoveryServices.CreateNetworkMappingInputProperties", + "azure.mgmt.recoveryservicessiterecovery.models.CreatePolicyInput": "Microsoft.RecoveryServices.CreatePolicyInput", + "azure.mgmt.recoveryservicessiterecovery.models.CreatePolicyInputProperties": "Microsoft.RecoveryServices.CreatePolicyInputProperties", + "azure.mgmt.recoveryservicessiterecovery.models.CreateProtectionContainerInput": "Microsoft.RecoveryServices.CreateProtectionContainerInput", + "azure.mgmt.recoveryservicessiterecovery.models.CreateProtectionContainerInputProperties": "Microsoft.RecoveryServices.CreateProtectionContainerInputProperties", + "azure.mgmt.recoveryservicessiterecovery.models.CreateProtectionContainerMappingInput": "Microsoft.RecoveryServices.CreateProtectionContainerMappingInput", + "azure.mgmt.recoveryservicessiterecovery.models.CreateProtectionContainerMappingInputProperties": "Microsoft.RecoveryServices.CreateProtectionContainerMappingInputProperties", + "azure.mgmt.recoveryservicessiterecovery.models.CreateProtectionIntentInput": "Microsoft.RecoveryServices.CreateProtectionIntentInput", + "azure.mgmt.recoveryservicessiterecovery.models.CreateProtectionIntentProperties": "Microsoft.RecoveryServices.CreateProtectionIntentProperties", + "azure.mgmt.recoveryservicessiterecovery.models.CreateRecoveryPlanInput": "Microsoft.RecoveryServices.CreateRecoveryPlanInput", + "azure.mgmt.recoveryservicessiterecovery.models.CreateRecoveryPlanInputProperties": "Microsoft.RecoveryServices.CreateRecoveryPlanInputProperties", + "azure.mgmt.recoveryservicessiterecovery.models.CriticalJobHistoryDetails": "Microsoft.RecoveryServices.CriticalJobHistoryDetails", + "azure.mgmt.recoveryservicessiterecovery.models.CurrentJobDetails": "Microsoft.RecoveryServices.CurrentJobDetails", + "azure.mgmt.recoveryservicessiterecovery.models.CurrentScenarioDetails": "Microsoft.RecoveryServices.CurrentScenarioDetails", + "azure.mgmt.recoveryservicessiterecovery.models.DataStore": "Microsoft.RecoveryServices.DataStore", + "azure.mgmt.recoveryservicessiterecovery.models.DataStoreUtilizationDetails": "Microsoft.RecoveryServices.DataStoreUtilizationDetails", + "azure.mgmt.recoveryservicessiterecovery.models.DisableProtectionInput": "Microsoft.RecoveryServices.DisableProtectionInput", + "azure.mgmt.recoveryservicessiterecovery.models.DisableProtectionInputProperties": "Microsoft.RecoveryServices.DisableProtectionInputProperties", + "azure.mgmt.recoveryservicessiterecovery.models.DisableProtectionProviderSpecificInput": "Microsoft.RecoveryServices.DisableProtectionProviderSpecificInput", + "azure.mgmt.recoveryservicessiterecovery.models.DiscoverProtectableItemRequest": "Microsoft.RecoveryServices.DiscoverProtectableItemRequest", + "azure.mgmt.recoveryservicessiterecovery.models.DiscoverProtectableItemRequestProperties": "Microsoft.RecoveryServices.DiscoverProtectableItemRequestProperties", + "azure.mgmt.recoveryservicessiterecovery.models.DiskDetails": "Microsoft.RecoveryServices.DiskDetails", + "azure.mgmt.recoveryservicessiterecovery.models.DiskEncryptionInfo": "Microsoft.RecoveryServices.DiskEncryptionInfo", + "azure.mgmt.recoveryservicessiterecovery.models.DiskEncryptionKeyInfo": "Microsoft.RecoveryServices.DiskEncryptionKeyInfo", + "azure.mgmt.recoveryservicessiterecovery.models.DiskVolumeDetails": "Microsoft.RecoveryServices.DiskVolumeDetails", + "azure.mgmt.recoveryservicessiterecovery.models.Display": "Microsoft.RecoveryServices.Display", + "azure.mgmt.recoveryservicessiterecovery.models.DraDetails": "Microsoft.RecoveryServices.DraDetails", + "azure.mgmt.recoveryservicessiterecovery.models.EnableMigrationInput": "Microsoft.RecoveryServices.EnableMigrationInput", + "azure.mgmt.recoveryservicessiterecovery.models.EnableMigrationInputProperties": "Microsoft.RecoveryServices.EnableMigrationInputProperties", + "azure.mgmt.recoveryservicessiterecovery.models.EnableMigrationProviderSpecificInput": "Microsoft.RecoveryServices.EnableMigrationProviderSpecificInput", + "azure.mgmt.recoveryservicessiterecovery.models.EnableProtectionInput": "Microsoft.RecoveryServices.EnableProtectionInput", + "azure.mgmt.recoveryservicessiterecovery.models.EnableProtectionInputProperties": "Microsoft.RecoveryServices.EnableProtectionInputProperties", + "azure.mgmt.recoveryservicessiterecovery.models.EncryptionDetails": "Microsoft.RecoveryServices.EncryptionDetails", + "azure.mgmt.recoveryservicessiterecovery.models.ErrorAdditionalInfo": "Azure.ResourceManager.CommonTypes.ErrorAdditionalInfo", + "azure.mgmt.recoveryservicessiterecovery.models.ErrorDetail": "Azure.ResourceManager.CommonTypes.ErrorDetail", + "azure.mgmt.recoveryservicessiterecovery.models.ErrorResponse": "Azure.ResourceManager.CommonTypes.ErrorResponse", + "azure.mgmt.recoveryservicessiterecovery.models.Event": "Microsoft.RecoveryServices.Event", + "azure.mgmt.recoveryservicessiterecovery.models.EventProperties": "Microsoft.RecoveryServices.EventProperties", + "azure.mgmt.recoveryservicessiterecovery.models.EventSpecificDetails": "Microsoft.RecoveryServices.EventSpecificDetails", + "azure.mgmt.recoveryservicessiterecovery.models.ProtectionProfileCustomDetails": "Microsoft.RecoveryServices.ProtectionProfileCustomDetails", + "azure.mgmt.recoveryservicessiterecovery.models.ExistingProtectionProfile": "Microsoft.RecoveryServices.ExistingProtectionProfile", + "azure.mgmt.recoveryservicessiterecovery.models.RecoveryAvailabilitySetCustomDetails": "Microsoft.RecoveryServices.RecoveryAvailabilitySetCustomDetails", + "azure.mgmt.recoveryservicessiterecovery.models.ExistingRecoveryAvailabilitySet": "Microsoft.RecoveryServices.ExistingRecoveryAvailabilitySet", + "azure.mgmt.recoveryservicessiterecovery.models.RecoveryProximityPlacementGroupCustomDetails": "Microsoft.RecoveryServices.RecoveryProximityPlacementGroupCustomDetails", + "azure.mgmt.recoveryservicessiterecovery.models.ExistingRecoveryProximityPlacementGroup": "Microsoft.RecoveryServices.ExistingRecoveryProximityPlacementGroup", + "azure.mgmt.recoveryservicessiterecovery.models.RecoveryResourceGroupCustomDetails": "Microsoft.RecoveryServices.RecoveryResourceGroupCustomDetails", + "azure.mgmt.recoveryservicessiterecovery.models.ExistingRecoveryResourceGroup": "Microsoft.RecoveryServices.ExistingRecoveryRecoveryResourceGroup", + "azure.mgmt.recoveryservicessiterecovery.models.RecoveryVirtualNetworkCustomDetails": "Microsoft.RecoveryServices.RecoveryVirtualNetworkCustomDetails", + "azure.mgmt.recoveryservicessiterecovery.models.ExistingRecoveryVirtualNetwork": "Microsoft.RecoveryServices.ExistingRecoveryVirtualNetwork", + "azure.mgmt.recoveryservicessiterecovery.models.StorageAccountCustomDetails": "Microsoft.RecoveryServices.StorageAccountCustomDetails", + "azure.mgmt.recoveryservicessiterecovery.models.ExistingStorageAccount": "Microsoft.RecoveryServices.ExistingStorageAccount", + "azure.mgmt.recoveryservicessiterecovery.models.ExportJobDetails": "Microsoft.RecoveryServices.ExportJobDetails", + "azure.mgmt.recoveryservicessiterecovery.models.ExtendedLocation": "Microsoft.RecoveryServices.ExtendedLocation", + "azure.mgmt.recoveryservicessiterecovery.models.Fabric": "Microsoft.RecoveryServices.Fabric", + "azure.mgmt.recoveryservicessiterecovery.models.FabricCreationInput": "Microsoft.RecoveryServices.FabricCreationInput", + "azure.mgmt.recoveryservicessiterecovery.models.FabricCreationInputProperties": "Microsoft.RecoveryServices.FabricCreationInputProperties", + "azure.mgmt.recoveryservicessiterecovery.models.FabricProperties": "Microsoft.RecoveryServices.FabricProperties", + "azure.mgmt.recoveryservicessiterecovery.models.JobTaskDetails": "Microsoft.RecoveryServices.JobTaskDetails", + "azure.mgmt.recoveryservicessiterecovery.models.FabricReplicationGroupTaskDetails": "Microsoft.RecoveryServices.FabricReplicationGroupTaskDetails", + "azure.mgmt.recoveryservicessiterecovery.models.FailoverJobDetails": "Microsoft.RecoveryServices.FailoverJobDetails", + "azure.mgmt.recoveryservicessiterecovery.models.FailoverProcessServerRequest": "Microsoft.RecoveryServices.FailoverProcessServerRequest", + "azure.mgmt.recoveryservicessiterecovery.models.FailoverProcessServerRequestProperties": "Microsoft.RecoveryServices.FailoverProcessServerRequestProperties", + "azure.mgmt.recoveryservicessiterecovery.models.FailoverReplicationProtectedItemDetails": "Microsoft.RecoveryServices.FailoverReplicationProtectedItemDetails", + "azure.mgmt.recoveryservicessiterecovery.models.GatewayOperationDetails": "Microsoft.RecoveryServices.GatewayOperationDetails", + "azure.mgmt.recoveryservicessiterecovery.models.GroupTaskDetails": "Microsoft.RecoveryServices.GroupTaskDetails", + "azure.mgmt.recoveryservicessiterecovery.models.HealthError": "Microsoft.RecoveryServices.HealthError", + "azure.mgmt.recoveryservicessiterecovery.models.HealthErrorSummary": "Microsoft.RecoveryServices.HealthErrorSummary", + "azure.mgmt.recoveryservicessiterecovery.models.HyperVHostDetails": "Microsoft.RecoveryServices.HyperVHostDetails", + "azure.mgmt.recoveryservicessiterecovery.models.HyperVReplica2012EventDetails": "Microsoft.RecoveryServices.HyperVReplica2012EventDetails", + "azure.mgmt.recoveryservicessiterecovery.models.HyperVReplica2012R2EventDetails": "Microsoft.RecoveryServices.HyperVReplica2012R2EventDetails", + "azure.mgmt.recoveryservicessiterecovery.models.HyperVReplicaAzureApplyRecoveryPointInput": "Microsoft.RecoveryServices.HyperVReplicaAzureApplyRecoveryPointInput", + "azure.mgmt.recoveryservicessiterecovery.models.HyperVReplicaAzureDiskInputDetails": "Microsoft.RecoveryServices.HyperVReplicaAzureDiskInputDetails", + "azure.mgmt.recoveryservicessiterecovery.models.HyperVReplicaAzureEnableProtectionInput": "Microsoft.RecoveryServices.HyperVReplicaAzureEnableProtectionInput", + "azure.mgmt.recoveryservicessiterecovery.models.HyperVReplicaAzureEventDetails": "Microsoft.RecoveryServices.HyperVReplicaAzureEventDetails", + "azure.mgmt.recoveryservicessiterecovery.models.PlannedFailoverProviderSpecificFailoverInput": "Microsoft.RecoveryServices.PlannedFailoverProviderSpecificFailoverInput", + "azure.mgmt.recoveryservicessiterecovery.models.HyperVReplicaAzureFailbackProviderInput": "Microsoft.RecoveryServices.HyperVReplicaAzureFailbackProviderInput", + "azure.mgmt.recoveryservicessiterecovery.models.HyperVReplicaAzureManagedDiskDetails": "Microsoft.RecoveryServices.HyperVReplicaAzureManagedDiskDetails", + "azure.mgmt.recoveryservicessiterecovery.models.HyperVReplicaAzurePlannedFailoverProviderInput": "Microsoft.RecoveryServices.HyperVReplicaAzurePlannedFailoverProviderInput", + "azure.mgmt.recoveryservicessiterecovery.models.HyperVReplicaAzurePolicyDetails": "Microsoft.RecoveryServices.HyperVReplicaAzurePolicyDetails", + "azure.mgmt.recoveryservicessiterecovery.models.HyperVReplicaAzurePolicyInput": "Microsoft.RecoveryServices.HyperVReplicaAzurePolicyInput", + "azure.mgmt.recoveryservicessiterecovery.models.HyperVReplicaAzureReplicationDetails": "Microsoft.RecoveryServices.HyperVReplicaAzureReplicationDetails", + "azure.mgmt.recoveryservicessiterecovery.models.HyperVReplicaAzureReprotectInput": "Microsoft.RecoveryServices.HyperVReplicaAzureReprotectInput", + "azure.mgmt.recoveryservicessiterecovery.models.HyperVReplicaAzureTestFailoverInput": "Microsoft.RecoveryServices.HyperVReplicaAzureTestFailoverInput", + "azure.mgmt.recoveryservicessiterecovery.models.HyperVReplicaAzureUnplannedFailoverInput": "Microsoft.RecoveryServices.HyperVReplicaAzureUnplannedFailoverInput", + "azure.mgmt.recoveryservicessiterecovery.models.HyperVReplicaAzureUpdateReplicationProtectedItemInput": "Microsoft.RecoveryServices.HyperVReplicaAzureUpdateReplicationProtectedItemInput", + "azure.mgmt.recoveryservicessiterecovery.models.HyperVReplicaBaseEventDetails": "Microsoft.RecoveryServices.HyperVReplicaBaseEventDetails", + "azure.mgmt.recoveryservicessiterecovery.models.HyperVReplicaBasePolicyDetails": "Microsoft.RecoveryServices.HyperVReplicaBasePolicyDetails", + "azure.mgmt.recoveryservicessiterecovery.models.HyperVReplicaBaseReplicationDetails": "Microsoft.RecoveryServices.HyperVReplicaBaseReplicationDetails", + "azure.mgmt.recoveryservicessiterecovery.models.HyperVReplicaBluePolicyDetails": "Microsoft.RecoveryServices.HyperVReplicaBluePolicyDetails", + "azure.mgmt.recoveryservicessiterecovery.models.HyperVReplicaPolicyInput": "Microsoft.RecoveryServices.HyperVReplicaPolicyInput", + "azure.mgmt.recoveryservicessiterecovery.models.HyperVReplicaBluePolicyInput": "Microsoft.RecoveryServices.HyperVReplicaBluePolicyInput", + "azure.mgmt.recoveryservicessiterecovery.models.HyperVReplicaBlueReplicationDetails": "Microsoft.RecoveryServices.HyperVReplicaBlueReplicationDetails", + "azure.mgmt.recoveryservicessiterecovery.models.HyperVReplicaPolicyDetails": "Microsoft.RecoveryServices.HyperVReplicaPolicyDetails", + "azure.mgmt.recoveryservicessiterecovery.models.HyperVReplicaReplicationDetails": "Microsoft.RecoveryServices.HyperVReplicaReplicationDetails", + "azure.mgmt.recoveryservicessiterecovery.models.HyperVSiteDetails": "Microsoft.RecoveryServices.HyperVSiteDetails", + "azure.mgmt.recoveryservicessiterecovery.models.HyperVVirtualMachineDetails": "Microsoft.RecoveryServices.HyperVVirtualMachineDetails", + "azure.mgmt.recoveryservicessiterecovery.models.IdentityProviderDetails": "Microsoft.RecoveryServices.IdentityProviderDetails", + "azure.mgmt.recoveryservicessiterecovery.models.IdentityProviderInput": "Microsoft.RecoveryServices.IdentityProviderInput", + "azure.mgmt.recoveryservicessiterecovery.models.InconsistentVmDetails": "Microsoft.RecoveryServices.InconsistentVmDetails", + "azure.mgmt.recoveryservicessiterecovery.models.InitialReplicationDetails": "Microsoft.RecoveryServices.InitialReplicationDetails", + "azure.mgmt.recoveryservicessiterecovery.models.InlineWorkflowTaskDetails": "Microsoft.RecoveryServices.InlineWorkflowTaskDetails", + "azure.mgmt.recoveryservicessiterecovery.models.InMageAgentDetails": "Microsoft.RecoveryServices.InMageAgentDetails", + "azure.mgmt.recoveryservicessiterecovery.models.InMageAzureV2ApplyRecoveryPointInput": "Microsoft.RecoveryServices.InMageAzureV2ApplyRecoveryPointInput", + "azure.mgmt.recoveryservicessiterecovery.models.InMageAzureV2DiskInputDetails": "Microsoft.RecoveryServices.InMageAzureV2DiskInputDetails", + "azure.mgmt.recoveryservicessiterecovery.models.InMageAzureV2EnableProtectionInput": "Microsoft.RecoveryServices.InMageAzureV2EnableProtectionInput", + "azure.mgmt.recoveryservicessiterecovery.models.InMageAzureV2EventDetails": "Microsoft.RecoveryServices.InMageAzureV2EventDetails", + "azure.mgmt.recoveryservicessiterecovery.models.InMageAzureV2ManagedDiskDetails": "Microsoft.RecoveryServices.InMageAzureV2ManagedDiskDetails", + "azure.mgmt.recoveryservicessiterecovery.models.InMageAzureV2PolicyDetails": "Microsoft.RecoveryServices.InMageAzureV2PolicyDetails", + "azure.mgmt.recoveryservicessiterecovery.models.InMageAzureV2PolicyInput": "Microsoft.RecoveryServices.InMageAzureV2PolicyInput", + "azure.mgmt.recoveryservicessiterecovery.models.InMageAzureV2ProtectedDiskDetails": "Microsoft.RecoveryServices.InMageAzureV2ProtectedDiskDetails", + "azure.mgmt.recoveryservicessiterecovery.models.InMageAzureV2RecoveryPointDetails": "Microsoft.RecoveryServices.InMageAzureV2RecoveryPointDetails", + "azure.mgmt.recoveryservicessiterecovery.models.InMageAzureV2ReplicationDetails": "Microsoft.RecoveryServices.InMageAzureV2ReplicationDetails", + "azure.mgmt.recoveryservicessiterecovery.models.InMageAzureV2ReprotectInput": "Microsoft.RecoveryServices.InMageAzureV2ReprotectInput", + "azure.mgmt.recoveryservicessiterecovery.models.InMageAzureV2SwitchProviderBlockingErrorDetails": "Microsoft.RecoveryServices.InMageAzureV2SwitchProviderBlockingErrorDetails", + "azure.mgmt.recoveryservicessiterecovery.models.InMageAzureV2SwitchProviderDetails": "Microsoft.RecoveryServices.InMageAzureV2SwitchProviderDetails", + "azure.mgmt.recoveryservicessiterecovery.models.SwitchProviderSpecificInput": "Microsoft.RecoveryServices.SwitchProviderProviderSpecificInput", + "azure.mgmt.recoveryservicessiterecovery.models.InMageAzureV2SwitchProviderInput": "Microsoft.RecoveryServices.InMageAzureV2SwitchProviderProviderInput", + "azure.mgmt.recoveryservicessiterecovery.models.InMageAzureV2TestFailoverInput": "Microsoft.RecoveryServices.InMageAzureV2TestFailoverInput", + "azure.mgmt.recoveryservicessiterecovery.models.InMageAzureV2UnplannedFailoverInput": "Microsoft.RecoveryServices.InMageAzureV2UnplannedFailoverInput", + "azure.mgmt.recoveryservicessiterecovery.models.InMageAzureV2UpdateReplicationProtectedItemInput": "Microsoft.RecoveryServices.InMageAzureV2UpdateReplicationProtectedItemInput", + "azure.mgmt.recoveryservicessiterecovery.models.InMageBasePolicyDetails": "Microsoft.RecoveryServices.InMageBasePolicyDetails", + "azure.mgmt.recoveryservicessiterecovery.models.InMageDisableProtectionProviderSpecificInput": "Microsoft.RecoveryServices.InMageDisableProtectionProviderSpecificInput", + "azure.mgmt.recoveryservicessiterecovery.models.InMageDiskDetails": "Microsoft.RecoveryServices.InMageDiskDetails", + "azure.mgmt.recoveryservicessiterecovery.models.InMageDiskExclusionInput": "Microsoft.RecoveryServices.InMageDiskExclusionInput", + "azure.mgmt.recoveryservicessiterecovery.models.InMageDiskSignatureExclusionOptions": "Microsoft.RecoveryServices.InMageDiskSignatureExclusionOptions", + "azure.mgmt.recoveryservicessiterecovery.models.InMageEnableProtectionInput": "Microsoft.RecoveryServices.InMageEnableProtectionInput", + "azure.mgmt.recoveryservicessiterecovery.models.InMageFabricSwitchProviderBlockingErrorDetails": "Microsoft.RecoveryServices.InMageFabricSwitchProviderBlockingErrorDetails", + "azure.mgmt.recoveryservicessiterecovery.models.InMagePolicyDetails": "Microsoft.RecoveryServices.InMagePolicyDetails", + "azure.mgmt.recoveryservicessiterecovery.models.InMagePolicyInput": "Microsoft.RecoveryServices.InMagePolicyInput", + "azure.mgmt.recoveryservicessiterecovery.models.InMageProtectedDiskDetails": "Microsoft.RecoveryServices.InMageProtectedDiskDetails", + "azure.mgmt.recoveryservicessiterecovery.models.InMageRcmAddDisksInput": "Microsoft.RecoveryServices.InMageRcmAddDisksInput", + "azure.mgmt.recoveryservicessiterecovery.models.InMageRcmAgentReinstallBlockingErrorDetails": "Microsoft.RecoveryServices.InMageRcmAgentReinstallBlockingErrorDetails", + "azure.mgmt.recoveryservicessiterecovery.models.InMageRcmAgentUpgradeBlockingErrorDetails": "Microsoft.RecoveryServices.InMageRcmAgentUpgradeBlockingErrorDetails", + "azure.mgmt.recoveryservicessiterecovery.models.InMageRcmApplianceDetails": "Microsoft.RecoveryServices.InMageRcmApplianceDetails", + "azure.mgmt.recoveryservicessiterecovery.models.InMageRcmApplianceSpecificDetails": "Microsoft.RecoveryServices.InMageRcmApplianceSpecificDetails", + "azure.mgmt.recoveryservicessiterecovery.models.InMageRcmApplyRecoveryPointInput": "Microsoft.RecoveryServices.InMageRcmApplyRecoveryPointInput", + "azure.mgmt.recoveryservicessiterecovery.models.InMageRcmDiscoveredProtectedVmDetails": "Microsoft.RecoveryServices.InMageRcmDiscoveredProtectedVmDetails", + "azure.mgmt.recoveryservicessiterecovery.models.InMageRcmDiskInput": "Microsoft.RecoveryServices.InMageRcmDiskInput", + "azure.mgmt.recoveryservicessiterecovery.models.InMageRcmDisksDefaultInput": "Microsoft.RecoveryServices.InMageRcmDisksDefaultInput", + "azure.mgmt.recoveryservicessiterecovery.models.InMageRcmEnableProtectionInput": "Microsoft.RecoveryServices.InMageRcmEnableProtectionInput", + "azure.mgmt.recoveryservicessiterecovery.models.InMageRcmEventDetails": "Microsoft.RecoveryServices.InMageRcmEventDetails", + "azure.mgmt.recoveryservicessiterecovery.models.InMageRcmFabricCreationInput": "Microsoft.RecoveryServices.InMageRcmFabricCreationInput", + "azure.mgmt.recoveryservicessiterecovery.models.InMageRcmFabricSpecificDetails": "Microsoft.RecoveryServices.InMageRcmFabricSpecificDetails", + "azure.mgmt.recoveryservicessiterecovery.models.InMageRcmFabricSwitchProviderBlockingErrorDetails": "Microsoft.RecoveryServices.InMageRcmFabricSwitchProviderBlockingErrorDetails", + "azure.mgmt.recoveryservicessiterecovery.models.InMageRcmFailbackDiscoveredProtectedVmDetails": "Microsoft.RecoveryServices.InMageRcmFailbackDiscoveredProtectedVmDetails", + "azure.mgmt.recoveryservicessiterecovery.models.InMageRcmFailbackEventDetails": "Microsoft.RecoveryServices.InMageRcmFailbackEventDetails", + "azure.mgmt.recoveryservicessiterecovery.models.InMageRcmFailbackMobilityAgentDetails": "Microsoft.RecoveryServices.InMageRcmFailbackMobilityAgentDetails", + "azure.mgmt.recoveryservicessiterecovery.models.InMageRcmFailbackNicDetails": "Microsoft.RecoveryServices.InMageRcmFailbackNicDetails", + "azure.mgmt.recoveryservicessiterecovery.models.InMageRcmFailbackPlannedFailoverProviderInput": "Microsoft.RecoveryServices.InMageRcmFailbackPlannedFailoverProviderInput", + "azure.mgmt.recoveryservicessiterecovery.models.InMageRcmFailbackPolicyCreationInput": "Microsoft.RecoveryServices.InMageRcmFailbackPolicyCreationInput", + "azure.mgmt.recoveryservicessiterecovery.models.InMageRcmFailbackPolicyDetails": "Microsoft.RecoveryServices.InMageRcmFailbackPolicyDetails", + "azure.mgmt.recoveryservicessiterecovery.models.InMageRcmFailbackProtectedDiskDetails": "Microsoft.RecoveryServices.InMageRcmFailbackProtectedDiskDetails", + "azure.mgmt.recoveryservicessiterecovery.models.InMageRcmFailbackReplicationDetails": "Microsoft.RecoveryServices.InMageRcmFailbackReplicationDetails", + "azure.mgmt.recoveryservicessiterecovery.models.InMageRcmFailbackReprotectInput": "Microsoft.RecoveryServices.InMageRcmFailbackReprotectInput", + "azure.mgmt.recoveryservicessiterecovery.models.InMageRcmFailbackSyncDetails": "Microsoft.RecoveryServices.InMageRcmFailbackSyncDetails", + "azure.mgmt.recoveryservicessiterecovery.models.InMageRcmLastAgentUpgradeErrorDetails": "Microsoft.RecoveryServices.InMageRcmLastAgentUpgradeErrorDetails", + "azure.mgmt.recoveryservicessiterecovery.models.InMageRcmMobilityAgentDetails": "Microsoft.RecoveryServices.InMageRcmMobilityAgentDetails", + "azure.mgmt.recoveryservicessiterecovery.models.InMageRcmNicDetails": "Microsoft.RecoveryServices.InMageRcmNicDetails", + "azure.mgmt.recoveryservicessiterecovery.models.InMageRcmNicInput": "Microsoft.RecoveryServices.InMageRcmNicInput", + "azure.mgmt.recoveryservicessiterecovery.models.InMageRcmPolicyCreationInput": "Microsoft.RecoveryServices.InMageRcmPolicyCreationInput", + "azure.mgmt.recoveryservicessiterecovery.models.InMageRcmPolicyDetails": "Microsoft.RecoveryServices.InMageRcmPolicyDetails", + "azure.mgmt.recoveryservicessiterecovery.models.InMageRcmProtectedDiskDetails": "Microsoft.RecoveryServices.InMageRcmProtectedDiskDetails", + "azure.mgmt.recoveryservicessiterecovery.models.InMageRcmProtectionContainerMappingDetails": "Microsoft.RecoveryServices.InMageRcmProtectionContainerMappingDetails", + "azure.mgmt.recoveryservicessiterecovery.models.InMageRcmRecoveryPointDetails": "Microsoft.RecoveryServices.InMageRcmRecoveryPointDetails", + "azure.mgmt.recoveryservicessiterecovery.models.InMageRcmReplicationDetails": "Microsoft.RecoveryServices.InMageRcmReplicationDetails", + "azure.mgmt.recoveryservicessiterecovery.models.InMageRcmReprotectInput": "Microsoft.RecoveryServices.InMageRcmReprotectInput", + "azure.mgmt.recoveryservicessiterecovery.models.InMageRcmSyncDetails": "Microsoft.RecoveryServices.InMageRcmSyncDetails", + "azure.mgmt.recoveryservicessiterecovery.models.InMageRcmTestFailoverInput": "Microsoft.RecoveryServices.InMageRcmTestFailoverInput", + "azure.mgmt.recoveryservicessiterecovery.models.InMageRcmUnplannedFailoverInput": "Microsoft.RecoveryServices.InMageRcmUnplannedFailoverInput", + "azure.mgmt.recoveryservicessiterecovery.models.InMageRcmUnProtectedDiskDetails": "Microsoft.RecoveryServices.InMageRcmUnProtectedDiskDetails", + "azure.mgmt.recoveryservicessiterecovery.models.UpdateApplianceForReplicationProtectedItemProviderSpecificInput": "Microsoft.RecoveryServices.UpdateApplianceForReplicationProtectedItemProviderSpecificInput", + "azure.mgmt.recoveryservicessiterecovery.models.InMageRcmUpdateApplianceForReplicationProtectedItemInput": "Microsoft.RecoveryServices.InMageRcmUpdateApplianceForReplicationProtectedItemInput", + "azure.mgmt.recoveryservicessiterecovery.models.InMageRcmUpdateContainerMappingInput": "Microsoft.RecoveryServices.InMageRcmUpdateContainerMappingInput", + "azure.mgmt.recoveryservicessiterecovery.models.InMageRcmUpdateReplicationProtectedItemInput": "Microsoft.RecoveryServices.InMageRcmUpdateReplicationProtectedItemInput", + "azure.mgmt.recoveryservicessiterecovery.models.InMageReplicationDetails": "Microsoft.RecoveryServices.InMageReplicationDetails", + "azure.mgmt.recoveryservicessiterecovery.models.InMageReprotectInput": "Microsoft.RecoveryServices.InMageReprotectInput", + "azure.mgmt.recoveryservicessiterecovery.models.InMageTestFailoverInput": "Microsoft.RecoveryServices.InMageTestFailoverInput", + "azure.mgmt.recoveryservicessiterecovery.models.InMageUnplannedFailoverInput": "Microsoft.RecoveryServices.InMageUnplannedFailoverInput", + "azure.mgmt.recoveryservicessiterecovery.models.InMageVolumeExclusionOptions": "Microsoft.RecoveryServices.InMageVolumeExclusionOptions", + "azure.mgmt.recoveryservicessiterecovery.models.InnerHealthError": "Microsoft.RecoveryServices.InnerHealthError", + "azure.mgmt.recoveryservicessiterecovery.models.InputEndpoint": "Microsoft.RecoveryServices.InputEndpoint", + "azure.mgmt.recoveryservicessiterecovery.models.IPConfigDetails": "Microsoft.RecoveryServices.IPConfigDetails", + "azure.mgmt.recoveryservicessiterecovery.models.IPConfigInputDetails": "Microsoft.RecoveryServices.IPConfigInputDetails", + "azure.mgmt.recoveryservicessiterecovery.models.Job": "Microsoft.RecoveryServices.Job", + "azure.mgmt.recoveryservicessiterecovery.models.JobEntity": "Microsoft.RecoveryServices.JobEntity", + "azure.mgmt.recoveryservicessiterecovery.models.JobErrorDetails": "Microsoft.RecoveryServices.JobErrorDetails", + "azure.mgmt.recoveryservicessiterecovery.models.JobProperties": "Microsoft.RecoveryServices.JobProperties", + "azure.mgmt.recoveryservicessiterecovery.models.JobQueryParameter": "Microsoft.RecoveryServices.JobQueryParameter", + "azure.mgmt.recoveryservicessiterecovery.models.JobStatusEventDetails": "Microsoft.RecoveryServices.JobStatusEventDetails", + "azure.mgmt.recoveryservicessiterecovery.models.KeyEncryptionKeyInfo": "Microsoft.RecoveryServices.KeyEncryptionKeyInfo", + "azure.mgmt.recoveryservicessiterecovery.models.LogicalNetwork": "Microsoft.RecoveryServices.LogicalNetwork", + "azure.mgmt.recoveryservicessiterecovery.models.LogicalNetworkProperties": "Microsoft.RecoveryServices.LogicalNetworkProperties", + "azure.mgmt.recoveryservicessiterecovery.models.ManagedRunCommandScriptInput": "Microsoft.RecoveryServices.ManagedRunCommandScriptInput", + "azure.mgmt.recoveryservicessiterecovery.models.ManualActionTaskDetails": "Microsoft.RecoveryServices.ManualActionTaskDetails", + "azure.mgmt.recoveryservicessiterecovery.models.MarsAgentDetails": "Microsoft.RecoveryServices.MarsAgentDetails", + "azure.mgmt.recoveryservicessiterecovery.models.MasterTargetServer": "Microsoft.RecoveryServices.MasterTargetServer", + "azure.mgmt.recoveryservicessiterecovery.models.MigrateInput": "Microsoft.RecoveryServices.MigrateInput", + "azure.mgmt.recoveryservicessiterecovery.models.MigrateInputProperties": "Microsoft.RecoveryServices.MigrateInputProperties", + "azure.mgmt.recoveryservicessiterecovery.models.MigrateProviderSpecificInput": "Microsoft.RecoveryServices.MigrateProviderSpecificInput", + "azure.mgmt.recoveryservicessiterecovery.models.MigrationItem": "Microsoft.RecoveryServices.MigrationItem", + "azure.mgmt.recoveryservicessiterecovery.models.MigrationItemProperties": "Microsoft.RecoveryServices.MigrationItemProperties", + "azure.mgmt.recoveryservicessiterecovery.models.MigrationProviderSpecificSettings": "Microsoft.RecoveryServices.MigrationProviderSpecificSettings", + "azure.mgmt.recoveryservicessiterecovery.models.MigrationRecoveryPoint": "Microsoft.RecoveryServices.MigrationRecoveryPoint", + "azure.mgmt.recoveryservicessiterecovery.models.MigrationRecoveryPointProperties": "Microsoft.RecoveryServices.MigrationRecoveryPointProperties", + "azure.mgmt.recoveryservicessiterecovery.models.MobilityServiceUpdate": "Microsoft.RecoveryServices.MobilityServiceUpdate", + "azure.mgmt.recoveryservicessiterecovery.models.Network": "Microsoft.RecoveryServices.Network", + "azure.mgmt.recoveryservicessiterecovery.models.NetworkMapping": "Microsoft.RecoveryServices.NetworkMapping", + "azure.mgmt.recoveryservicessiterecovery.models.NetworkMappingProperties": "Microsoft.RecoveryServices.NetworkMappingProperties", + "azure.mgmt.recoveryservicessiterecovery.models.NetworkProperties": "Microsoft.RecoveryServices.NetworkProperties", + "azure.mgmt.recoveryservicessiterecovery.models.NewProtectionProfile": "Microsoft.RecoveryServices.NewProtectionProfile", + "azure.mgmt.recoveryservicessiterecovery.models.NewRecoveryVirtualNetwork": "Microsoft.RecoveryServices.NewRecoveryVirtualNetwork", + "azure.mgmt.recoveryservicessiterecovery.models.OperationsDiscovery": "Microsoft.RecoveryServices.OperationsDiscovery", + "azure.mgmt.recoveryservicessiterecovery.models.OSDetails": "Microsoft.RecoveryServices.OSDetails", + "azure.mgmt.recoveryservicessiterecovery.models.OSDiskDetails": "Microsoft.RecoveryServices.OSDiskDetails", + "azure.mgmt.recoveryservicessiterecovery.models.OSUpgradeSupportedVersions": "Microsoft.RecoveryServices.OSUpgradeSupportedVersions", + "azure.mgmt.recoveryservicessiterecovery.models.OSVersionWrapper": "Microsoft.RecoveryServices.OSVersionWrapper", + "azure.mgmt.recoveryservicessiterecovery.models.PauseReplicationInput": "Microsoft.RecoveryServices.PauseReplicationInput", + "azure.mgmt.recoveryservicessiterecovery.models.PauseReplicationInputProperties": "Microsoft.RecoveryServices.PauseReplicationInputProperties", + "azure.mgmt.recoveryservicessiterecovery.models.PlannedFailoverInput": "Microsoft.RecoveryServices.PlannedFailoverInput", + "azure.mgmt.recoveryservicessiterecovery.models.PlannedFailoverInputProperties": "Microsoft.RecoveryServices.PlannedFailoverInputProperties", + "azure.mgmt.recoveryservicessiterecovery.models.Policy": "Microsoft.RecoveryServices.Policy", + "azure.mgmt.recoveryservicessiterecovery.models.PolicyProperties": "Microsoft.RecoveryServices.PolicyProperties", + "azure.mgmt.recoveryservicessiterecovery.models.ProcessServer": "Microsoft.RecoveryServices.ProcessServer", + "azure.mgmt.recoveryservicessiterecovery.models.ProcessServerDetails": "Microsoft.RecoveryServices.ProcessServerDetails", + "azure.mgmt.recoveryservicessiterecovery.models.ProtectableItem": "Microsoft.RecoveryServices.ProtectableItem", + "azure.mgmt.recoveryservicessiterecovery.models.ProtectableItemProperties": "Microsoft.RecoveryServices.ProtectableItemProperties", + "azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer": "Microsoft.RecoveryServices.ProtectionContainer", + "azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerFabricSpecificDetails": "Microsoft.RecoveryServices.ProtectionContainerFabricSpecificDetails", + "azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerMapping": "Microsoft.RecoveryServices.ProtectionContainerMapping", + "azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerMappingProperties": "Microsoft.RecoveryServices.ProtectionContainerMappingProperties", + "azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerProperties": "Microsoft.RecoveryServices.ProtectionContainerProperties", + "azure.mgmt.recoveryservicessiterecovery.models.ProviderError": "Microsoft.RecoveryServices.ProviderError", + "azure.mgmt.recoveryservicessiterecovery.models.PushInstallerDetails": "Microsoft.RecoveryServices.PushInstallerDetails", + "azure.mgmt.recoveryservicessiterecovery.models.RcmProxyDetails": "Microsoft.RecoveryServices.RcmProxyDetails", + "azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan": "Microsoft.RecoveryServices.RecoveryPlan", + "azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanProviderSpecificDetails": "Microsoft.RecoveryServices.RecoveryPlanProviderSpecificDetails", + "azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanA2ADetails": "Microsoft.RecoveryServices.RecoveryPlanA2ADetails", + "azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanProviderSpecificFailoverInput": "Microsoft.RecoveryServices.RecoveryPlanProviderSpecificFailoverInput", + "azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanA2AFailoverInput": "Microsoft.RecoveryServices.RecoveryPlanA2AFailoverInput", + "azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanProviderSpecificInput": "Microsoft.RecoveryServices.RecoveryPlanProviderSpecificInput", + "azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanA2AInput": "Microsoft.RecoveryServices.RecoveryPlanA2AInput", + "azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanAction": "Microsoft.RecoveryServices.RecoveryPlanAction", + "azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanActionDetails": "Microsoft.RecoveryServices.RecoveryPlanActionDetails", + "azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanAutomationRunbookActionDetails": "Microsoft.RecoveryServices.RecoveryPlanAutomationRunbookActionDetails", + "azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanGroup": "Microsoft.RecoveryServices.RecoveryPlanGroup", + "azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanGroupTaskDetails": "Microsoft.RecoveryServices.RecoveryPlanGroupTaskDetails", + "azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanHyperVReplicaAzureFailbackInput": "Microsoft.RecoveryServices.RecoveryPlanHyperVReplicaAzureFailbackInput", + "azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanHyperVReplicaAzureFailoverInput": "Microsoft.RecoveryServices.RecoveryPlanHyperVReplicaAzureFailoverInput", + "azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanInMageAzureV2FailoverInput": "Microsoft.RecoveryServices.RecoveryPlanInMageAzureV2FailoverInput", + "azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanInMageFailoverInput": "Microsoft.RecoveryServices.RecoveryPlanInMageFailoverInput", + "azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanInMageRcmFailbackFailoverInput": "Microsoft.RecoveryServices.RecoveryPlanInMageRcmFailbackFailoverInput", + "azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanInMageRcmFailoverInput": "Microsoft.RecoveryServices.RecoveryPlanInMageRcmFailoverInput", + "azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanManualActionDetails": "Microsoft.RecoveryServices.RecoveryPlanManualActionDetails", + "azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanPlannedFailoverInput": "Microsoft.RecoveryServices.RecoveryPlanPlannedFailoverInput", + "azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanPlannedFailoverInputProperties": "Microsoft.RecoveryServices.RecoveryPlanPlannedFailoverInputProperties", + "azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanProperties": "Microsoft.RecoveryServices.RecoveryPlanProperties", + "azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanProtectedItem": "Microsoft.RecoveryServices.RecoveryPlanProtectedItem", + "azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanScriptActionDetails": "Microsoft.RecoveryServices.RecoveryPlanScriptActionDetails", + "azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanShutdownGroupTaskDetails": "Microsoft.RecoveryServices.RecoveryPlanShutdownGroupTaskDetails", + "azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanTestFailoverCleanupInput": "Microsoft.RecoveryServices.RecoveryPlanTestFailoverCleanupInput", + "azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanTestFailoverCleanupInputProperties": "Microsoft.RecoveryServices.RecoveryPlanTestFailoverCleanupInputProperties", + "azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanTestFailoverInput": "Microsoft.RecoveryServices.RecoveryPlanTestFailoverInput", + "azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanTestFailoverInputProperties": "Microsoft.RecoveryServices.RecoveryPlanTestFailoverInputProperties", + "azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanUnplannedFailoverInput": "Microsoft.RecoveryServices.RecoveryPlanUnplannedFailoverInput", + "azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanUnplannedFailoverInputProperties": "Microsoft.RecoveryServices.RecoveryPlanUnplannedFailoverInputProperties", + "azure.mgmt.recoveryservicessiterecovery.models.RecoveryPoint": "Microsoft.RecoveryServices.RecoveryPoint", + "azure.mgmt.recoveryservicessiterecovery.models.RecoveryPointProperties": "Microsoft.RecoveryServices.RecoveryPointProperties", + "azure.mgmt.recoveryservicessiterecovery.models.RecoveryServicesProvider": "Microsoft.RecoveryServices.RecoveryServicesProvider", + "azure.mgmt.recoveryservicessiterecovery.models.RecoveryServicesProviderProperties": "Microsoft.RecoveryServices.RecoveryServicesProviderProperties", + "azure.mgmt.recoveryservicessiterecovery.models.RegisteredClusterNodes": "Microsoft.RecoveryServices.RegisteredClusterNodes", + "azure.mgmt.recoveryservicessiterecovery.models.ReinstallMobilityServiceRequest": "Microsoft.RecoveryServices.ReinstallMobilityServiceRequest", + "azure.mgmt.recoveryservicessiterecovery.models.ReinstallMobilityServiceRequestProperties": "Microsoft.RecoveryServices.ReinstallMobilityServiceRequestProperties", + "azure.mgmt.recoveryservicessiterecovery.models.RemoveDisksInput": "Microsoft.RecoveryServices.RemoveDisksInput", + "azure.mgmt.recoveryservicessiterecovery.models.RemoveDisksInputProperties": "Microsoft.RecoveryServices.RemoveDisksInputProperties", + "azure.mgmt.recoveryservicessiterecovery.models.RemoveProtectionContainerMappingInput": "Microsoft.RecoveryServices.RemoveProtectionContainerMappingInput", + "azure.mgmt.recoveryservicessiterecovery.models.RemoveProtectionContainerMappingInputProperties": "Microsoft.RecoveryServices.RemoveProtectionContainerMappingInputProperties", + "azure.mgmt.recoveryservicessiterecovery.models.RenewCertificateInput": "Microsoft.RecoveryServices.RenewCertificateInput", + "azure.mgmt.recoveryservicessiterecovery.models.RenewCertificateInputProperties": "Microsoft.RecoveryServices.RenewCertificateInputProperties", + "azure.mgmt.recoveryservicessiterecovery.models.ReplicationAgentDetails": "Microsoft.RecoveryServices.ReplicationAgentDetails", + "azure.mgmt.recoveryservicessiterecovery.models.ReplicationAppliance": "Microsoft.RecoveryServices.ReplicationAppliance", + "azure.mgmt.recoveryservicessiterecovery.models.ReplicationApplianceProperties": "Microsoft.RecoveryServices.ReplicationApplianceProperties", + "azure.mgmt.recoveryservicessiterecovery.models.ReplicationEligibilityResults": "Microsoft.RecoveryServices.ReplicationEligibilityResults", + "azure.mgmt.recoveryservicessiterecovery.models.ReplicationEligibilityResultsCollection": "Microsoft.RecoveryServices.ReplicationEligibilityResultsCollection", + "azure.mgmt.recoveryservicessiterecovery.models.ReplicationEligibilityResultsErrorInfo": "Microsoft.RecoveryServices.ReplicationEligibilityResultsErrorInfo", + "azure.mgmt.recoveryservicessiterecovery.models.ReplicationEligibilityResultsProperties": "Microsoft.RecoveryServices.ReplicationEligibilityResultsProperties", + "azure.mgmt.recoveryservicessiterecovery.models.ReplicationGroupDetails": "Microsoft.RecoveryServices.ReplicationGroupDetails", + "azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem": "Microsoft.RecoveryServices.ReplicationProtectedItem", + "azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItemProperties": "Microsoft.RecoveryServices.ReplicationProtectedItemProperties", + "azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster": "Microsoft.RecoveryServices.ReplicationProtectionCluster", + "azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionClusterProperties": "Microsoft.RecoveryServices.ReplicationProtectionClusterProperties", + "azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionIntent": "Microsoft.RecoveryServices.ReplicationProtectionIntent", + "azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionIntentProperties": "Microsoft.RecoveryServices.ReplicationProtectionIntentProperties", + "azure.mgmt.recoveryservicessiterecovery.models.ReplicationProviderContainerUnmappingInput": "Microsoft.RecoveryServices.ReplicationProviderContainerUnmappingInput", + "azure.mgmt.recoveryservicessiterecovery.models.ReprotectAgentDetails": "Microsoft.RecoveryServices.ReprotectAgentDetails", + "azure.mgmt.recoveryservicessiterecovery.models.ResolveHealthError": "Microsoft.RecoveryServices.ResolveHealthError", + "azure.mgmt.recoveryservicessiterecovery.models.ResolveHealthInput": "Microsoft.RecoveryServices.ResolveHealthInput", + "azure.mgmt.recoveryservicessiterecovery.models.ResolveHealthInputProperties": "Microsoft.RecoveryServices.ResolveHealthInputProperties", + "azure.mgmt.recoveryservicessiterecovery.models.ResourceHealthSummary": "Microsoft.RecoveryServices.ResourceHealthSummary", + "azure.mgmt.recoveryservicessiterecovery.models.ResumeJobParams": "Microsoft.RecoveryServices.ResumeJobParams", + "azure.mgmt.recoveryservicessiterecovery.models.ResumeJobParamsProperties": "Microsoft.RecoveryServices.ResumeJobParamsProperties", + "azure.mgmt.recoveryservicessiterecovery.models.ResumeReplicationInput": "Microsoft.RecoveryServices.ResumeReplicationInput", + "azure.mgmt.recoveryservicessiterecovery.models.ResumeReplicationInputProperties": "Microsoft.RecoveryServices.ResumeReplicationInputProperties", + "azure.mgmt.recoveryservicessiterecovery.models.ResumeReplicationProviderSpecificInput": "Microsoft.RecoveryServices.ResumeReplicationProviderSpecificInput", + "azure.mgmt.recoveryservicessiterecovery.models.ResyncInput": "Microsoft.RecoveryServices.ResyncInput", + "azure.mgmt.recoveryservicessiterecovery.models.ResyncInputProperties": "Microsoft.RecoveryServices.ResyncInputProperties", + "azure.mgmt.recoveryservicessiterecovery.models.ResyncProviderSpecificInput": "Microsoft.RecoveryServices.ResyncProviderSpecificInput", + "azure.mgmt.recoveryservicessiterecovery.models.RetentionVolume": "Microsoft.RecoveryServices.RetentionVolume", + "azure.mgmt.recoveryservicessiterecovery.models.ReverseReplicationInput": "Microsoft.RecoveryServices.ReverseReplicationInput", + "azure.mgmt.recoveryservicessiterecovery.models.ReverseReplicationInputProperties": "Microsoft.RecoveryServices.ReverseReplicationInputProperties", + "azure.mgmt.recoveryservicessiterecovery.models.RunAsAccount": "Microsoft.RecoveryServices.RunAsAccount", + "azure.mgmt.recoveryservicessiterecovery.models.ScriptActionTaskDetails": "Microsoft.RecoveryServices.ScriptActionTaskDetails", + "azure.mgmt.recoveryservicessiterecovery.models.SecurityProfileProperties": "Microsoft.RecoveryServices.SecurityProfileProperties", + "azure.mgmt.recoveryservicessiterecovery.models.ServiceError": "Microsoft.RecoveryServices.ServiceError", + "azure.mgmt.recoveryservicessiterecovery.models.SharedDiskReplicationItemProperties": "Microsoft.RecoveryServices.SharedDiskReplicationItemProperties", + "azure.mgmt.recoveryservicessiterecovery.models.StorageClassification": "Microsoft.RecoveryServices.StorageClassification", + "azure.mgmt.recoveryservicessiterecovery.models.StorageClassificationMapping": "Microsoft.RecoveryServices.StorageClassificationMapping", + "azure.mgmt.recoveryservicessiterecovery.models.StorageClassificationMappingInput": "Microsoft.RecoveryServices.StorageClassificationMappingInput", + "azure.mgmt.recoveryservicessiterecovery.models.StorageClassificationMappingProperties": "Microsoft.RecoveryServices.StorageClassificationMappingProperties", + "azure.mgmt.recoveryservicessiterecovery.models.StorageClassificationProperties": "Microsoft.RecoveryServices.StorageClassificationProperties", + "azure.mgmt.recoveryservicessiterecovery.models.StorageMappingInputProperties": "Microsoft.RecoveryServices.StorageMappingInputProperties", + "azure.mgmt.recoveryservicessiterecovery.models.Subnet": "Microsoft.RecoveryServices.Subnet", + "azure.mgmt.recoveryservicessiterecovery.models.SupportedOperatingSystems": "Microsoft.RecoveryServices.SupportedOperatingSystems", + "azure.mgmt.recoveryservicessiterecovery.models.SupportedOSDetails": "Microsoft.RecoveryServices.SupportedOSDetails", + "azure.mgmt.recoveryservicessiterecovery.models.SupportedOSProperties": "Microsoft.RecoveryServices.SupportedOSProperties", + "azure.mgmt.recoveryservicessiterecovery.models.SupportedOSProperty": "Microsoft.RecoveryServices.SupportedOSProperty", + "azure.mgmt.recoveryservicessiterecovery.models.SwitchClusterProtectionInput": "Microsoft.RecoveryServices.SwitchClusterProtectionInput", + "azure.mgmt.recoveryservicessiterecovery.models.SwitchClusterProtectionInputProperties": "Microsoft.RecoveryServices.SwitchClusterProtectionInputProperties", + "azure.mgmt.recoveryservicessiterecovery.models.SwitchProtectionInput": "Microsoft.RecoveryServices.SwitchProtectionInput", + "azure.mgmt.recoveryservicessiterecovery.models.SwitchProtectionInputProperties": "Microsoft.RecoveryServices.SwitchProtectionInputProperties", + "azure.mgmt.recoveryservicessiterecovery.models.SwitchProtectionJobDetails": "Microsoft.RecoveryServices.SwitchProtectionJobDetails", + "azure.mgmt.recoveryservicessiterecovery.models.SwitchProviderInput": "Microsoft.RecoveryServices.SwitchProviderInput", + "azure.mgmt.recoveryservicessiterecovery.models.SwitchProviderInputProperties": "Microsoft.RecoveryServices.SwitchProviderInputProperties", + "azure.mgmt.recoveryservicessiterecovery.models.SystemData": "Azure.ResourceManager.CommonTypes.SystemData", + "azure.mgmt.recoveryservicessiterecovery.models.TargetComputeSize": "Microsoft.RecoveryServices.TargetComputeSize", + "azure.mgmt.recoveryservicessiterecovery.models.TargetComputeSizeProperties": "Microsoft.RecoveryServices.TargetComputeSizeProperties", + "azure.mgmt.recoveryservicessiterecovery.models.TestFailoverCleanupInput": "Microsoft.RecoveryServices.TestFailoverCleanupInput", + "azure.mgmt.recoveryservicessiterecovery.models.TestFailoverCleanupInputProperties": "Microsoft.RecoveryServices.TestFailoverCleanupInputProperties", + "azure.mgmt.recoveryservicessiterecovery.models.TestFailoverInput": "Microsoft.RecoveryServices.TestFailoverInput", + "azure.mgmt.recoveryservicessiterecovery.models.TestFailoverInputProperties": "Microsoft.RecoveryServices.TestFailoverInputProperties", + "azure.mgmt.recoveryservicessiterecovery.models.TestFailoverJobDetails": "Microsoft.RecoveryServices.TestFailoverJobDetails", + "azure.mgmt.recoveryservicessiterecovery.models.TestMigrateCleanupInput": "Microsoft.RecoveryServices.TestMigrateCleanupInput", + "azure.mgmt.recoveryservicessiterecovery.models.TestMigrateCleanupInputProperties": "Microsoft.RecoveryServices.TestMigrateCleanupInputProperties", + "azure.mgmt.recoveryservicessiterecovery.models.TestMigrateInput": "Microsoft.RecoveryServices.TestMigrateInput", + "azure.mgmt.recoveryservicessiterecovery.models.TestMigrateInputProperties": "Microsoft.RecoveryServices.TestMigrateInputProperties", + "azure.mgmt.recoveryservicessiterecovery.models.TestMigrateProviderSpecificInput": "Microsoft.RecoveryServices.TestMigrateProviderSpecificInput", + "azure.mgmt.recoveryservicessiterecovery.models.UnplannedFailoverInput": "Microsoft.RecoveryServices.UnplannedFailoverInput", + "azure.mgmt.recoveryservicessiterecovery.models.UnplannedFailoverInputProperties": "Microsoft.RecoveryServices.UnplannedFailoverInputProperties", + "azure.mgmt.recoveryservicessiterecovery.models.UpdateApplianceForReplicationProtectedItemInput": "Microsoft.RecoveryServices.UpdateApplianceForReplicationProtectedItemInput", + "azure.mgmt.recoveryservicessiterecovery.models.UpdateApplianceForReplicationProtectedItemInputProperties": "Microsoft.RecoveryServices.UpdateApplianceForReplicationProtectedItemInputProperties", + "azure.mgmt.recoveryservicessiterecovery.models.UpdateDiskInput": "Microsoft.RecoveryServices.UpdateDiskInput", + "azure.mgmt.recoveryservicessiterecovery.models.UpdateMigrationItemInput": "Microsoft.RecoveryServices.UpdateMigrationItemInput", + "azure.mgmt.recoveryservicessiterecovery.models.UpdateMigrationItemInputProperties": "Microsoft.RecoveryServices.UpdateMigrationItemInputProperties", + "azure.mgmt.recoveryservicessiterecovery.models.UpdateMigrationItemProviderSpecificInput": "Microsoft.RecoveryServices.UpdateMigrationItemProviderSpecificInput", + "azure.mgmt.recoveryservicessiterecovery.models.UpdateMobilityServiceRequest": "Microsoft.RecoveryServices.UpdateMobilityServiceRequest", + "azure.mgmt.recoveryservicessiterecovery.models.UpdateMobilityServiceRequestProperties": "Microsoft.RecoveryServices.UpdateMobilityServiceRequestProperties", + "azure.mgmt.recoveryservicessiterecovery.models.UpdateNetworkMappingInput": "Microsoft.RecoveryServices.UpdateNetworkMappingInput", + "azure.mgmt.recoveryservicessiterecovery.models.UpdateNetworkMappingInputProperties": "Microsoft.RecoveryServices.UpdateNetworkMappingInputProperties", + "azure.mgmt.recoveryservicessiterecovery.models.UpdatePolicyInput": "Microsoft.RecoveryServices.UpdatePolicyInput", + "azure.mgmt.recoveryservicessiterecovery.models.UpdatePolicyInputProperties": "Microsoft.RecoveryServices.UpdatePolicyInputProperties", + "azure.mgmt.recoveryservicessiterecovery.models.UpdateProtectionContainerMappingInput": "Microsoft.RecoveryServices.UpdateProtectionContainerMappingInput", + "azure.mgmt.recoveryservicessiterecovery.models.UpdateProtectionContainerMappingInputProperties": "Microsoft.RecoveryServices.UpdateProtectionContainerMappingInputProperties", + "azure.mgmt.recoveryservicessiterecovery.models.UpdateRecoveryPlanInput": "Microsoft.RecoveryServices.UpdateRecoveryPlanInput", + "azure.mgmt.recoveryservicessiterecovery.models.UpdateRecoveryPlanInputProperties": "Microsoft.RecoveryServices.UpdateRecoveryPlanInputProperties", + "azure.mgmt.recoveryservicessiterecovery.models.UpdateReplicationProtectedItemInput": "Microsoft.RecoveryServices.UpdateReplicationProtectedItemInput", + "azure.mgmt.recoveryservicessiterecovery.models.UpdateReplicationProtectedItemInputProperties": "Microsoft.RecoveryServices.UpdateReplicationProtectedItemInputProperties", + "azure.mgmt.recoveryservicessiterecovery.models.UpdateVCenterRequest": "Microsoft.RecoveryServices.UpdateVCenterRequest", + "azure.mgmt.recoveryservicessiterecovery.models.UpdateVCenterRequestProperties": "Microsoft.RecoveryServices.UpdateVCenterRequestProperties", + "azure.mgmt.recoveryservicessiterecovery.models.UserCreatedResourceTag": "Microsoft.RecoveryServices.UserCreatedResourceTag", + "azure.mgmt.recoveryservicessiterecovery.models.VaultHealthDetails": "Microsoft.RecoveryServices.VaultHealthDetails", + "azure.mgmt.recoveryservicessiterecovery.models.VaultHealthProperties": "Microsoft.RecoveryServices.VaultHealthProperties", + "azure.mgmt.recoveryservicessiterecovery.models.VaultSetting": "Microsoft.RecoveryServices.VaultSetting", + "azure.mgmt.recoveryservicessiterecovery.models.VaultSettingCreationInput": "Microsoft.RecoveryServices.VaultSettingCreationInput", + "azure.mgmt.recoveryservicessiterecovery.models.VaultSettingCreationInputProperties": "Microsoft.RecoveryServices.VaultSettingCreationInputProperties", + "azure.mgmt.recoveryservicessiterecovery.models.VaultSettingProperties": "Microsoft.RecoveryServices.VaultSettingProperties", + "azure.mgmt.recoveryservicessiterecovery.models.VCenter": "Microsoft.RecoveryServices.VCenter", + "azure.mgmt.recoveryservicessiterecovery.models.VCenterProperties": "Microsoft.RecoveryServices.VCenterProperties", + "azure.mgmt.recoveryservicessiterecovery.models.VersionDetails": "Microsoft.RecoveryServices.VersionDetails", + "azure.mgmt.recoveryservicessiterecovery.models.VirtualMachineTaskDetails": "Microsoft.RecoveryServices.VirtualMachineTaskDetails", + "azure.mgmt.recoveryservicessiterecovery.models.VmmDetails": "Microsoft.RecoveryServices.VmmDetails", + "azure.mgmt.recoveryservicessiterecovery.models.VmmToAzureCreateNetworkMappingInput": "Microsoft.RecoveryServices.VmmToAzureCreateNetworkMappingInput", + "azure.mgmt.recoveryservicessiterecovery.models.VmmToAzureNetworkMappingSettings": "Microsoft.RecoveryServices.VmmToAzureNetworkMappingSettings", + "azure.mgmt.recoveryservicessiterecovery.models.VmmToAzureUpdateNetworkMappingInput": "Microsoft.RecoveryServices.VmmToAzureUpdateNetworkMappingInput", + "azure.mgmt.recoveryservicessiterecovery.models.VmmToVmmCreateNetworkMappingInput": "Microsoft.RecoveryServices.VmmToVmmCreateNetworkMappingInput", + "azure.mgmt.recoveryservicessiterecovery.models.VmmToVmmNetworkMappingSettings": "Microsoft.RecoveryServices.VmmToVmmNetworkMappingSettings", + "azure.mgmt.recoveryservicessiterecovery.models.VmmToVmmUpdateNetworkMappingInput": "Microsoft.RecoveryServices.VmmToVmmUpdateNetworkMappingInput", + "azure.mgmt.recoveryservicessiterecovery.models.VmmVirtualMachineDetails": "Microsoft.RecoveryServices.VmmVirtualMachineDetails", + "azure.mgmt.recoveryservicessiterecovery.models.VMNicDetails": "Microsoft.RecoveryServices.VMNicDetails", + "azure.mgmt.recoveryservicessiterecovery.models.VMNicInputDetails": "Microsoft.RecoveryServices.VMNicInputDetails", + "azure.mgmt.recoveryservicessiterecovery.models.VmNicUpdatesTaskDetails": "Microsoft.RecoveryServices.VmNicUpdatesTaskDetails", + "azure.mgmt.recoveryservicessiterecovery.models.VMwareCbtContainerCreationInput": "Microsoft.RecoveryServices.VMwareCbtContainerCreationInput", + "azure.mgmt.recoveryservicessiterecovery.models.VMwareCbtContainerMappingInput": "Microsoft.RecoveryServices.VMwareCbtContainerMappingInput", + "azure.mgmt.recoveryservicessiterecovery.models.VMwareCbtDiskInput": "Microsoft.RecoveryServices.VMwareCbtDiskInput", + "azure.mgmt.recoveryservicessiterecovery.models.VMwareCbtEnableMigrationInput": "Microsoft.RecoveryServices.VMwareCbtEnableMigrationInput", + "azure.mgmt.recoveryservicessiterecovery.models.VMwareCbtEventDetails": "Microsoft.RecoveryServices.VMwareCbtEventDetails", + "azure.mgmt.recoveryservicessiterecovery.models.VMwareCbtMigrateInput": "Microsoft.RecoveryServices.VMwareCbtMigrateInput", + "azure.mgmt.recoveryservicessiterecovery.models.VMwareCbtMigrationDetails": "Microsoft.RecoveryServices.VMwareCbtMigrationDetails", + "azure.mgmt.recoveryservicessiterecovery.models.VMwareCbtNicDetails": "Microsoft.RecoveryServices.VMwareCbtNicDetails", + "azure.mgmt.recoveryservicessiterecovery.models.VMwareCbtNicInput": "Microsoft.RecoveryServices.VMwareCbtNicInput", + "azure.mgmt.recoveryservicessiterecovery.models.VMwareCbtPolicyCreationInput": "Microsoft.RecoveryServices.VMwareCbtPolicyCreationInput", + "azure.mgmt.recoveryservicessiterecovery.models.VmwareCbtPolicyDetails": "Microsoft.RecoveryServices.VmwareCbtPolicyDetails", + "azure.mgmt.recoveryservicessiterecovery.models.VMwareCbtProtectedDiskDetails": "Microsoft.RecoveryServices.VMwareCbtProtectedDiskDetails", + "azure.mgmt.recoveryservicessiterecovery.models.VMwareCbtProtectionContainerMappingDetails": "Microsoft.RecoveryServices.VMwareCbtProtectionContainerMappingDetails", + "azure.mgmt.recoveryservicessiterecovery.models.VMwareCbtResumeReplicationInput": "Microsoft.RecoveryServices.VMwareCbtResumeReplicationInput", + "azure.mgmt.recoveryservicessiterecovery.models.VMwareCbtResyncInput": "Microsoft.RecoveryServices.VMwareCbtResyncInput", + "azure.mgmt.recoveryservicessiterecovery.models.VMwareCbtSecurityProfileProperties": "Microsoft.RecoveryServices.VMwareCbtSecurityProfileProperties", + "azure.mgmt.recoveryservicessiterecovery.models.VMwareCbtTestMigrateInput": "Microsoft.RecoveryServices.VMwareCbtTestMigrateInput", + "azure.mgmt.recoveryservicessiterecovery.models.VMwareCbtUpdateDiskInput": "Microsoft.RecoveryServices.VMwareCbtUpdateDiskInput", + "azure.mgmt.recoveryservicessiterecovery.models.VMwareCbtUpdateMigrationItemInput": "Microsoft.RecoveryServices.VMwareCbtUpdateMigrationItemInput", + "azure.mgmt.recoveryservicessiterecovery.models.VMwareDetails": "Microsoft.RecoveryServices.VMwareDetails", + "azure.mgmt.recoveryservicessiterecovery.models.VMwareV2FabricCreationInput": "Microsoft.RecoveryServices.VMwareV2FabricCreationInput", + "azure.mgmt.recoveryservicessiterecovery.models.VMwareV2FabricSpecificDetails": "Microsoft.RecoveryServices.VMwareV2FabricSpecificDetails", + "azure.mgmt.recoveryservicessiterecovery.models.VMwareVirtualMachineDetails": "Microsoft.RecoveryServices.VMwareVirtualMachineDetails", + "azure.mgmt.recoveryservicessiterecovery.models.CreatedByType": "Azure.ResourceManager.CommonTypes.createdByType", + "azure.mgmt.recoveryservicessiterecovery.models.MigrationRecoveryPointType": "Microsoft.RecoveryServices.MigrationRecoveryPointType", + "azure.mgmt.recoveryservicessiterecovery.models.HealthErrorCustomerResolvability": "Microsoft.RecoveryServices.HealthErrorCustomerResolvability", + "azure.mgmt.recoveryservicessiterecovery.models.ExtendedLocationType": "Microsoft.RecoveryServices.ExtendedLocationType", + "azure.mgmt.recoveryservicessiterecovery.models.MultiVmGroupCreateOption": "Microsoft.RecoveryServices.MultiVmGroupCreateOption", + "azure.mgmt.recoveryservicessiterecovery.models.AutoProtectionOfDataDisk": "Microsoft.RecoveryServices.AutoProtectionOfDataDisk", + "azure.mgmt.recoveryservicessiterecovery.models.VmEncryptionType": "Microsoft.RecoveryServices.VmEncryptionType", + "azure.mgmt.recoveryservicessiterecovery.models.ChurnOptionSelected": "Microsoft.RecoveryServices.ChurnOptionSelected", + "azure.mgmt.recoveryservicessiterecovery.models.LinuxLicenseType": "Microsoft.RecoveryServices.LinuxLicenseType", + "azure.mgmt.recoveryservicessiterecovery.models.DiskAccountType": "Microsoft.RecoveryServices.DiskAccountType", + "azure.mgmt.recoveryservicessiterecovery.models.SecurityType": "Microsoft.RecoveryServices.SecurityType", + "azure.mgmt.recoveryservicessiterecovery.models.SecurityConfiguration": "Microsoft.RecoveryServices.SecurityConfiguration", + "azure.mgmt.recoveryservicessiterecovery.models.VmReplicationProgressHealth": "Microsoft.RecoveryServices.VmReplicationProgressHealth", + "azure.mgmt.recoveryservicessiterecovery.models.ResyncState": "Microsoft.RecoveryServices.ResyncState", + "azure.mgmt.recoveryservicessiterecovery.models.MobilityAgentUpgradeState": "Microsoft.RecoveryServices.MobilityAgentUpgradeState", + "azure.mgmt.recoveryservicessiterecovery.models.DiskState": "Microsoft.RecoveryServices.DiskState", + "azure.mgmt.recoveryservicessiterecovery.models.DiskReplicationProgressHealth": "Microsoft.RecoveryServices.DiskReplicationProgressHealth", + "azure.mgmt.recoveryservicessiterecovery.models.AgentUpgradeBlockedReason": "Microsoft.RecoveryServices.AgentUpgradeBlockedReason", + "azure.mgmt.recoveryservicessiterecovery.models.MobilityAgentReinstallType": "Microsoft.RecoveryServices.MobilityAgentReinstallType", + "azure.mgmt.recoveryservicessiterecovery.models.AgentReinstallBlockedReason": "Microsoft.RecoveryServices.AgentReinstallBlockedReason", + "azure.mgmt.recoveryservicessiterecovery.models.EthernetAddressType": "Microsoft.RecoveryServices.EthernetAddressType", + "azure.mgmt.recoveryservicessiterecovery.models.PlannedFailoverStatus": "Microsoft.RecoveryServices.PlannedFailoverStatus", + "azure.mgmt.recoveryservicessiterecovery.models.LicenseType": "Microsoft.RecoveryServices.LicenseType", + "azure.mgmt.recoveryservicessiterecovery.models.SqlServerLicenseType": "Microsoft.RecoveryServices.SqlServerLicenseType", + "azure.mgmt.recoveryservicessiterecovery.models.InMageRcmFailbackRecoveryPointType": "Microsoft.RecoveryServices.InMageRcmFailbackRecoveryPointType", + "azure.mgmt.recoveryservicessiterecovery.models.DisableProtectionReason": "Microsoft.RecoveryServices.DisableProtectionReason", + "azure.mgmt.recoveryservicessiterecovery.models.RecoveryPointType": "Microsoft.RecoveryServices.RecoveryPointType", + "azure.mgmt.recoveryservicessiterecovery.models.RecoveryPointSyncType": "Microsoft.RecoveryServices.RecoveryPointSyncType", + "azure.mgmt.recoveryservicessiterecovery.models.FailoverDirection": "Microsoft.RecoveryServices.FailoverDirection", + "azure.mgmt.recoveryservicessiterecovery.models.ClusterRecoveryPointType": "Microsoft.RecoveryServices.ClusterRecoveryPointType", + "azure.mgmt.recoveryservicessiterecovery.models.SetMultiVmSyncStatus": "Microsoft.RecoveryServices.SetMultiVmSyncStatus", + "azure.mgmt.recoveryservicessiterecovery.models.AgentAutoUpdateStatus": "Microsoft.RecoveryServices.AgentAutoUpdateStatus", + "azure.mgmt.recoveryservicessiterecovery.models.AutomationAccountAuthenticationType": "Microsoft.RecoveryServices.AutomationAccountAuthenticationType", + "azure.mgmt.recoveryservicessiterecovery.models.A2ARecoveryAvailabilityType": "Microsoft.RecoveryServices.A2ARecoveryAvailabilityType", + "azure.mgmt.recoveryservicessiterecovery.models.RcmComponentStatus": "Microsoft.RecoveryServices.RcmComponentStatus", + "azure.mgmt.recoveryservicessiterecovery.models.ProtectionHealth": "Microsoft.RecoveryServices.ProtectionHealth", + "azure.mgmt.recoveryservicessiterecovery.models.AgentVersionStatus": "Microsoft.RecoveryServices.AgentVersionStatus", + "azure.mgmt.recoveryservicessiterecovery.models.MigrationState": "Microsoft.RecoveryServices.MigrationState", + "azure.mgmt.recoveryservicessiterecovery.models.TestMigrationState": "Microsoft.RecoveryServices.TestMigrationState", + "azure.mgmt.recoveryservicessiterecovery.models.MigrationItemOperation": "Microsoft.RecoveryServices.MigrationItemOperation", + "azure.mgmt.recoveryservicessiterecovery.models.PresenceStatus": "Microsoft.RecoveryServices.PresenceStatus", + "azure.mgmt.recoveryservicessiterecovery.models.ExportJobOutputSerializationType": "Microsoft.RecoveryServices.ExportJobOutputSerializationType", + "azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanGroupType": "Microsoft.RecoveryServices.RecoveryPlanGroupType", + "azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItemOperation": "Microsoft.RecoveryServices.ReplicationProtectedItemOperation", + "azure.mgmt.recoveryservicessiterecovery.models.PossibleOperationsDirections": "Microsoft.RecoveryServices.PossibleOperationsDirections", + "azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanActionLocation": "Microsoft.RecoveryServices.RecoveryPlanActionLocation", + "azure.mgmt.recoveryservicessiterecovery.models.FailoverDeploymentModel": "Microsoft.RecoveryServices.FailoverDeploymentModel", + "azure.mgmt.recoveryservicessiterecovery.models.A2ARpRecoveryPointType": "Microsoft.RecoveryServices.A2ARpRecoveryPointType", + "azure.mgmt.recoveryservicessiterecovery.models.MultiVmSyncPointOption": "Microsoft.RecoveryServices.MultiVmSyncPointOption", + "azure.mgmt.recoveryservicessiterecovery.models.HyperVReplicaAzureRpRecoveryPointType": "Microsoft.RecoveryServices.HyperVReplicaAzureRpRecoveryPointType", + "azure.mgmt.recoveryservicessiterecovery.models.DataSyncStatus": "Microsoft.RecoveryServices.DataSyncStatus", + "azure.mgmt.recoveryservicessiterecovery.models.AlternateLocationRecoveryOption": "Microsoft.RecoveryServices.AlternateLocationRecoveryOption", + "azure.mgmt.recoveryservicessiterecovery.models.RpInMageRecoveryPointType": "Microsoft.RecoveryServices.RpInMageRecoveryPointType", + "azure.mgmt.recoveryservicessiterecovery.models.InMageV2RpRecoveryPointType": "Microsoft.RecoveryServices.InMageV2RpRecoveryPointType", + "azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanPointType": "Microsoft.RecoveryServices.RecoveryPlanPointType", + "azure.mgmt.recoveryservicessiterecovery.models.SourceSiteOperations": "Microsoft.RecoveryServices.SourceSiteOperations", + "azure.mgmt.recoveryservicessiterecovery.models.HealthErrorCategory": "Microsoft.RecoveryServices.HealthErrorCategory", + "azure.mgmt.recoveryservicessiterecovery.models.Severity": "Microsoft.RecoveryServices.Severity", + "azure.mgmt.recoveryservicessiterecovery.operations.MigrationRecoveryPointsOperations.get": "Microsoft.RecoveryServices.MigrationRecoveryPoints.get", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.MigrationRecoveryPointsOperations.get": "Microsoft.RecoveryServices.MigrationRecoveryPoints.get", + "azure.mgmt.recoveryservicessiterecovery.operations.MigrationRecoveryPointsOperations.list_by_replication_migration_items": "Microsoft.RecoveryServices.MigrationRecoveryPoints.listByReplicationMigrationItems", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.MigrationRecoveryPointsOperations.list_by_replication_migration_items": "Microsoft.RecoveryServices.MigrationRecoveryPoints.listByReplicationMigrationItems", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationProtectedItemsOperations.get": "Microsoft.RecoveryServices.ReplicationProtectedItems.get", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationProtectedItemsOperations.get": "Microsoft.RecoveryServices.ReplicationProtectedItems.get", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationProtectedItemsOperations.begin_create": "Microsoft.RecoveryServices.ReplicationProtectedItems.create", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationProtectedItemsOperations.begin_create": "Microsoft.RecoveryServices.ReplicationProtectedItems.create", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationProtectedItemsOperations.begin_update": "Microsoft.RecoveryServices.ReplicationProtectedItems.update", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationProtectedItemsOperations.begin_update": "Microsoft.RecoveryServices.ReplicationProtectedItems.update", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationProtectedItemsOperations.begin_purge": "Microsoft.RecoveryServices.ReplicationProtectedItems.purge", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationProtectedItemsOperations.begin_purge": "Microsoft.RecoveryServices.ReplicationProtectedItems.purge", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationProtectedItemsOperations.list_by_replication_protection_containers": "Microsoft.RecoveryServices.ReplicationProtectedItems.listByReplicationProtectionContainers", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationProtectedItemsOperations.list_by_replication_protection_containers": "Microsoft.RecoveryServices.ReplicationProtectedItems.listByReplicationProtectionContainers", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationProtectedItemsOperations.begin_add_disks": "Microsoft.RecoveryServices.ReplicationProtectedItems.addDisks", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationProtectedItemsOperations.begin_add_disks": "Microsoft.RecoveryServices.ReplicationProtectedItems.addDisks", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationProtectedItemsOperations.begin_apply_recovery_point": "Microsoft.RecoveryServices.ReplicationProtectedItems.applyRecoveryPoint", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationProtectedItemsOperations.begin_apply_recovery_point": "Microsoft.RecoveryServices.ReplicationProtectedItems.applyRecoveryPoint", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationProtectedItemsOperations.begin_failover_cancel": "Microsoft.RecoveryServices.ReplicationProtectedItems.failoverCancel", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationProtectedItemsOperations.begin_failover_cancel": "Microsoft.RecoveryServices.ReplicationProtectedItems.failoverCancel", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationProtectedItemsOperations.begin_failover_commit": "Microsoft.RecoveryServices.ReplicationProtectedItems.failoverCommit", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationProtectedItemsOperations.begin_failover_commit": "Microsoft.RecoveryServices.ReplicationProtectedItems.failoverCommit", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationProtectedItemsOperations.begin_planned_failover": "Microsoft.RecoveryServices.ReplicationProtectedItems.plannedFailover", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationProtectedItemsOperations.begin_planned_failover": "Microsoft.RecoveryServices.ReplicationProtectedItems.plannedFailover", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationProtectedItemsOperations.begin_delete": "Microsoft.RecoveryServices.ReplicationProtectedItems.delete", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationProtectedItemsOperations.begin_delete": "Microsoft.RecoveryServices.ReplicationProtectedItems.delete", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationProtectedItemsOperations.begin_remove_disks": "Microsoft.RecoveryServices.ReplicationProtectedItems.removeDisks", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationProtectedItemsOperations.begin_remove_disks": "Microsoft.RecoveryServices.ReplicationProtectedItems.removeDisks", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationProtectedItemsOperations.begin_repair_replication": "Microsoft.RecoveryServices.ReplicationProtectedItems.repairReplication", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationProtectedItemsOperations.begin_repair_replication": "Microsoft.RecoveryServices.ReplicationProtectedItems.repairReplication", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationProtectedItemsOperations.begin_reprotect": "Microsoft.RecoveryServices.ReplicationProtectedItems.reprotect", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationProtectedItemsOperations.begin_reprotect": "Microsoft.RecoveryServices.ReplicationProtectedItems.reprotect", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationProtectedItemsOperations.begin_resolve_health_errors": "Microsoft.RecoveryServices.ReplicationProtectedItems.resolveHealthErrors", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationProtectedItemsOperations.begin_resolve_health_errors": "Microsoft.RecoveryServices.ReplicationProtectedItems.resolveHealthErrors", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationProtectedItemsOperations.begin_switch_provider": "Microsoft.RecoveryServices.ReplicationProtectedItems.switchProvider", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationProtectedItemsOperations.begin_switch_provider": "Microsoft.RecoveryServices.ReplicationProtectedItems.switchProvider", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationProtectedItemsOperations.begin_test_failover": "Microsoft.RecoveryServices.ReplicationProtectedItems.testFailover", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationProtectedItemsOperations.begin_test_failover": "Microsoft.RecoveryServices.ReplicationProtectedItems.testFailover", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationProtectedItemsOperations.begin_test_failover_cleanup": "Microsoft.RecoveryServices.ReplicationProtectedItems.testFailoverCleanup", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationProtectedItemsOperations.begin_test_failover_cleanup": "Microsoft.RecoveryServices.ReplicationProtectedItems.testFailoverCleanup", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationProtectedItemsOperations.begin_unplanned_failover": "Microsoft.RecoveryServices.ReplicationProtectedItems.unplannedFailover", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationProtectedItemsOperations.begin_unplanned_failover": "Microsoft.RecoveryServices.ReplicationProtectedItems.unplannedFailover", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationProtectedItemsOperations.begin_update_appliance": "Microsoft.RecoveryServices.ReplicationProtectedItems.updateAppliance", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationProtectedItemsOperations.begin_update_appliance": "Microsoft.RecoveryServices.ReplicationProtectedItems.updateAppliance", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationProtectedItemsOperations.begin_update_mobility_service": "Microsoft.RecoveryServices.ReplicationProtectedItems.updateMobilityService", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationProtectedItemsOperations.begin_update_mobility_service": "Microsoft.RecoveryServices.ReplicationProtectedItems.updateMobilityService", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationProtectedItemsOperations.begin_reinstall_mobility_service": "Microsoft.RecoveryServices.ReplicationProtectedItems.reinstallMobilityService", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationProtectedItemsOperations.begin_reinstall_mobility_service": "Microsoft.RecoveryServices.ReplicationProtectedItems.reinstallMobilityService", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationProtectedItemsOperations.list": "Microsoft.RecoveryServices.ReplicationProtectedItemsOperationGroup.list", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationProtectedItemsOperations.list": "Microsoft.RecoveryServices.ReplicationProtectedItemsOperationGroup.list", + "azure.mgmt.recoveryservicessiterecovery.operations.TargetComputeSizesOperations.list_by_replication_protected_items": "Microsoft.RecoveryServices.TargetComputeSizes.listByReplicationProtectedItems", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.TargetComputeSizesOperations.list_by_replication_protected_items": "Microsoft.RecoveryServices.TargetComputeSizes.listByReplicationProtectedItems", + "azure.mgmt.recoveryservicessiterecovery.operations.RecoveryPointsOperations.get": "Microsoft.RecoveryServices.RecoveryPoints.get", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.RecoveryPointsOperations.get": "Microsoft.RecoveryServices.RecoveryPoints.get", + "azure.mgmt.recoveryservicessiterecovery.operations.RecoveryPointsOperations.list_by_replication_protected_items": "Microsoft.RecoveryServices.RecoveryPoints.listByReplicationProtectedItems", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.RecoveryPointsOperations.list_by_replication_protected_items": "Microsoft.RecoveryServices.RecoveryPoints.listByReplicationProtectedItems", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationProtectionClustersOperations.get": "Microsoft.RecoveryServices.ReplicationProtectionClusters.get", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationProtectionClustersOperations.get": "Microsoft.RecoveryServices.ReplicationProtectionClusters.get", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationProtectionClustersOperations.begin_create": "Microsoft.RecoveryServices.ReplicationProtectionClusters.create", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationProtectionClustersOperations.begin_create": "Microsoft.RecoveryServices.ReplicationProtectionClusters.create", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationProtectionClustersOperations.begin_purge": "Microsoft.RecoveryServices.ReplicationProtectionClusters.purge", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationProtectionClustersOperations.begin_purge": "Microsoft.RecoveryServices.ReplicationProtectionClusters.purge", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationProtectionClustersOperations.begin_apply_recovery_point": "Microsoft.RecoveryServices.ReplicationProtectionClusters.applyRecoveryPoint", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationProtectionClustersOperations.begin_apply_recovery_point": "Microsoft.RecoveryServices.ReplicationProtectionClusters.applyRecoveryPoint", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationProtectionClustersOperations.begin_failover_commit": "Microsoft.RecoveryServices.ReplicationProtectionClusters.failoverCommit", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationProtectionClustersOperations.begin_failover_commit": "Microsoft.RecoveryServices.ReplicationProtectionClusters.failoverCommit", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationProtectionClustersOperations.begin_repair_replication": "Microsoft.RecoveryServices.ReplicationProtectionClusters.repairReplication", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationProtectionClustersOperations.begin_repair_replication": "Microsoft.RecoveryServices.ReplicationProtectionClusters.repairReplication", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationProtectionClustersOperations.begin_test_failover": "Microsoft.RecoveryServices.ReplicationProtectionClusters.testFailover", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationProtectionClustersOperations.begin_test_failover": "Microsoft.RecoveryServices.ReplicationProtectionClusters.testFailover", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationProtectionClustersOperations.begin_test_failover_cleanup": "Microsoft.RecoveryServices.ReplicationProtectionClusters.testFailoverCleanup", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationProtectionClustersOperations.begin_test_failover_cleanup": "Microsoft.RecoveryServices.ReplicationProtectionClusters.testFailoverCleanup", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationProtectionClustersOperations.begin_unplanned_failover": "Microsoft.RecoveryServices.ReplicationProtectionClusters.unplannedFailover", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationProtectionClustersOperations.begin_unplanned_failover": "Microsoft.RecoveryServices.ReplicationProtectionClusters.unplannedFailover", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationProtectionClustersOperations.get_operation_results": "Microsoft.RecoveryServices.ReplicationProtectionClusterOperationGroup.getOperationResults", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationProtectionClustersOperations.get_operation_results": "Microsoft.RecoveryServices.ReplicationProtectionClusterOperationGroup.getOperationResults", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationProtectionClustersOperations.list_by_replication_protection_containers": "Microsoft.RecoveryServices.ReplicationProtectionClusterOperationGroup.listByReplicationProtectionContainers", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationProtectionClustersOperations.list_by_replication_protection_containers": "Microsoft.RecoveryServices.ReplicationProtectionClusterOperationGroup.listByReplicationProtectionContainers", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationProtectionClustersOperations.list": "Microsoft.RecoveryServices.ReplicationProtectionClustersOperationGroup.list", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationProtectionClustersOperations.list": "Microsoft.RecoveryServices.ReplicationProtectionClustersOperationGroup.list", + "azure.mgmt.recoveryservicessiterecovery.operations.ClusterRecoveryPointsOperations.list_by_replication_protection_cluster": "Microsoft.RecoveryServices.ClusterRecoveryPoints.listByReplicationProtectionCluster", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ClusterRecoveryPointsOperations.list_by_replication_protection_cluster": "Microsoft.RecoveryServices.ClusterRecoveryPoints.listByReplicationProtectionCluster", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationProtectionIntentsOperations.get": "Microsoft.RecoveryServices.ReplicationProtectionIntents.get", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationProtectionIntentsOperations.get": "Microsoft.RecoveryServices.ReplicationProtectionIntents.get", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationProtectionIntentsOperations.create": "Microsoft.RecoveryServices.ReplicationProtectionIntents.create", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationProtectionIntentsOperations.create": "Microsoft.RecoveryServices.ReplicationProtectionIntents.create", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationProtectionIntentsOperations.list": "Microsoft.RecoveryServices.ReplicationProtectionIntents.list", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationProtectionIntentsOperations.list": "Microsoft.RecoveryServices.ReplicationProtectionIntents.list", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationAlertSettingsOperations.get": "Microsoft.RecoveryServices.Alerts.get", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationAlertSettingsOperations.get": "Microsoft.RecoveryServices.Alerts.get", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationAlertSettingsOperations.create": "Microsoft.RecoveryServices.Alerts.create", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationAlertSettingsOperations.create": "Microsoft.RecoveryServices.Alerts.create", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationAlertSettingsOperations.list": "Microsoft.RecoveryServices.Alerts.list", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationAlertSettingsOperations.list": "Microsoft.RecoveryServices.Alerts.list", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationEligibilityResultsOperations.get": "Microsoft.RecoveryServices.ReplicationEligibilityResultsOperationGroup.get", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationEligibilityResultsOperations.get": "Microsoft.RecoveryServices.ReplicationEligibilityResultsOperationGroup.get", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationEligibilityResultsOperations.list": "Microsoft.RecoveryServices.ReplicationEligibilityResultsOperationGroup.list", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationEligibilityResultsOperations.list": "Microsoft.RecoveryServices.ReplicationEligibilityResultsOperationGroup.list", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationEventsOperations.get": "Microsoft.RecoveryServices.Events.get", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationEventsOperations.get": "Microsoft.RecoveryServices.Events.get", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationEventsOperations.list": "Microsoft.RecoveryServices.Events.list", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationEventsOperations.list": "Microsoft.RecoveryServices.Events.list", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationFabricsOperations.get": "Microsoft.RecoveryServices.Fabrics.get", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationFabricsOperations.get": "Microsoft.RecoveryServices.Fabrics.get", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationFabricsOperations.begin_create": "Microsoft.RecoveryServices.Fabrics.create", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationFabricsOperations.begin_create": "Microsoft.RecoveryServices.Fabrics.create", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationFabricsOperations.begin_purge": "Microsoft.RecoveryServices.Fabrics.purge", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationFabricsOperations.begin_purge": "Microsoft.RecoveryServices.Fabrics.purge", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationFabricsOperations.list": "Microsoft.RecoveryServices.Fabrics.list", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationFabricsOperations.list": "Microsoft.RecoveryServices.Fabrics.list", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationFabricsOperations.begin_check_consistency": "Microsoft.RecoveryServices.Fabrics.checkConsistency", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationFabricsOperations.begin_check_consistency": "Microsoft.RecoveryServices.Fabrics.checkConsistency", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationFabricsOperations.begin_migrate_to_aad": "Microsoft.RecoveryServices.Fabrics.migrateToAad", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationFabricsOperations.begin_migrate_to_aad": "Microsoft.RecoveryServices.Fabrics.migrateToAad", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationFabricsOperations.begin_reassociate_gateway": "Microsoft.RecoveryServices.Fabrics.reassociateGateway", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationFabricsOperations.begin_reassociate_gateway": "Microsoft.RecoveryServices.Fabrics.reassociateGateway", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationFabricsOperations.begin_delete": "Microsoft.RecoveryServices.Fabrics.delete", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationFabricsOperations.begin_delete": "Microsoft.RecoveryServices.Fabrics.delete", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationFabricsOperations.begin_renew_certificate": "Microsoft.RecoveryServices.Fabrics.renewCertificate", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationFabricsOperations.begin_renew_certificate": "Microsoft.RecoveryServices.Fabrics.renewCertificate", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationFabricsOperations.begin_remove_infra": "Microsoft.RecoveryServices.Fabrics.removeInfra", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationFabricsOperations.begin_remove_infra": "Microsoft.RecoveryServices.Fabrics.removeInfra", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationLogicalNetworksOperations.get": "Microsoft.RecoveryServices.LogicalNetworks.get", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationLogicalNetworksOperations.get": "Microsoft.RecoveryServices.LogicalNetworks.get", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationLogicalNetworksOperations.list_by_replication_fabrics": "Microsoft.RecoveryServices.LogicalNetworks.listByReplicationFabrics", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationLogicalNetworksOperations.list_by_replication_fabrics": "Microsoft.RecoveryServices.LogicalNetworks.listByReplicationFabrics", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationNetworksOperations.get": "Microsoft.RecoveryServices.Networks.get", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationNetworksOperations.get": "Microsoft.RecoveryServices.Networks.get", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationNetworksOperations.list_by_replication_fabrics": "Microsoft.RecoveryServices.Networks.listByReplicationFabrics", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationNetworksOperations.list_by_replication_fabrics": "Microsoft.RecoveryServices.Networks.listByReplicationFabrics", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationNetworksOperations.list": "Microsoft.RecoveryServices.ReplicationNetworksOperationGroup.list", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationNetworksOperations.list": "Microsoft.RecoveryServices.ReplicationNetworksOperationGroup.list", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationNetworkMappingsOperations.get": "Microsoft.RecoveryServices.NetworkMappings.get", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationNetworkMappingsOperations.get": "Microsoft.RecoveryServices.NetworkMappings.get", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationNetworkMappingsOperations.begin_create": "Microsoft.RecoveryServices.NetworkMappings.create", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationNetworkMappingsOperations.begin_create": "Microsoft.RecoveryServices.NetworkMappings.create", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationNetworkMappingsOperations.begin_update": "Microsoft.RecoveryServices.NetworkMappings.update", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationNetworkMappingsOperations.begin_update": "Microsoft.RecoveryServices.NetworkMappings.update", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationNetworkMappingsOperations.begin_delete": "Microsoft.RecoveryServices.NetworkMappings.delete", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationNetworkMappingsOperations.begin_delete": "Microsoft.RecoveryServices.NetworkMappings.delete", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationNetworkMappingsOperations.list_by_replication_networks": "Microsoft.RecoveryServices.NetworkMappings.listByReplicationNetworks", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationNetworkMappingsOperations.list_by_replication_networks": "Microsoft.RecoveryServices.NetworkMappings.listByReplicationNetworks", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationNetworkMappingsOperations.list": "Microsoft.RecoveryServices.ReplicationNetworkMappingsOperationGroup.list", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationNetworkMappingsOperations.list": "Microsoft.RecoveryServices.ReplicationNetworkMappingsOperationGroup.list", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationProtectionContainersOperations.get": "Microsoft.RecoveryServices.ProtectionContainers.get", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationProtectionContainersOperations.get": "Microsoft.RecoveryServices.ProtectionContainers.get", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationProtectionContainersOperations.begin_create": "Microsoft.RecoveryServices.ProtectionContainers.create", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationProtectionContainersOperations.begin_create": "Microsoft.RecoveryServices.ProtectionContainers.create", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationProtectionContainersOperations.list_by_replication_fabrics": "Microsoft.RecoveryServices.ProtectionContainers.listByReplicationFabrics", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationProtectionContainersOperations.list_by_replication_fabrics": "Microsoft.RecoveryServices.ProtectionContainers.listByReplicationFabrics", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationProtectionContainersOperations.begin_discover_protectable_item": "Microsoft.RecoveryServices.ProtectionContainers.discoverProtectableItem", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationProtectionContainersOperations.begin_discover_protectable_item": "Microsoft.RecoveryServices.ProtectionContainers.discoverProtectableItem", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationProtectionContainersOperations.begin_delete": "Microsoft.RecoveryServices.ProtectionContainers.delete", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationProtectionContainersOperations.begin_delete": "Microsoft.RecoveryServices.ProtectionContainers.delete", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationProtectionContainersOperations.begin_switch_cluster_protection": "Microsoft.RecoveryServices.ProtectionContainers.switchClusterProtection", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationProtectionContainersOperations.begin_switch_cluster_protection": "Microsoft.RecoveryServices.ProtectionContainers.switchClusterProtection", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationProtectionContainersOperations.begin_switch_protection": "Microsoft.RecoveryServices.ProtectionContainers.switchProtection", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationProtectionContainersOperations.begin_switch_protection": "Microsoft.RecoveryServices.ProtectionContainers.switchProtection", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationProtectionContainersOperations.list": "Microsoft.RecoveryServices.ReplicationProtectionContainersOperationGroup.list", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationProtectionContainersOperations.list": "Microsoft.RecoveryServices.ReplicationProtectionContainersOperationGroup.list", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationMigrationItemsOperations.get": "Microsoft.RecoveryServices.MigrationItems.get", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationMigrationItemsOperations.get": "Microsoft.RecoveryServices.MigrationItems.get", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationMigrationItemsOperations.begin_create": "Microsoft.RecoveryServices.MigrationItems.create", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationMigrationItemsOperations.begin_create": "Microsoft.RecoveryServices.MigrationItems.create", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationMigrationItemsOperations.begin_update": "Microsoft.RecoveryServices.MigrationItems.update", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationMigrationItemsOperations.begin_update": "Microsoft.RecoveryServices.MigrationItems.update", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationMigrationItemsOperations.begin_delete": "Microsoft.RecoveryServices.MigrationItems.delete", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationMigrationItemsOperations.begin_delete": "Microsoft.RecoveryServices.MigrationItems.delete", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationMigrationItemsOperations.list_by_replication_protection_containers": "Microsoft.RecoveryServices.MigrationItems.listByReplicationProtectionContainers", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationMigrationItemsOperations.list_by_replication_protection_containers": "Microsoft.RecoveryServices.MigrationItems.listByReplicationProtectionContainers", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationMigrationItemsOperations.begin_migrate": "Microsoft.RecoveryServices.MigrationItems.migrate", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationMigrationItemsOperations.begin_migrate": "Microsoft.RecoveryServices.MigrationItems.migrate", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationMigrationItemsOperations.begin_pause_replication": "Microsoft.RecoveryServices.MigrationItems.pauseReplication", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationMigrationItemsOperations.begin_pause_replication": "Microsoft.RecoveryServices.MigrationItems.pauseReplication", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationMigrationItemsOperations.begin_resume_replication": "Microsoft.RecoveryServices.MigrationItems.resumeReplication", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationMigrationItemsOperations.begin_resume_replication": "Microsoft.RecoveryServices.MigrationItems.resumeReplication", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationMigrationItemsOperations.begin_resync": "Microsoft.RecoveryServices.MigrationItems.resync", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationMigrationItemsOperations.begin_resync": "Microsoft.RecoveryServices.MigrationItems.resync", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationMigrationItemsOperations.begin_test_migrate": "Microsoft.RecoveryServices.MigrationItems.testMigrate", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationMigrationItemsOperations.begin_test_migrate": "Microsoft.RecoveryServices.MigrationItems.testMigrate", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationMigrationItemsOperations.begin_test_migrate_cleanup": "Microsoft.RecoveryServices.MigrationItems.testMigrateCleanup", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationMigrationItemsOperations.begin_test_migrate_cleanup": "Microsoft.RecoveryServices.MigrationItems.testMigrateCleanup", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationMigrationItemsOperations.list": "Microsoft.RecoveryServices.ReplicationMigrationItemsOperationGroup.list", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationMigrationItemsOperations.list": "Microsoft.RecoveryServices.ReplicationMigrationItemsOperationGroup.list", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationProtectableItemsOperations.get": "Microsoft.RecoveryServices.ProtectableItems.get", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationProtectableItemsOperations.get": "Microsoft.RecoveryServices.ProtectableItems.get", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationProtectableItemsOperations.list_by_replication_protection_containers": "Microsoft.RecoveryServices.ProtectableItems.listByReplicationProtectionContainers", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationProtectableItemsOperations.list_by_replication_protection_containers": "Microsoft.RecoveryServices.ProtectableItems.listByReplicationProtectionContainers", + "azure.mgmt.recoveryservicessiterecovery.operations.ClusterRecoveryPointOperations.get": "Microsoft.RecoveryServices.ClusterRecoveryPointsOperationGroup.get", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ClusterRecoveryPointOperations.get": "Microsoft.RecoveryServices.ClusterRecoveryPointsOperationGroup.get", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationProtectionContainerMappingsOperations.get": "Microsoft.RecoveryServices.ProtectionContainerMappings.get", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationProtectionContainerMappingsOperations.get": "Microsoft.RecoveryServices.ProtectionContainerMappings.get", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationProtectionContainerMappingsOperations.begin_create": "Microsoft.RecoveryServices.ProtectionContainerMappings.create", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationProtectionContainerMappingsOperations.begin_create": "Microsoft.RecoveryServices.ProtectionContainerMappings.create", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationProtectionContainerMappingsOperations.begin_update": "Microsoft.RecoveryServices.ProtectionContainerMappings.update", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationProtectionContainerMappingsOperations.begin_update": "Microsoft.RecoveryServices.ProtectionContainerMappings.update", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationProtectionContainerMappingsOperations.begin_purge": "Microsoft.RecoveryServices.ProtectionContainerMappings.purge", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationProtectionContainerMappingsOperations.begin_purge": "Microsoft.RecoveryServices.ProtectionContainerMappings.purge", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationProtectionContainerMappingsOperations.list_by_replication_protection_containers": "Microsoft.RecoveryServices.ProtectionContainerMappings.listByReplicationProtectionContainers", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationProtectionContainerMappingsOperations.list_by_replication_protection_containers": "Microsoft.RecoveryServices.ProtectionContainerMappings.listByReplicationProtectionContainers", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationProtectionContainerMappingsOperations.begin_delete": "Microsoft.RecoveryServices.ProtectionContainerMappings.delete", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationProtectionContainerMappingsOperations.begin_delete": "Microsoft.RecoveryServices.ProtectionContainerMappings.delete", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationProtectionContainerMappingsOperations.list": "Microsoft.RecoveryServices.ReplicationProtectionContainerMappingsOperationGroup.list", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationProtectionContainerMappingsOperations.list": "Microsoft.RecoveryServices.ReplicationProtectionContainerMappingsOperationGroup.list", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationRecoveryServicesProvidersOperations.get": "Microsoft.RecoveryServices.RecoveryServicesProviders.get", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationRecoveryServicesProvidersOperations.get": "Microsoft.RecoveryServices.RecoveryServicesProviders.get", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationRecoveryServicesProvidersOperations.begin_create": "Microsoft.RecoveryServices.RecoveryServicesProviders.create", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationRecoveryServicesProvidersOperations.begin_create": "Microsoft.RecoveryServices.RecoveryServicesProviders.create", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationRecoveryServicesProvidersOperations.begin_purge": "Microsoft.RecoveryServices.RecoveryServicesProviders.purge", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationRecoveryServicesProvidersOperations.begin_purge": "Microsoft.RecoveryServices.RecoveryServicesProviders.purge", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationRecoveryServicesProvidersOperations.list_by_replication_fabrics": "Microsoft.RecoveryServices.RecoveryServicesProviders.listByReplicationFabrics", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationRecoveryServicesProvidersOperations.list_by_replication_fabrics": "Microsoft.RecoveryServices.RecoveryServicesProviders.listByReplicationFabrics", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationRecoveryServicesProvidersOperations.begin_refresh_provider": "Microsoft.RecoveryServices.RecoveryServicesProviders.refreshProvider", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationRecoveryServicesProvidersOperations.begin_refresh_provider": "Microsoft.RecoveryServices.RecoveryServicesProviders.refreshProvider", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationRecoveryServicesProvidersOperations.begin_delete": "Microsoft.RecoveryServices.RecoveryServicesProviders.delete", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationRecoveryServicesProvidersOperations.begin_delete": "Microsoft.RecoveryServices.RecoveryServicesProviders.delete", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationRecoveryServicesProvidersOperations.list": "Microsoft.RecoveryServices.ReplicationRecoveryServicesProvidersOperationGroup.list", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationRecoveryServicesProvidersOperations.list": "Microsoft.RecoveryServices.ReplicationRecoveryServicesProvidersOperationGroup.list", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationStorageClassificationsOperations.get": "Microsoft.RecoveryServices.StorageClassifications.get", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationStorageClassificationsOperations.get": "Microsoft.RecoveryServices.StorageClassifications.get", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationStorageClassificationsOperations.list_by_replication_fabrics": "Microsoft.RecoveryServices.StorageClassifications.listByReplicationFabrics", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationStorageClassificationsOperations.list_by_replication_fabrics": "Microsoft.RecoveryServices.StorageClassifications.listByReplicationFabrics", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationStorageClassificationsOperations.list": "Microsoft.RecoveryServices.ReplicationStorageClassificationsOperationGroup.list", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationStorageClassificationsOperations.list": "Microsoft.RecoveryServices.ReplicationStorageClassificationsOperationGroup.list", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationStorageClassificationMappingsOperations.get": "Microsoft.RecoveryServices.StorageClassificationMappings.get", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationStorageClassificationMappingsOperations.get": "Microsoft.RecoveryServices.StorageClassificationMappings.get", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationStorageClassificationMappingsOperations.begin_create": "Microsoft.RecoveryServices.StorageClassificationMappings.create", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationStorageClassificationMappingsOperations.begin_create": "Microsoft.RecoveryServices.StorageClassificationMappings.create", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationStorageClassificationMappingsOperations.begin_delete": "Microsoft.RecoveryServices.StorageClassificationMappings.delete", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationStorageClassificationMappingsOperations.begin_delete": "Microsoft.RecoveryServices.StorageClassificationMappings.delete", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationStorageClassificationMappingsOperations.list_by_replication_storage_classifications": "Microsoft.RecoveryServices.StorageClassificationMappings.listByReplicationStorageClassifications", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationStorageClassificationMappingsOperations.list_by_replication_storage_classifications": "Microsoft.RecoveryServices.StorageClassificationMappings.listByReplicationStorageClassifications", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationStorageClassificationMappingsOperations.list": "Microsoft.RecoveryServices.ReplicationStorageClassificationMappingsOperationGroup.list", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationStorageClassificationMappingsOperations.list": "Microsoft.RecoveryServices.ReplicationStorageClassificationMappingsOperationGroup.list", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationvCentersOperations.get": "Microsoft.RecoveryServices.VCenters.get", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationvCentersOperations.get": "Microsoft.RecoveryServices.VCenters.get", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationvCentersOperations.begin_create": "Microsoft.RecoveryServices.VCenters.create", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationvCentersOperations.begin_create": "Microsoft.RecoveryServices.VCenters.create", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationvCentersOperations.begin_update": "Microsoft.RecoveryServices.VCenters.update", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationvCentersOperations.begin_update": "Microsoft.RecoveryServices.VCenters.update", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationvCentersOperations.begin_delete": "Microsoft.RecoveryServices.VCenters.delete", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationvCentersOperations.begin_delete": "Microsoft.RecoveryServices.VCenters.delete", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationvCentersOperations.list_by_replication_fabrics": "Microsoft.RecoveryServices.VCenters.listByReplicationFabrics", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationvCentersOperations.list_by_replication_fabrics": "Microsoft.RecoveryServices.VCenters.listByReplicationFabrics", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationvCentersOperations.list": "Microsoft.RecoveryServices.ReplicationvCentersOperationGroup.list", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationvCentersOperations.list": "Microsoft.RecoveryServices.ReplicationvCentersOperationGroup.list", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationJobsOperations.get": "Microsoft.RecoveryServices.Jobs.get", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationJobsOperations.get": "Microsoft.RecoveryServices.Jobs.get", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationJobsOperations.list": "Microsoft.RecoveryServices.Jobs.list", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationJobsOperations.list": "Microsoft.RecoveryServices.Jobs.list", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationJobsOperations.begin_cancel": "Microsoft.RecoveryServices.Jobs.cancel", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationJobsOperations.begin_cancel": "Microsoft.RecoveryServices.Jobs.cancel", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationJobsOperations.begin_restart": "Microsoft.RecoveryServices.Jobs.restart", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationJobsOperations.begin_restart": "Microsoft.RecoveryServices.Jobs.restart", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationJobsOperations.begin_resume": "Microsoft.RecoveryServices.Jobs.resume", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationJobsOperations.begin_resume": "Microsoft.RecoveryServices.Jobs.resume", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationJobsOperations.begin_export": "Microsoft.RecoveryServices.ReplicationJobsOperationGroup.export", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationJobsOperations.begin_export": "Microsoft.RecoveryServices.ReplicationJobsOperationGroup.export", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationPoliciesOperations.get": "Microsoft.RecoveryServices.Policies.get", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationPoliciesOperations.get": "Microsoft.RecoveryServices.Policies.get", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationPoliciesOperations.begin_create": "Microsoft.RecoveryServices.Policies.create", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationPoliciesOperations.begin_create": "Microsoft.RecoveryServices.Policies.create", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationPoliciesOperations.begin_update": "Microsoft.RecoveryServices.Policies.update", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationPoliciesOperations.begin_update": "Microsoft.RecoveryServices.Policies.update", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationPoliciesOperations.begin_delete": "Microsoft.RecoveryServices.Policies.delete", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationPoliciesOperations.begin_delete": "Microsoft.RecoveryServices.Policies.delete", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationPoliciesOperations.list": "Microsoft.RecoveryServices.Policies.list", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationPoliciesOperations.list": "Microsoft.RecoveryServices.Policies.list", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationRecoveryPlansOperations.get": "Microsoft.RecoveryServices.RecoveryPlans.get", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationRecoveryPlansOperations.get": "Microsoft.RecoveryServices.RecoveryPlans.get", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationRecoveryPlansOperations.begin_create": "Microsoft.RecoveryServices.RecoveryPlans.create", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationRecoveryPlansOperations.begin_create": "Microsoft.RecoveryServices.RecoveryPlans.create", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationRecoveryPlansOperations.begin_update": "Microsoft.RecoveryServices.RecoveryPlans.update", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationRecoveryPlansOperations.begin_update": "Microsoft.RecoveryServices.RecoveryPlans.update", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationRecoveryPlansOperations.begin_delete": "Microsoft.RecoveryServices.RecoveryPlans.delete", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationRecoveryPlansOperations.begin_delete": "Microsoft.RecoveryServices.RecoveryPlans.delete", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationRecoveryPlansOperations.list": "Microsoft.RecoveryServices.RecoveryPlans.list", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationRecoveryPlansOperations.list": "Microsoft.RecoveryServices.RecoveryPlans.list", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationRecoveryPlansOperations.begin_failover_cancel": "Microsoft.RecoveryServices.RecoveryPlans.failoverCancel", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationRecoveryPlansOperations.begin_failover_cancel": "Microsoft.RecoveryServices.RecoveryPlans.failoverCancel", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationRecoveryPlansOperations.begin_failover_commit": "Microsoft.RecoveryServices.RecoveryPlans.failoverCommit", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationRecoveryPlansOperations.begin_failover_commit": "Microsoft.RecoveryServices.RecoveryPlans.failoverCommit", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationRecoveryPlansOperations.begin_planned_failover": "Microsoft.RecoveryServices.RecoveryPlans.plannedFailover", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationRecoveryPlansOperations.begin_planned_failover": "Microsoft.RecoveryServices.RecoveryPlans.plannedFailover", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationRecoveryPlansOperations.begin_reprotect": "Microsoft.RecoveryServices.RecoveryPlans.reprotect", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationRecoveryPlansOperations.begin_reprotect": "Microsoft.RecoveryServices.RecoveryPlans.reprotect", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationRecoveryPlansOperations.begin_test_failover": "Microsoft.RecoveryServices.RecoveryPlans.testFailover", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationRecoveryPlansOperations.begin_test_failover": "Microsoft.RecoveryServices.RecoveryPlans.testFailover", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationRecoveryPlansOperations.begin_test_failover_cleanup": "Microsoft.RecoveryServices.RecoveryPlans.testFailoverCleanup", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationRecoveryPlansOperations.begin_test_failover_cleanup": "Microsoft.RecoveryServices.RecoveryPlans.testFailoverCleanup", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationRecoveryPlansOperations.begin_unplanned_failover": "Microsoft.RecoveryServices.RecoveryPlans.unplannedFailover", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationRecoveryPlansOperations.begin_unplanned_failover": "Microsoft.RecoveryServices.RecoveryPlans.unplannedFailover", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationVaultSettingOperations.get": "Microsoft.RecoveryServices.VaultSettings.get", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationVaultSettingOperations.get": "Microsoft.RecoveryServices.VaultSettings.get", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationVaultSettingOperations.begin_create": "Microsoft.RecoveryServices.VaultSettings.create", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationVaultSettingOperations.begin_create": "Microsoft.RecoveryServices.VaultSettings.create", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationVaultSettingOperations.list": "Microsoft.RecoveryServices.VaultSettings.list", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationVaultSettingOperations.list": "Microsoft.RecoveryServices.VaultSettings.list", + "azure.mgmt.recoveryservicessiterecovery.operations.Operations.list": "Microsoft.RecoveryServices.OperationsOperationGroup.list", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.Operations.list": "Microsoft.RecoveryServices.OperationsOperationGroup.list", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationAppliancesOperations.list": "Microsoft.RecoveryServices.ReplicationAppliancesOperationGroup.list", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationAppliancesOperations.list": "Microsoft.RecoveryServices.ReplicationAppliancesOperationGroup.list", + "azure.mgmt.recoveryservicessiterecovery.operations.SupportedOperatingSystemsOperations.get": "Microsoft.RecoveryServices.SupportedOperatingSystemsOperationGroup.get", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.SupportedOperatingSystemsOperations.get": "Microsoft.RecoveryServices.SupportedOperatingSystemsOperationGroup.get", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationVaultHealthOperations.get": "Microsoft.RecoveryServices.ReplicationVaultHealthOperationGroup.get", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationVaultHealthOperations.get": "Microsoft.RecoveryServices.ReplicationVaultHealthOperationGroup.get", + "azure.mgmt.recoveryservicessiterecovery.operations.ReplicationVaultHealthOperations.begin_refresh": "Microsoft.RecoveryServices.ReplicationVaultHealthOperationGroup.refresh", + "azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationVaultHealthOperations.begin_refresh": "Microsoft.RecoveryServices.ReplicationVaultHealthOperationGroup.refresh" + } +} \ No newline at end of file diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/__init__.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/__init__.py index 8db66d3d0f0f..d55ccad1f573 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/__init__.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/__init__.py @@ -1 +1 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/__init__.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/__init__.py index 8db66d3d0f0f..d55ccad1f573 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/__init__.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/__init__.py @@ -1 +1 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/__init__.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/__init__.py index ca8899fc2459..46716a2e9e4e 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/__init__.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/__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 ._site_recovery_management_client import SiteRecoveryManagementClient # type: ignore +from ._client import SiteRecoveryManagementClient # type: ignore from ._version import VERSION __version__ = VERSION diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/_site_recovery_management_client.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/_client.py similarity index 89% rename from sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/_site_recovery_management_client.py rename to sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/_client.py index 03123dedb073..440d7654f6e7 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/_site_recovery_management_client.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/_client.py @@ -2,22 +2,23 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# 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 -from typing import Any, TYPE_CHECKING +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 +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints -from . import models as _models from ._configuration import SiteRecoveryManagementClientConfiguration -from ._serialization import Deserializer, Serializer +from ._utils.serialization import Deserializer, Serializer from .operations import ( ClusterRecoveryPointOperations, ClusterRecoveryPointsOperations, @@ -53,20 +54,37 @@ ) if TYPE_CHECKING: + from azure.core import AzureClouds from azure.core.credentials import TokenCredential class SiteRecoveryManagementClient: # pylint: disable=too-many-instance-attributes - """SiteRecoveryManagementClient. + """Open API for RecoveryServicesSiteRecovery. - :ivar operations: Operations operations - :vartype operations: azure.mgmt.recoveryservicessiterecovery.operations.Operations + :ivar migration_recovery_points: MigrationRecoveryPointsOperations operations + :vartype migration_recovery_points: + azure.mgmt.recoveryservicessiterecovery.operations.MigrationRecoveryPointsOperations + :ivar replication_protected_items: ReplicationProtectedItemsOperations operations + :vartype replication_protected_items: + azure.mgmt.recoveryservicessiterecovery.operations.ReplicationProtectedItemsOperations + :ivar target_compute_sizes: TargetComputeSizesOperations operations + :vartype target_compute_sizes: + azure.mgmt.recoveryservicessiterecovery.operations.TargetComputeSizesOperations + :ivar recovery_points: RecoveryPointsOperations operations + :vartype recovery_points: + azure.mgmt.recoveryservicessiterecovery.operations.RecoveryPointsOperations + :ivar replication_protection_clusters: ReplicationProtectionClustersOperations operations + :vartype replication_protection_clusters: + azure.mgmt.recoveryservicessiterecovery.operations.ReplicationProtectionClustersOperations + :ivar cluster_recovery_points: ClusterRecoveryPointsOperations operations + :vartype cluster_recovery_points: + azure.mgmt.recoveryservicessiterecovery.operations.ClusterRecoveryPointsOperations + :ivar replication_protection_intents: ReplicationProtectionIntentsOperations operations + :vartype replication_protection_intents: + azure.mgmt.recoveryservicessiterecovery.operations.ReplicationProtectionIntentsOperations :ivar replication_alert_settings: ReplicationAlertSettingsOperations operations :vartype replication_alert_settings: azure.mgmt.recoveryservicessiterecovery.operations.ReplicationAlertSettingsOperations - :ivar replication_appliances: ReplicationAppliancesOperations operations - :vartype replication_appliances: - azure.mgmt.recoveryservicessiterecovery.operations.ReplicationAppliancesOperations :ivar replication_eligibility_results: ReplicationEligibilityResultsOperations operations :vartype replication_eligibility_results: azure.mgmt.recoveryservicessiterecovery.operations.ReplicationEligibilityResultsOperations @@ -91,27 +109,9 @@ class SiteRecoveryManagementClient: # pylint: disable=too-many-instance-attribu :ivar replication_migration_items: ReplicationMigrationItemsOperations operations :vartype replication_migration_items: azure.mgmt.recoveryservicessiterecovery.operations.ReplicationMigrationItemsOperations - :ivar migration_recovery_points: MigrationRecoveryPointsOperations operations - :vartype migration_recovery_points: - azure.mgmt.recoveryservicessiterecovery.operations.MigrationRecoveryPointsOperations :ivar replication_protectable_items: ReplicationProtectableItemsOperations operations :vartype replication_protectable_items: azure.mgmt.recoveryservicessiterecovery.operations.ReplicationProtectableItemsOperations - :ivar replication_protected_items: ReplicationProtectedItemsOperations operations - :vartype replication_protected_items: - azure.mgmt.recoveryservicessiterecovery.operations.ReplicationProtectedItemsOperations - :ivar recovery_points: RecoveryPointsOperations operations - :vartype recovery_points: - azure.mgmt.recoveryservicessiterecovery.operations.RecoveryPointsOperations - :ivar target_compute_sizes: TargetComputeSizesOperations operations - :vartype target_compute_sizes: - azure.mgmt.recoveryservicessiterecovery.operations.TargetComputeSizesOperations - :ivar replication_protection_clusters: ReplicationProtectionClustersOperations operations - :vartype replication_protection_clusters: - azure.mgmt.recoveryservicessiterecovery.operations.ReplicationProtectionClustersOperations - :ivar cluster_recovery_points: ClusterRecoveryPointsOperations operations - :vartype cluster_recovery_points: - azure.mgmt.recoveryservicessiterecovery.operations.ClusterRecoveryPointsOperations :ivar cluster_recovery_point: ClusterRecoveryPointOperations operations :vartype cluster_recovery_point: azure.mgmt.recoveryservicessiterecovery.operations.ClusterRecoveryPointOperations @@ -140,34 +140,35 @@ class SiteRecoveryManagementClient: # pylint: disable=too-many-instance-attribu :ivar replication_policies: ReplicationPoliciesOperations operations :vartype replication_policies: azure.mgmt.recoveryservicessiterecovery.operations.ReplicationPoliciesOperations - :ivar replication_protection_intents: ReplicationProtectionIntentsOperations operations - :vartype replication_protection_intents: - azure.mgmt.recoveryservicessiterecovery.operations.ReplicationProtectionIntentsOperations :ivar replication_recovery_plans: ReplicationRecoveryPlansOperations operations :vartype replication_recovery_plans: azure.mgmt.recoveryservicessiterecovery.operations.ReplicationRecoveryPlansOperations + :ivar replication_vault_setting: ReplicationVaultSettingOperations operations + :vartype replication_vault_setting: + azure.mgmt.recoveryservicessiterecovery.operations.ReplicationVaultSettingOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.recoveryservicessiterecovery.operations.Operations + :ivar replication_appliances: ReplicationAppliancesOperations operations + :vartype replication_appliances: + azure.mgmt.recoveryservicessiterecovery.operations.ReplicationAppliancesOperations :ivar supported_operating_systems: SupportedOperatingSystemsOperations operations :vartype supported_operating_systems: azure.mgmt.recoveryservicessiterecovery.operations.SupportedOperatingSystemsOperations :ivar replication_vault_health: ReplicationVaultHealthOperations operations :vartype replication_vault_health: azure.mgmt.recoveryservicessiterecovery.operations.ReplicationVaultHealthOperations - :ivar replication_vault_setting: ReplicationVaultSettingOperations operations - :vartype replication_vault_setting: - azure.mgmt.recoveryservicessiterecovery.operations.ReplicationVaultSettingOperations - :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 subscription Id. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :param resource_group_name: The name of the resource group where the recovery services vault is - present. Required. - :type resource_group_name: str - :param resource_name: The name of the recovery services vault. Required. - :type resource_name: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service host. Default value is None. :type base_url: str - :keyword api_version: Api Version. Default value is "2025-01-01". Note that overriding this - default value may result in unsupported behavior. + :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: The API version to use for this operation. Known values are "2025-08-01". + Default value is "2025-08-01". 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. @@ -177,18 +178,26 @@ def __init__( self, credential: "TokenCredential", subscription_id: str, - resource_group_name: str, - resource_name: str, - base_url: str = "https://management.azure.com", + base_url: Optional[str] = None, + *, + 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 = SiteRecoveryManagementClientConfiguration( credential=credential, subscription_id=subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, + base_url=cast(str, base_url), + cloud_setting=cloud_setting, + credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -207,60 +216,58 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=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.replication_alert_settings = ReplicationAlertSettingsOperations( + self.migration_recovery_points = MigrationRecoveryPointsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.replication_appliances = ReplicationAppliancesOperations( + self.replication_protected_items = ReplicationProtectedItemsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.replication_eligibility_results = ReplicationEligibilityResultsOperations( + self.target_compute_sizes = TargetComputeSizesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.replication_events = ReplicationEventsOperations( + self.recovery_points = RecoveryPointsOperations(self._client, self._config, self._serialize, self._deserialize) + self.replication_protection_clusters = ReplicationProtectionClustersOperations( self._client, self._config, self._serialize, self._deserialize ) - self.replication_fabrics = ReplicationFabricsOperations( + self.cluster_recovery_points = ClusterRecoveryPointsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.replication_logical_networks = ReplicationLogicalNetworksOperations( + self.replication_protection_intents = ReplicationProtectionIntentsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.replication_networks = ReplicationNetworksOperations( + self.replication_alert_settings = ReplicationAlertSettingsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.replication_network_mappings = ReplicationNetworkMappingsOperations( + self.replication_eligibility_results = ReplicationEligibilityResultsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.replication_protection_containers = ReplicationProtectionContainersOperations( + self.replication_events = ReplicationEventsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.replication_migration_items = ReplicationMigrationItemsOperations( + self.replication_fabrics = ReplicationFabricsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.migration_recovery_points = MigrationRecoveryPointsOperations( + self.replication_logical_networks = ReplicationLogicalNetworksOperations( self._client, self._config, self._serialize, self._deserialize ) - self.replication_protectable_items = ReplicationProtectableItemsOperations( + self.replication_networks = ReplicationNetworksOperations( self._client, self._config, self._serialize, self._deserialize ) - self.replication_protected_items = ReplicationProtectedItemsOperations( + self.replication_network_mappings = ReplicationNetworkMappingsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.recovery_points = RecoveryPointsOperations(self._client, self._config, self._serialize, self._deserialize) - self.target_compute_sizes = TargetComputeSizesOperations( + self.replication_protection_containers = ReplicationProtectionContainersOperations( self._client, self._config, self._serialize, self._deserialize ) - self.replication_protection_clusters = ReplicationProtectionClustersOperations( + self.replication_migration_items = ReplicationMigrationItemsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.cluster_recovery_points = ClusterRecoveryPointsOperations( + self.replication_protectable_items = ReplicationProtectableItemsOperations( self._client, self._config, self._serialize, self._deserialize ) self.cluster_recovery_point = ClusterRecoveryPointOperations( @@ -287,29 +294,30 @@ def __init__( self.replication_policies = ReplicationPoliciesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.replication_protection_intents = ReplicationProtectionIntentsOperations( + self.replication_recovery_plans = ReplicationRecoveryPlansOperations( self._client, self._config, self._serialize, self._deserialize ) - self.replication_recovery_plans = ReplicationRecoveryPlansOperations( + self.replication_vault_setting = ReplicationVaultSettingOperations( self._client, self._config, self._serialize, self._deserialize ) - self.supported_operating_systems = SupportedOperatingSystemsOperations( + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.replication_appliances = ReplicationAppliancesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.replication_vault_health = ReplicationVaultHealthOperations( + self.supported_operating_systems = SupportedOperatingSystemsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.replication_vault_setting = ReplicationVaultSettingOperations( + self.replication_vault_health = ReplicationVaultHealthOperations( 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 @@ -322,7 +330,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/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/_configuration.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/_configuration.py index af9d7dc8c6e7..4ec2c169be71 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/_configuration.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/_configuration.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. # -------------------------------------------------------------------------- -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy @@ -14,6 +14,7 @@ from ._version import VERSION if TYPE_CHECKING: + from azure.core import AzureClouds from azure.core.credentials import TokenCredential @@ -23,17 +24,18 @@ class SiteRecoveryManagementClientConfiguration: # pylint: disable=too-many-ins 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 subscription Id. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :param resource_group_name: The name of the resource group where the recovery services vault is - present. Required. - :type resource_group_name: str - :param resource_name: The name of the recovery services vault. Required. - :type resource_name: str - :keyword api_version: Api Version. Default value is "2025-01-01". Note that overriding this - default value may result in unsupported behavior. + :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: The API version to use for this operation. Known values are "2025-08-01". + Default value is "2025-08-01". Note that overriding this default value may result in + unsupported behavior. :paramtype api_version: str """ @@ -41,25 +43,21 @@ def __init__( self, credential: "TokenCredential", subscription_id: str, - resource_group_name: str, - resource_name: str, + base_url: str = "https://management.azure.com", + cloud_setting: Optional["AzureClouds"] = None, **kwargs: Any ) -> None: - api_version: str = kwargs.pop("api_version", "2025-01-01") + api_version: str = kwargs.pop("api_version", "2025-08-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - if resource_group_name is None: - raise ValueError("Parameter 'resource_group_name' must not be None.") - if resource_name is None: - raise ValueError("Parameter 'resource_name' must not be None.") self.credential = credential self.subscription_id = subscription_id - self.resource_group_name = resource_group_name - self.resource_name = resource_name + 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"]) kwargs.setdefault("sdk_moniker", "mgmt-recoveryservicessiterecovery/{}".format(VERSION)) diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/_patch.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/_patch.py index f7dd32510333..87676c65a8f0 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/_patch.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/_patch.py @@ -1,14 +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/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/_utils/__init__.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/_utils/__init__.py new file mode 100644 index 000000000000..8026245c2abc --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/_utils/__init__.py @@ -0,0 +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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/_utils/model_base.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/_utils/model_base.py new file mode 100644 index 000000000000..db24930fdca9 --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/_utils/model_base.py @@ -0,0 +1,1441 @@ +# 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 +from typing_extensions import Self +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 + +_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_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_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, +} + + +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 _timedelta_as_isostr(o) + 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) + + +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 = { + rest_field._rest_name: rest_field._default + for rest_field in self._attr_to_rest_field.values() + if rest_field._default is not _UNSET + } + 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 + } + ) + super().__init__(dict_to_pass) + + def _init_from_xml(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] = {} + model_meta = getattr(self, "_xml", {}) + existed_attr_keys: list[str] = [] + + 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): + # unwrapped array could either use prop items meta/prop meta + _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, it should only have one element + 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()) + 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, + ): + 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 {} + + @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) + 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) + + 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, +) -> typing.Any: + return _RestField( + name=name, + type=type, + visibility=visibility, + default=default, + format=format, + is_multipart_file_input=is_multipart_file_input, + xml=xml, + ) + + +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 + 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/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/_serialization.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/_utils/serialization.py similarity index 98% rename from sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/_serialization.py rename to sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/_utils/serialization.py index f5187701d7be..81ec1de5922b 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/_serialization.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/_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. # -------------------------------------------------------------------------- @@ -21,7 +21,6 @@ import sys import codecs from typing import ( - Dict, Any, cast, Optional, @@ -31,7 +30,6 @@ Mapping, Callable, MutableMapping, - List, ) try: @@ -229,12 +227,12 @@ class Model: serialization and deserialization. """ - _subtype_map: Dict[str, Dict[str, Any]] = {} - _attribute_map: Dict[str, Dict[str, Any]] = {} - _validation: Dict[str, Dict[str, Any]] = {} + _subtype_map: dict[str, dict[str, Any]] = {} + _attribute_map: dict[str, dict[str, Any]] = {} + _validation: dict[str, dict[str, Any]] = {} def __init__(self, **kwargs: Any) -> None: - self.additional_properties: Optional[Dict[str, Any]] = {} + self.additional_properties: Optional[dict[str, Any]] = {} for k in kwargs: # pylint: disable=consider-using-dict-items if k not in self._attribute_map: _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) @@ -311,7 +309,7 @@ def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: def as_dict( self, keep_readonly: bool = True, - key_transformer: Callable[[str, Dict[str, Any], Any], Any] = attribute_transformer, + key_transformer: Callable[[str, dict[str, Any], Any], Any] = attribute_transformer, **kwargs: Any ) -> JSON: """Return a dict that can be serialized using json.dump. @@ -380,7 +378,7 @@ def deserialize(cls, data: Any, content_type: Optional[str] = None) -> Self: def from_dict( cls, data: Any, - key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, + key_extractors: Optional[Callable[[str, dict[str, Any], Any], Any]] = None, content_type: Optional[str] = None, ) -> Self: """Parse a dict using given key extractor return a model. @@ -414,7 +412,7 @@ def _flatten_subtype(cls, key, objects): return {} result = dict(cls._subtype_map[key]) for valuetype in cls._subtype_map[key].values(): - result.update(objects[valuetype]._flatten_subtype(key, objects)) # pylint: disable=protected-access + result |= objects[valuetype]._flatten_subtype(key, objects) # pylint: disable=protected-access return result @classmethod @@ -528,7 +526,7 @@ def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies: Dict[str, type] = dict(classes) if classes else {} + self.dependencies: dict[str, type] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -579,7 +577,7 @@ def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, to if attr_name == "additional_properties" and attr_desc["key"] == "": if target_obj.additional_properties is not None: - serialized.update(target_obj.additional_properties) + serialized |= target_obj.additional_properties continue try: @@ -789,7 +787,7 @@ def serialize_data(self, data, data_type, **kwargs): # If dependencies is empty, try with current data class # It has to be a subclass of Enum anyway - enum_type = self.dependencies.get(data_type, data.__class__) + enum_type = self.dependencies.get(data_type, cast(type, data.__class__)) if issubclass(enum_type, Enum): return Serializer.serialize_enum(data, enum_obj=enum_type) @@ -823,13 +821,20 @@ def serialize_basic(cls, data, data_type, **kwargs): :param str data_type: Type of object in the iterable. :rtype: str, int, float, bool :return: serialized object + :raises TypeError: raise if data_type is not one of str, int, float, bool. """ custom_serializer = cls._get_custom_serializers(data_type, **kwargs) if custom_serializer: return custom_serializer(data) if data_type == "str": return cls.serialize_unicode(data) - return eval(data_type)(data) # nosec # pylint: disable=eval-used + if data_type == "int": + return int(data) + if data_type == "float": + return float(data) + if data_type == "bool": + return bool(data) + raise TypeError("Unknown basic data type: {}".format(data_type)) @classmethod def serialize_unicode(cls, data): @@ -1184,7 +1189,7 @@ def rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argumen while "." in key: # Need the cast, as for some reasons "split" is typed as list[str | Any] - dict_keys = cast(List[str], _FLATTEN.split(key)) + dict_keys = cast(list[str], _FLATTEN.split(key)) if len(dict_keys) == 1: key = _decode_attribute_map_key(dict_keys[0]) break @@ -1386,7 +1391,7 @@ def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies: Dict[str, type] = dict(classes) if classes else {} + self.dependencies: dict[str, type] = dict(classes) if classes else {} self.key_extractors = [rest_key_extractor, xml_key_extractor] # Additional properties only works if the "rest_key_extractor" is used to # extract the keys. Making it to work whatever the key extractor is too much @@ -1759,7 +1764,7 @@ def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return :param str data_type: deserialization data type. :return: Deserialized basic type. :rtype: str, int, float or bool - :raises TypeError: if string format is not valid. + :raises TypeError: if string format is not valid or data_type is not one of str, int, float, bool. """ # If we're here, data is supposed to be a basic type. # If it's still an XML node, take the text @@ -1785,7 +1790,11 @@ def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return if data_type == "str": return self.deserialize_unicode(attr) - return eval(data_type)(attr) # nosec # pylint: disable=eval-used + if data_type == "int": + return int(attr) + if data_type == "float": + return float(attr) + raise TypeError("Unknown basic data type: {}".format(data_type)) @staticmethod def deserialize_unicode(data): diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/_version.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/_version.py index bd1665239c5a..0e00a6283246 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/_version.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/_version.py @@ -2,8 +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.3.0" +VERSION = "2.0.0b1" diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/__init__.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/__init__.py index abc9bca4dd51..0e4a7bb33e6f 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/__init__.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/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 ._site_recovery_management_client import SiteRecoveryManagementClient # type: ignore +from ._client import SiteRecoveryManagementClient # type: ignore try: from ._patch import __all__ as _patch_all diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/_site_recovery_management_client.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/_client.py similarity index 89% rename from sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/_site_recovery_management_client.py rename to sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/_client.py index 5abb4db833e2..8283cbdc2bae 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/_site_recovery_management_client.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/_client.py @@ -2,21 +2,22 @@ # -------------------------------------------------------------------------- # 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 -from typing import Any, Awaitable, TYPE_CHECKING +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 +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints -from .. import models as _models -from .._serialization import Deserializer, Serializer +from .._utils.serialization import Deserializer, Serializer from ._configuration import SiteRecoveryManagementClientConfiguration from .operations import ( ClusterRecoveryPointOperations, @@ -53,20 +54,37 @@ ) if TYPE_CHECKING: + from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential class SiteRecoveryManagementClient: # pylint: disable=too-many-instance-attributes - """SiteRecoveryManagementClient. + """Open API for RecoveryServicesSiteRecovery. - :ivar operations: Operations operations - :vartype operations: azure.mgmt.recoveryservicessiterecovery.aio.operations.Operations + :ivar migration_recovery_points: MigrationRecoveryPointsOperations operations + :vartype migration_recovery_points: + azure.mgmt.recoveryservicessiterecovery.aio.operations.MigrationRecoveryPointsOperations + :ivar replication_protected_items: ReplicationProtectedItemsOperations operations + :vartype replication_protected_items: + azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationProtectedItemsOperations + :ivar target_compute_sizes: TargetComputeSizesOperations operations + :vartype target_compute_sizes: + azure.mgmt.recoveryservicessiterecovery.aio.operations.TargetComputeSizesOperations + :ivar recovery_points: RecoveryPointsOperations operations + :vartype recovery_points: + azure.mgmt.recoveryservicessiterecovery.aio.operations.RecoveryPointsOperations + :ivar replication_protection_clusters: ReplicationProtectionClustersOperations operations + :vartype replication_protection_clusters: + azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationProtectionClustersOperations + :ivar cluster_recovery_points: ClusterRecoveryPointsOperations operations + :vartype cluster_recovery_points: + azure.mgmt.recoveryservicessiterecovery.aio.operations.ClusterRecoveryPointsOperations + :ivar replication_protection_intents: ReplicationProtectionIntentsOperations operations + :vartype replication_protection_intents: + azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationProtectionIntentsOperations :ivar replication_alert_settings: ReplicationAlertSettingsOperations operations :vartype replication_alert_settings: azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationAlertSettingsOperations - :ivar replication_appliances: ReplicationAppliancesOperations operations - :vartype replication_appliances: - azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationAppliancesOperations :ivar replication_eligibility_results: ReplicationEligibilityResultsOperations operations :vartype replication_eligibility_results: azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationEligibilityResultsOperations @@ -91,27 +109,9 @@ class SiteRecoveryManagementClient: # pylint: disable=too-many-instance-attribu :ivar replication_migration_items: ReplicationMigrationItemsOperations operations :vartype replication_migration_items: azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationMigrationItemsOperations - :ivar migration_recovery_points: MigrationRecoveryPointsOperations operations - :vartype migration_recovery_points: - azure.mgmt.recoveryservicessiterecovery.aio.operations.MigrationRecoveryPointsOperations :ivar replication_protectable_items: ReplicationProtectableItemsOperations operations :vartype replication_protectable_items: azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationProtectableItemsOperations - :ivar replication_protected_items: ReplicationProtectedItemsOperations operations - :vartype replication_protected_items: - azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationProtectedItemsOperations - :ivar recovery_points: RecoveryPointsOperations operations - :vartype recovery_points: - azure.mgmt.recoveryservicessiterecovery.aio.operations.RecoveryPointsOperations - :ivar target_compute_sizes: TargetComputeSizesOperations operations - :vartype target_compute_sizes: - azure.mgmt.recoveryservicessiterecovery.aio.operations.TargetComputeSizesOperations - :ivar replication_protection_clusters: ReplicationProtectionClustersOperations operations - :vartype replication_protection_clusters: - azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationProtectionClustersOperations - :ivar cluster_recovery_points: ClusterRecoveryPointsOperations operations - :vartype cluster_recovery_points: - azure.mgmt.recoveryservicessiterecovery.aio.operations.ClusterRecoveryPointsOperations :ivar cluster_recovery_point: ClusterRecoveryPointOperations operations :vartype cluster_recovery_point: azure.mgmt.recoveryservicessiterecovery.aio.operations.ClusterRecoveryPointOperations @@ -140,34 +140,35 @@ class SiteRecoveryManagementClient: # pylint: disable=too-many-instance-attribu :ivar replication_policies: ReplicationPoliciesOperations operations :vartype replication_policies: azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationPoliciesOperations - :ivar replication_protection_intents: ReplicationProtectionIntentsOperations operations - :vartype replication_protection_intents: - azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationProtectionIntentsOperations :ivar replication_recovery_plans: ReplicationRecoveryPlansOperations operations :vartype replication_recovery_plans: azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationRecoveryPlansOperations + :ivar replication_vault_setting: ReplicationVaultSettingOperations operations + :vartype replication_vault_setting: + azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationVaultSettingOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.recoveryservicessiterecovery.aio.operations.Operations + :ivar replication_appliances: ReplicationAppliancesOperations operations + :vartype replication_appliances: + azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationAppliancesOperations :ivar supported_operating_systems: SupportedOperatingSystemsOperations operations :vartype supported_operating_systems: azure.mgmt.recoveryservicessiterecovery.aio.operations.SupportedOperatingSystemsOperations :ivar replication_vault_health: ReplicationVaultHealthOperations operations :vartype replication_vault_health: azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationVaultHealthOperations - :ivar replication_vault_setting: ReplicationVaultSettingOperations operations - :vartype replication_vault_setting: - azure.mgmt.recoveryservicessiterecovery.aio.operations.ReplicationVaultSettingOperations - :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 subscription Id. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :param resource_group_name: The name of the resource group where the recovery services vault is - present. Required. - :type resource_group_name: str - :param resource_name: The name of the recovery services vault. Required. - :type resource_name: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service host. Default value is None. :type base_url: str - :keyword api_version: Api Version. Default value is "2025-01-01". Note that overriding this - default value may result in unsupported behavior. + :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: The API version to use for this operation. Known values are "2025-08-01". + Default value is "2025-08-01". 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. @@ -177,18 +178,26 @@ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - resource_group_name: str, - resource_name: str, - base_url: str = "https://management.azure.com", + base_url: Optional[str] = None, + *, + 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 = SiteRecoveryManagementClientConfiguration( credential=credential, subscription_id=subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, + base_url=cast(str, base_url), + cloud_setting=cloud_setting, + credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -207,60 +216,60 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + 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.replication_alert_settings = ReplicationAlertSettingsOperations( + self.migration_recovery_points = MigrationRecoveryPointsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.replication_appliances = ReplicationAppliancesOperations( + self.replication_protected_items = ReplicationProtectedItemsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.replication_eligibility_results = ReplicationEligibilityResultsOperations( + self.target_compute_sizes = TargetComputeSizesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.replication_events = ReplicationEventsOperations( + self.recovery_points = RecoveryPointsOperations(self._client, self._config, self._serialize, self._deserialize) + self.replication_protection_clusters = ReplicationProtectionClustersOperations( self._client, self._config, self._serialize, self._deserialize ) - self.replication_fabrics = ReplicationFabricsOperations( + self.cluster_recovery_points = ClusterRecoveryPointsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.replication_logical_networks = ReplicationLogicalNetworksOperations( + self.replication_protection_intents = ReplicationProtectionIntentsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.replication_networks = ReplicationNetworksOperations( + self.replication_alert_settings = ReplicationAlertSettingsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.replication_network_mappings = ReplicationNetworkMappingsOperations( + self.replication_eligibility_results = ReplicationEligibilityResultsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.replication_protection_containers = ReplicationProtectionContainersOperations( + self.replication_events = ReplicationEventsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.replication_migration_items = ReplicationMigrationItemsOperations( + self.replication_fabrics = ReplicationFabricsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.migration_recovery_points = MigrationRecoveryPointsOperations( + self.replication_logical_networks = ReplicationLogicalNetworksOperations( self._client, self._config, self._serialize, self._deserialize ) - self.replication_protectable_items = ReplicationProtectableItemsOperations( + self.replication_networks = ReplicationNetworksOperations( self._client, self._config, self._serialize, self._deserialize ) - self.replication_protected_items = ReplicationProtectedItemsOperations( + self.replication_network_mappings = ReplicationNetworkMappingsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.recovery_points = RecoveryPointsOperations(self._client, self._config, self._serialize, self._deserialize) - self.target_compute_sizes = TargetComputeSizesOperations( + self.replication_protection_containers = ReplicationProtectionContainersOperations( self._client, self._config, self._serialize, self._deserialize ) - self.replication_protection_clusters = ReplicationProtectionClustersOperations( + self.replication_migration_items = ReplicationMigrationItemsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.cluster_recovery_points = ClusterRecoveryPointsOperations( + self.replication_protectable_items = ReplicationProtectableItemsOperations( self._client, self._config, self._serialize, self._deserialize ) self.cluster_recovery_point = ClusterRecoveryPointOperations( @@ -287,23 +296,24 @@ def __init__( self.replication_policies = ReplicationPoliciesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.replication_protection_intents = ReplicationProtectionIntentsOperations( + self.replication_recovery_plans = ReplicationRecoveryPlansOperations( self._client, self._config, self._serialize, self._deserialize ) - self.replication_recovery_plans = ReplicationRecoveryPlansOperations( + self.replication_vault_setting = ReplicationVaultSettingOperations( self._client, self._config, self._serialize, self._deserialize ) - self.supported_operating_systems = SupportedOperatingSystemsOperations( + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.replication_appliances = ReplicationAppliancesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.replication_vault_health = ReplicationVaultHealthOperations( + self.supported_operating_systems = SupportedOperatingSystemsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.replication_vault_setting = ReplicationVaultSettingOperations( + self.replication_vault_health = ReplicationVaultHealthOperations( 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. @@ -311,7 +321,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 @@ -324,7 +334,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/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/_configuration.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/_configuration.py index ddee2c01c94b..26795ca4978d 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/_configuration.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/_configuration.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. # -------------------------------------------------------------------------- -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy @@ -14,6 +14,7 @@ from .._version import VERSION if TYPE_CHECKING: + from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential @@ -23,17 +24,18 @@ class SiteRecoveryManagementClientConfiguration: # pylint: disable=too-many-ins 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 subscription Id. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :param resource_group_name: The name of the resource group where the recovery services vault is - present. Required. - :type resource_group_name: str - :param resource_name: The name of the recovery services vault. Required. - :type resource_name: str - :keyword api_version: Api Version. Default value is "2025-01-01". Note that overriding this - default value may result in unsupported behavior. + :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: The API version to use for this operation. Known values are "2025-08-01". + Default value is "2025-08-01". Note that overriding this default value may result in + unsupported behavior. :paramtype api_version: str """ @@ -41,25 +43,21 @@ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - resource_group_name: str, - resource_name: str, + base_url: str = "https://management.azure.com", + cloud_setting: Optional["AzureClouds"] = None, **kwargs: Any ) -> None: - api_version: str = kwargs.pop("api_version", "2025-01-01") + api_version: str = kwargs.pop("api_version", "2025-08-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - if resource_group_name is None: - raise ValueError("Parameter 'resource_group_name' must not be None.") - if resource_name is None: - raise ValueError("Parameter 'resource_name' must not be None.") self.credential = credential self.subscription_id = subscription_id - self.resource_group_name = resource_group_name - self.resource_name = resource_name + 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"]) kwargs.setdefault("sdk_moniker", "mgmt-recoveryservicessiterecovery/{}".format(VERSION)) diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/_patch.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/_patch.py index f7dd32510333..87676c65a8f0 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/_patch.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/_patch.py @@ -1,14 +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/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/__init__.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/__init__.py index f9d1125f15d2..3e6f6221aa66 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/__init__.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/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 @@ -13,46 +12,51 @@ if TYPE_CHECKING: from ._patch import * # pylint: disable=unused-wildcard-import +from ._operations import MigrationRecoveryPointsOperations # type: ignore +from ._operations import ReplicationProtectedItemsOperations # type: ignore +from ._operations import TargetComputeSizesOperations # type: ignore +from ._operations import RecoveryPointsOperations # type: ignore +from ._operations import ReplicationProtectionClustersOperations # type: ignore +from ._operations import ClusterRecoveryPointsOperations # type: ignore +from ._operations import ReplicationProtectionIntentsOperations # type: ignore +from ._operations import ReplicationAlertSettingsOperations # type: ignore +from ._operations import ReplicationEligibilityResultsOperations # type: ignore +from ._operations import ReplicationEventsOperations # type: ignore +from ._operations import ReplicationFabricsOperations # type: ignore +from ._operations import ReplicationLogicalNetworksOperations # type: ignore +from ._operations import ReplicationNetworksOperations # type: ignore +from ._operations import ReplicationNetworkMappingsOperations # type: ignore +from ._operations import ReplicationProtectionContainersOperations # type: ignore +from ._operations import ReplicationMigrationItemsOperations # type: ignore +from ._operations import ReplicationProtectableItemsOperations # type: ignore +from ._operations import ClusterRecoveryPointOperations # type: ignore +from ._operations import ReplicationProtectionContainerMappingsOperations # type: ignore +from ._operations import ReplicationRecoveryServicesProvidersOperations # type: ignore +from ._operations import ReplicationStorageClassificationsOperations # type: ignore +from ._operations import ReplicationStorageClassificationMappingsOperations # type: ignore +from ._operations import ReplicationvCentersOperations # type: ignore +from ._operations import ReplicationJobsOperations # type: ignore +from ._operations import ReplicationPoliciesOperations # type: ignore +from ._operations import ReplicationRecoveryPlansOperations # type: ignore +from ._operations import ReplicationVaultSettingOperations # type: ignore from ._operations import Operations # type: ignore -from ._replication_alert_settings_operations import ReplicationAlertSettingsOperations # type: ignore -from ._replication_appliances_operations import ReplicationAppliancesOperations # type: ignore -from ._replication_eligibility_results_operations import ReplicationEligibilityResultsOperations # type: ignore -from ._replication_events_operations import ReplicationEventsOperations # type: ignore -from ._replication_fabrics_operations import ReplicationFabricsOperations # type: ignore -from ._replication_logical_networks_operations import ReplicationLogicalNetworksOperations # type: ignore -from ._replication_networks_operations import ReplicationNetworksOperations # type: ignore -from ._replication_network_mappings_operations import ReplicationNetworkMappingsOperations # type: ignore -from ._replication_protection_containers_operations import ReplicationProtectionContainersOperations # type: ignore -from ._replication_migration_items_operations import ReplicationMigrationItemsOperations # type: ignore -from ._migration_recovery_points_operations import MigrationRecoveryPointsOperations # type: ignore -from ._replication_protectable_items_operations import ReplicationProtectableItemsOperations # type: ignore -from ._replication_protected_items_operations import ReplicationProtectedItemsOperations # type: ignore -from ._recovery_points_operations import RecoveryPointsOperations # type: ignore -from ._target_compute_sizes_operations import TargetComputeSizesOperations # type: ignore -from ._replication_protection_clusters_operations import ReplicationProtectionClustersOperations # type: ignore -from ._cluster_recovery_points_operations import ClusterRecoveryPointsOperations # type: ignore -from ._cluster_recovery_point_operations import ClusterRecoveryPointOperations # type: ignore -from ._replication_protection_container_mappings_operations import ReplicationProtectionContainerMappingsOperations # type: ignore -from ._replication_recovery_services_providers_operations import ReplicationRecoveryServicesProvidersOperations # type: ignore -from ._replication_storage_classifications_operations import ReplicationStorageClassificationsOperations # type: ignore -from ._replication_storage_classification_mappings_operations import ReplicationStorageClassificationMappingsOperations # type: ignore -from ._replicationv_centers_operations import ReplicationvCentersOperations # type: ignore -from ._replication_jobs_operations import ReplicationJobsOperations # type: ignore -from ._replication_policies_operations import ReplicationPoliciesOperations # type: ignore -from ._replication_protection_intents_operations import ReplicationProtectionIntentsOperations # type: ignore -from ._replication_recovery_plans_operations import ReplicationRecoveryPlansOperations # type: ignore -from ._supported_operating_systems_operations import SupportedOperatingSystemsOperations # type: ignore -from ._replication_vault_health_operations import ReplicationVaultHealthOperations # type: ignore -from ._replication_vault_setting_operations import ReplicationVaultSettingOperations # type: ignore +from ._operations import ReplicationAppliancesOperations # type: ignore +from ._operations import SupportedOperatingSystemsOperations # type: ignore +from ._operations import ReplicationVaultHealthOperations # type: ignore from ._patch import __all__ as _patch_all from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ - "Operations", + "MigrationRecoveryPointsOperations", + "ReplicationProtectedItemsOperations", + "TargetComputeSizesOperations", + "RecoveryPointsOperations", + "ReplicationProtectionClustersOperations", + "ClusterRecoveryPointsOperations", + "ReplicationProtectionIntentsOperations", "ReplicationAlertSettingsOperations", - "ReplicationAppliancesOperations", "ReplicationEligibilityResultsOperations", "ReplicationEventsOperations", "ReplicationFabricsOperations", @@ -61,13 +65,7 @@ "ReplicationNetworkMappingsOperations", "ReplicationProtectionContainersOperations", "ReplicationMigrationItemsOperations", - "MigrationRecoveryPointsOperations", "ReplicationProtectableItemsOperations", - "ReplicationProtectedItemsOperations", - "RecoveryPointsOperations", - "TargetComputeSizesOperations", - "ReplicationProtectionClustersOperations", - "ClusterRecoveryPointsOperations", "ClusterRecoveryPointOperations", "ReplicationProtectionContainerMappingsOperations", "ReplicationRecoveryServicesProvidersOperations", @@ -76,11 +74,12 @@ "ReplicationvCentersOperations", "ReplicationJobsOperations", "ReplicationPoliciesOperations", - "ReplicationProtectionIntentsOperations", "ReplicationRecoveryPlansOperations", + "ReplicationVaultSettingOperations", + "Operations", + "ReplicationAppliancesOperations", "SupportedOperatingSystemsOperations", "ReplicationVaultHealthOperations", - "ReplicationVaultSettingOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_cluster_recovery_point_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_cluster_recovery_point_operations.py deleted file mode 100644 index 1be250617118..000000000000 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_cluster_recovery_point_operations.py +++ /dev/null @@ -1,129 +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, Dict, 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 ..._serialization import Deserializer, Serializer -from ...operations._cluster_recovery_point_operations import build_get_request -from .._configuration import SiteRecoveryManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ClusterRecoveryPointOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicessiterecovery.aio.SiteRecoveryManagementClient`'s - :attr:`cluster_recovery_point` 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: SiteRecoveryManagementClientConfiguration = ( - 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_name: str, - fabric_name: str, - protection_container_name: str, - replication_protection_cluster_name: str, - recovery_point_name: str, - **kwargs: Any - ) -> _models.ClusterRecoveryPoint: - """Gets a recovery point. - - Get the details of specified recovery point. - - :param resource_name: The name of the recovery services vault. Required. - :type resource_name: str - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replication_protection_cluster_name: Replication protection cluster name. Required. - :type replication_protection_cluster_name: str - :param recovery_point_name: The recovery point name. Required. - :type recovery_point_name: str - :return: ClusterRecoveryPoint or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.ClusterRecoveryPoint - :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.ClusterRecoveryPoint] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_name=resource_name, - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replication_protection_cluster_name=replication_protection_cluster_name, - recovery_point_name=recovery_point_name, - resource_group_name=self._config.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) - - _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.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ClusterRecoveryPoint", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_cluster_recovery_points_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_cluster_recovery_points_operations.py deleted file mode 100644 index 572e0628b94e..000000000000 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_cluster_recovery_points_operations.py +++ /dev/null @@ -1,155 +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, AsyncIterable, Callable, Dict, 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.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._serialization import Deserializer, Serializer -from ...operations._cluster_recovery_points_operations import build_list_by_replication_protection_cluster_request -from .._configuration import SiteRecoveryManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ClusterRecoveryPointsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicessiterecovery.aio.SiteRecoveryManagementClient`'s - :attr:`cluster_recovery_points` 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: SiteRecoveryManagementClientConfiguration = ( - 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_replication_protection_cluster( - self, - resource_name: str, - fabric_name: str, - protection_container_name: str, - replication_protection_cluster_name: str, - **kwargs: Any - ) -> AsyncIterable["_models.ClusterRecoveryPoint"]: - """Gets the list of cluster recovery points. - - The list of cluster recovery points. - - :param resource_name: The name of the recovery services vault. Required. - :type resource_name: str - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replication_protection_cluster_name: Replication protection cluster name. Required. - :type replication_protection_cluster_name: str - :return: An iterator like instance of either ClusterRecoveryPoint or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.ClusterRecoveryPoint] - :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.ClusterRecoveryPointCollection] = 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_replication_protection_cluster_request( - resource_name=resource_name, - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replication_protection_cluster_name=replication_protection_cluster_name, - resource_group_name=self._config.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("ClusterRecoveryPointCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link 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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_migration_recovery_points_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_migration_recovery_points_operations.py deleted file mode 100644 index 45dfff8f845a..000000000000 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_migration_recovery_points_operations.py +++ /dev/null @@ -1,222 +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, AsyncIterable, Callable, Dict, 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 ..._serialization import Deserializer, Serializer -from ...operations._migration_recovery_points_operations import ( - build_get_request, - build_list_by_replication_migration_items_request, -) -from .._configuration import SiteRecoveryManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class MigrationRecoveryPointsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicessiterecovery.aio.SiteRecoveryManagementClient`'s - :attr:`migration_recovery_points` 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: SiteRecoveryManagementClientConfiguration = ( - 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_replication_migration_items( - self, fabric_name: str, protection_container_name: str, migration_item_name: str, **kwargs: Any - ) -> AsyncIterable["_models.MigrationRecoveryPoint"]: - """Gets the recovery points for a migration item. - - Gets the recovery points for a migration item. - - :param fabric_name: Fabric unique name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param migration_item_name: Migration item name. Required. - :type migration_item_name: str - :return: An iterator like instance of either MigrationRecoveryPoint or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.MigrationRecoveryPoint] - :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.MigrationRecoveryPointCollection] = 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_replication_migration_items_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - migration_item_name=migration_item_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("MigrationRecoveryPointCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, - fabric_name: str, - protection_container_name: str, - migration_item_name: str, - migration_recovery_point_name: str, - **kwargs: Any - ) -> _models.MigrationRecoveryPoint: - """Gets a recovery point for a migration item. - - Gets a recovery point for a migration item. - - :param fabric_name: Fabric unique name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param migration_item_name: Migration item name. Required. - :type migration_item_name: str - :param migration_recovery_point_name: The migration recovery point name. Required. - :type migration_recovery_point_name: str - :return: MigrationRecoveryPoint or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.MigrationRecoveryPoint - :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.MigrationRecoveryPoint] = kwargs.pop("cls", None) - - _request = build_get_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - migration_item_name=migration_item_name, - migration_recovery_point_name=migration_recovery_point_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("MigrationRecoveryPoint", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_operations.py index cf34fa57fec4..5cf2be80771b 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/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, AsyncIterable, Callable, Dict, 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,21 +20,26571 @@ 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 ..._serialization import Deserializer, Serializer -from ...operations._operations import build_list_request +from ..._utils.model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize +from ..._utils.serialization import Deserializer, Serializer +from ...operations._operations import ( + build_cluster_recovery_point_get_request, + build_cluster_recovery_points_list_by_replication_protection_cluster_request, + build_migration_recovery_points_get_request, + build_migration_recovery_points_list_by_replication_migration_items_request, + build_operations_list_request, + build_recovery_points_get_request, + build_recovery_points_list_by_replication_protected_items_request, + build_replication_alert_settings_create_request, + build_replication_alert_settings_get_request, + build_replication_alert_settings_list_request, + build_replication_appliances_list_request, + build_replication_eligibility_results_get_request, + build_replication_eligibility_results_list_request, + build_replication_events_get_request, + build_replication_events_list_request, + build_replication_fabrics_check_consistency_request, + build_replication_fabrics_create_request, + build_replication_fabrics_delete_request, + build_replication_fabrics_get_request, + build_replication_fabrics_list_request, + build_replication_fabrics_migrate_to_aad_request, + build_replication_fabrics_purge_request, + build_replication_fabrics_reassociate_gateway_request, + build_replication_fabrics_remove_infra_request, + build_replication_fabrics_renew_certificate_request, + build_replication_jobs_cancel_request, + build_replication_jobs_export_request, + build_replication_jobs_get_request, + build_replication_jobs_list_request, + build_replication_jobs_restart_request, + build_replication_jobs_resume_request, + build_replication_logical_networks_get_request, + build_replication_logical_networks_list_by_replication_fabrics_request, + build_replication_migration_items_create_request, + build_replication_migration_items_delete_request, + build_replication_migration_items_get_request, + build_replication_migration_items_list_by_replication_protection_containers_request, + build_replication_migration_items_list_request, + build_replication_migration_items_migrate_request, + build_replication_migration_items_pause_replication_request, + build_replication_migration_items_resume_replication_request, + build_replication_migration_items_resync_request, + build_replication_migration_items_test_migrate_cleanup_request, + build_replication_migration_items_test_migrate_request, + build_replication_migration_items_update_request, + build_replication_network_mappings_create_request, + build_replication_network_mappings_delete_request, + build_replication_network_mappings_get_request, + build_replication_network_mappings_list_by_replication_networks_request, + build_replication_network_mappings_list_request, + build_replication_network_mappings_update_request, + build_replication_networks_get_request, + build_replication_networks_list_by_replication_fabrics_request, + build_replication_networks_list_request, + build_replication_policies_create_request, + build_replication_policies_delete_request, + build_replication_policies_get_request, + build_replication_policies_list_request, + build_replication_policies_update_request, + build_replication_protectable_items_get_request, + build_replication_protectable_items_list_by_replication_protection_containers_request, + build_replication_protected_items_add_disks_request, + build_replication_protected_items_apply_recovery_point_request, + build_replication_protected_items_create_request, + build_replication_protected_items_delete_request, + build_replication_protected_items_failover_cancel_request, + build_replication_protected_items_failover_commit_request, + build_replication_protected_items_get_request, + build_replication_protected_items_list_by_replication_protection_containers_request, + build_replication_protected_items_list_request, + build_replication_protected_items_planned_failover_request, + build_replication_protected_items_purge_request, + build_replication_protected_items_reinstall_mobility_service_request, + build_replication_protected_items_remove_disks_request, + build_replication_protected_items_repair_replication_request, + build_replication_protected_items_reprotect_request, + build_replication_protected_items_resolve_health_errors_request, + build_replication_protected_items_switch_provider_request, + build_replication_protected_items_test_failover_cleanup_request, + build_replication_protected_items_test_failover_request, + build_replication_protected_items_unplanned_failover_request, + build_replication_protected_items_update_appliance_request, + build_replication_protected_items_update_mobility_service_request, + build_replication_protected_items_update_request, + build_replication_protection_clusters_apply_recovery_point_request, + build_replication_protection_clusters_create_request, + build_replication_protection_clusters_failover_commit_request, + build_replication_protection_clusters_get_operation_results_request, + build_replication_protection_clusters_get_request, + build_replication_protection_clusters_list_by_replication_protection_containers_request, + build_replication_protection_clusters_list_request, + build_replication_protection_clusters_purge_request, + build_replication_protection_clusters_repair_replication_request, + build_replication_protection_clusters_test_failover_cleanup_request, + build_replication_protection_clusters_test_failover_request, + build_replication_protection_clusters_unplanned_failover_request, + build_replication_protection_container_mappings_create_request, + build_replication_protection_container_mappings_delete_request, + build_replication_protection_container_mappings_get_request, + build_replication_protection_container_mappings_list_by_replication_protection_containers_request, + build_replication_protection_container_mappings_list_request, + build_replication_protection_container_mappings_purge_request, + build_replication_protection_container_mappings_update_request, + build_replication_protection_containers_create_request, + build_replication_protection_containers_delete_request, + build_replication_protection_containers_discover_protectable_item_request, + build_replication_protection_containers_get_request, + build_replication_protection_containers_list_by_replication_fabrics_request, + build_replication_protection_containers_list_request, + build_replication_protection_containers_switch_cluster_protection_request, + build_replication_protection_containers_switch_protection_request, + build_replication_protection_intents_create_request, + build_replication_protection_intents_get_request, + build_replication_protection_intents_list_request, + build_replication_recovery_plans_create_request, + build_replication_recovery_plans_delete_request, + build_replication_recovery_plans_failover_cancel_request, + build_replication_recovery_plans_failover_commit_request, + build_replication_recovery_plans_get_request, + build_replication_recovery_plans_list_request, + build_replication_recovery_plans_planned_failover_request, + build_replication_recovery_plans_reprotect_request, + build_replication_recovery_plans_test_failover_cleanup_request, + build_replication_recovery_plans_test_failover_request, + build_replication_recovery_plans_unplanned_failover_request, + build_replication_recovery_plans_update_request, + build_replication_recovery_services_providers_create_request, + build_replication_recovery_services_providers_delete_request, + build_replication_recovery_services_providers_get_request, + build_replication_recovery_services_providers_list_by_replication_fabrics_request, + build_replication_recovery_services_providers_list_request, + build_replication_recovery_services_providers_purge_request, + build_replication_recovery_services_providers_refresh_provider_request, + build_replication_storage_classification_mappings_create_request, + build_replication_storage_classification_mappings_delete_request, + build_replication_storage_classification_mappings_get_request, + build_replication_storage_classification_mappings_list_by_replication_storage_classifications_request, + build_replication_storage_classification_mappings_list_request, + build_replication_storage_classifications_get_request, + build_replication_storage_classifications_list_by_replication_fabrics_request, + build_replication_storage_classifications_list_request, + build_replication_vault_health_get_request, + build_replication_vault_health_refresh_request, + build_replication_vault_setting_create_request, + build_replication_vault_setting_get_request, + build_replication_vault_setting_list_request, + build_replicationv_centers_create_request, + build_replicationv_centers_delete_request, + build_replicationv_centers_get_request, + build_replicationv_centers_list_by_replication_fabrics_request, + build_replicationv_centers_list_request, + build_replicationv_centers_update_request, + build_supported_operating_systems_get_request, + build_target_compute_sizes_list_by_replication_protected_items_request, +) from .._configuration import SiteRecoveryManagementClientConfiguration -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +JSON = MutableMapping[str, Any] +List = list + + +class MigrationRecoveryPointsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.aio.SiteRecoveryManagementClient`'s + :attr:`migration_recovery_points` 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: SiteRecoveryManagementClientConfiguration = ( + 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, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + migration_recovery_point_name: str, + **kwargs: Any + ) -> _models.MigrationRecoveryPoint: + """Gets a recovery point for a migration item. + + Gets a recovery point for a migration item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param migration_recovery_point_name: The migration recovery point name. Required. + :type migration_recovery_point_name: str + :return: MigrationRecoveryPoint. The MigrationRecoveryPoint is compatible with MutableMapping + :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.MigrationRecoveryPoint + :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.MigrationRecoveryPoint] = kwargs.pop("cls", None) + + _request = build_migration_recovery_points_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + migration_item_name=migration_item_name, + migration_recovery_point_name=migration_recovery_point_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.MigrationRecoveryPoint, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_replication_migration_items( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + **kwargs: Any + ) -> AsyncItemPaged["_models.MigrationRecoveryPoint"]: + """Gets the recovery points for a migration item. + + Gets the recovery points for a migration item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :return: An iterator like instance of MigrationRecoveryPoint + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.MigrationRecoveryPoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.MigrationRecoveryPoint]] = 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_migration_recovery_points_list_by_replication_migration_items_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + migration_item_name=migration_item_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), 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.MigrationRecoveryPoint], + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class ReplicationProtectedItemsOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.aio.SiteRecoveryManagementClient`'s + :attr:`replication_protected_items` 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: SiteRecoveryManagementClientConfiguration = ( + 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, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + **kwargs: Any + ) -> _models.ReplicationProtectedItem: + """Gets the details of a Replication protected item. + + Gets the details of an ASR replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :return: ReplicationProtectedItem. The ReplicationProtectedItem is compatible with + MutableMapping + :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem + :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.ReplicationProtectedItem] = kwargs.pop("cls", None) + + _request = build_replication_protected_items_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ReplicationProtectedItem, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + input: Union[_models.EnableProtectionInput, JSON, 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(input, (IOBase, bytes)): + _content = input + else: + _content = json.dumps(input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_protected_items_create_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_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) + raise HttpResponseError(response=response, 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")) + + 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, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + input: _models.EnableProtectionInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Enables protection. + + The operation to create an ASR replication protected item (Enable replication). + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param input: Enable Protection Input. Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.EnableProtectionInput + :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 ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Enables protection. + + The operation to create an ASR replication protected item (Enable replication). + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param input: Enable Protection Input. Required. + :type input: JSON + :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 ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Enables protection. + + The operation to create an ASR replication protected item (Enable replication). + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param input: Enable Protection Input. Required. + :type input: 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 ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + input: Union[_models.EnableProtectionInput, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Enables protection. + + The operation to create an ASR replication protected item (Enable replication). + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param input: Enable Protection Input. Is one of the following types: EnableProtectionInput, + JSON, IO[bytes] Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.EnableProtectionInput or JSON or + IO[bytes] + :return: An instance of AsyncLROPoller that returns ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :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.ReplicationProtectedItem] = 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, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_name, + input=input, + 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.ReplicationProtectedItem, 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.ReplicationProtectedItem].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ReplicationProtectedItem]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _update_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + update_protection_input: Union[_models.UpdateReplicationProtectedItemInput, JSON, 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(update_protection_input, (IOBase, bytes)): + _content = update_protection_input + else: + _content = json.dumps(update_protection_input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_protected_items_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_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) + raise HttpResponseError(response=response, 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")) + + 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, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + update_protection_input: _models.UpdateReplicationProtectedItemInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Updates the replication protected item settings. + + The operation to update the recovery settings of an ASR replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param update_protection_input: Update protection input. Required. + :type update_protection_input: + ~azure.mgmt.recoveryservicessiterecovery.models.UpdateReplicationProtectedItemInput + :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 ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + update_protection_input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Updates the replication protected item settings. + + The operation to update the recovery settings of an ASR replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param update_protection_input: Update protection input. Required. + :type update_protection_input: JSON + :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 ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + update_protection_input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Updates the replication protected item settings. + + The operation to update the recovery settings of an ASR replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param update_protection_input: Update protection input. Required. + :type update_protection_input: 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 ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + update_protection_input: Union[_models.UpdateReplicationProtectedItemInput, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Updates the replication protected item settings. + + The operation to update the recovery settings of an ASR replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param update_protection_input: Update protection input. Is one of the following types: + UpdateReplicationProtectedItemInput, JSON, IO[bytes] Required. + :type update_protection_input: + ~azure.mgmt.recoveryservicessiterecovery.models.UpdateReplicationProtectedItemInput or JSON or + IO[bytes] + :return: An instance of AsyncLROPoller that returns ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :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.ReplicationProtectedItem] = 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, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_name, + update_protection_input=update_protection_input, + 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.ReplicationProtectedItem, 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.ReplicationProtectedItem].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ReplicationProtectedItem]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _purge_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_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_replication_protected_items_purge_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_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 [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) + raise HttpResponseError(response=response, 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")) + + 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_purge( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Purges protection. + + The operation to delete or purge a replication protected item. This operation will force delete + the replication protected item. Use the remove operation on replication protected item to + perform a clean disable replication for the item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_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._purge_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_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_replication_protection_containers( # pylint: disable=name-too-long + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + **kwargs: Any + ) -> AsyncItemPaged["_models.ReplicationProtectedItem"]: + """Gets the list of Replication protected items. + + Gets the list of ASR replication protected items in the protection container. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :return: An iterator like instance of ReplicationProtectedItem + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ReplicationProtectedItem]] = 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_replication_protected_items_list_by_replication_protection_containers_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_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), 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.ReplicationProtectedItem], + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + async def _add_disks_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + add_disks_input: Union[_models.AddDisksInput, JSON, 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(add_disks_input, (IOBase, bytes)): + _content = add_disks_input + else: + _content = json.dumps(add_disks_input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_protected_items_add_disks_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_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) + raise HttpResponseError(response=response, 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")) + + 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_add_disks( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + add_disks_input: _models.AddDisksInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Add disk(s) for protection. + + Operation to add disks(s) to the replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param add_disks_input: Add disks input. Required. + :type add_disks_input: ~azure.mgmt.recoveryservicessiterecovery.models.AddDisksInput + :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 ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_add_disks( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + add_disks_input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Add disk(s) for protection. + + Operation to add disks(s) to the replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param add_disks_input: Add disks input. Required. + :type add_disks_input: JSON + :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 ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_add_disks( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + add_disks_input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Add disk(s) for protection. + + Operation to add disks(s) to the replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param add_disks_input: Add disks input. Required. + :type add_disks_input: 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 ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_add_disks( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + add_disks_input: Union[_models.AddDisksInput, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Add disk(s) for protection. + + Operation to add disks(s) to the replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param add_disks_input: Add disks input. Is one of the following types: AddDisksInput, JSON, + IO[bytes] Required. + :type add_disks_input: ~azure.mgmt.recoveryservicessiterecovery.models.AddDisksInput or JSON or + IO[bytes] + :return: An instance of AsyncLROPoller that returns ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :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.ReplicationProtectedItem] = 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._add_disks_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_name, + add_disks_input=add_disks_input, + 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.ReplicationProtectedItem, 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.ReplicationProtectedItem].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ReplicationProtectedItem]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _apply_recovery_point_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + apply_recovery_point_input: Union[_models.ApplyRecoveryPointInput, JSON, 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(apply_recovery_point_input, (IOBase, bytes)): + _content = apply_recovery_point_input + else: + _content = json.dumps(apply_recovery_point_input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_protected_items_apply_recovery_point_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_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) + raise HttpResponseError(response=response, 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")) + + 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_apply_recovery_point( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + apply_recovery_point_input: _models.ApplyRecoveryPointInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Change or apply recovery point. + + The operation to change the recovery point of a failed over replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param apply_recovery_point_input: The ApplyRecoveryPointInput. Required. + :type apply_recovery_point_input: + ~azure.mgmt.recoveryservicessiterecovery.models.ApplyRecoveryPointInput + :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 ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_apply_recovery_point( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + apply_recovery_point_input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Change or apply recovery point. + + The operation to change the recovery point of a failed over replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param apply_recovery_point_input: The ApplyRecoveryPointInput. Required. + :type apply_recovery_point_input: JSON + :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 ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_apply_recovery_point( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + apply_recovery_point_input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Change or apply recovery point. + + The operation to change the recovery point of a failed over replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param apply_recovery_point_input: The ApplyRecoveryPointInput. Required. + :type apply_recovery_point_input: 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 ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_apply_recovery_point( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + apply_recovery_point_input: Union[_models.ApplyRecoveryPointInput, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Change or apply recovery point. + + The operation to change the recovery point of a failed over replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param apply_recovery_point_input: The ApplyRecoveryPointInput. Is one of the following types: + ApplyRecoveryPointInput, JSON, IO[bytes] Required. + :type apply_recovery_point_input: + ~azure.mgmt.recoveryservicessiterecovery.models.ApplyRecoveryPointInput or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :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.ReplicationProtectedItem] = 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._apply_recovery_point_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_name, + apply_recovery_point_input=apply_recovery_point_input, + 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.ReplicationProtectedItem, 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.ReplicationProtectedItem].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ReplicationProtectedItem]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _failover_cancel_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_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_replication_protected_items_failover_cancel_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_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) + raise HttpResponseError(response=response, 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")) + + 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_failover_cancel( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Execute cancel failover. + + Operation to cancel the failover of the replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :return: An instance of AsyncLROPoller that returns ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ReplicationProtectedItem] = 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._failover_cancel_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.ReplicationProtectedItem, 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.ReplicationProtectedItem].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ReplicationProtectedItem]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _failover_commit_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_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_replication_protected_items_failover_commit_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_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) + raise HttpResponseError(response=response, 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")) + + 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_failover_commit( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Execute commit failover. + + Operation to commit the failover of the replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :return: An instance of AsyncLROPoller that returns ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ReplicationProtectedItem] = 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._failover_commit_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.ReplicationProtectedItem, 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.ReplicationProtectedItem].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ReplicationProtectedItem]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _planned_failover_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + failover_input: Union[_models.PlannedFailoverInput, JSON, 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(failover_input, (IOBase, bytes)): + _content = failover_input + else: + _content = json.dumps(failover_input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_protected_items_planned_failover_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_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) + raise HttpResponseError(response=response, 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")) + + 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_planned_failover( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + failover_input: _models.PlannedFailoverInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Execute planned failover. + + Operation to initiate a planned failover of the replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param failover_input: Planned failover input. Required. + :type failover_input: ~azure.mgmt.recoveryservicessiterecovery.models.PlannedFailoverInput + :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 ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_planned_failover( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + failover_input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Execute planned failover. + + Operation to initiate a planned failover of the replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param failover_input: Planned failover input. Required. + :type failover_input: JSON + :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 ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_planned_failover( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + failover_input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Execute planned failover. + + Operation to initiate a planned failover of the replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param failover_input: Planned failover input. Required. + :type failover_input: 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 ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_planned_failover( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + failover_input: Union[_models.PlannedFailoverInput, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Execute planned failover. + + Operation to initiate a planned failover of the replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param failover_input: Planned failover input. Is one of the following types: + PlannedFailoverInput, JSON, IO[bytes] Required. + :type failover_input: ~azure.mgmt.recoveryservicessiterecovery.models.PlannedFailoverInput or + JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :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.ReplicationProtectedItem] = 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._planned_failover_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_name, + failover_input=failover_input, + 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.ReplicationProtectedItem, 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.ReplicationProtectedItem].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ReplicationProtectedItem]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + disable_protection_input: Union[_models.DisableProtectionInput, JSON, 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(disable_protection_input, (IOBase, bytes)): + _content = disable_protection_input + else: + _content = json.dumps(disable_protection_input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_protected_items_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_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 [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) + raise HttpResponseError(response=response, 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")) + + 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_delete( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + disable_protection_input: _models.DisableProtectionInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Disables protection. + + The operation to disable replication on a replication protected item. This will also remove the + item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param disable_protection_input: Disable protection input. Required. + :type disable_protection_input: + ~azure.mgmt.recoveryservicessiterecovery.models.DisableProtectionInput + :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_delete( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + disable_protection_input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Disables protection. + + The operation to disable replication on a replication protected item. This will also remove the + item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param disable_protection_input: Disable protection input. Required. + :type disable_protection_input: JSON + :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_delete( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + disable_protection_input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Disables protection. + + The operation to disable replication on a replication protected item. This will also remove the + item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param disable_protection_input: Disable protection input. Required. + :type disable_protection_input: 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_delete( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + disable_protection_input: Union[_models.DisableProtectionInput, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Disables protection. + + The operation to disable replication on a replication protected item. This will also remove the + item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param disable_protection_input: Disable protection input. Is one of the following types: + DisableProtectionInput, JSON, IO[bytes] Required. + :type disable_protection_input: + ~azure.mgmt.recoveryservicessiterecovery.models.DisableProtectionInput or JSON 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._delete_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_name, + disable_protection_input=disable_protection_input, + 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 _remove_disks_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + remove_disks_input: Union[_models.RemoveDisksInput, JSON, 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(remove_disks_input, (IOBase, bytes)): + _content = remove_disks_input + else: + _content = json.dumps(remove_disks_input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_protected_items_remove_disks_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_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) + raise HttpResponseError(response=response, 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")) + + 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_remove_disks( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + remove_disks_input: _models.RemoveDisksInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Removes disk(s). + + Operation to remove disk(s) from the replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param remove_disks_input: Remove disks input. Required. + :type remove_disks_input: ~azure.mgmt.recoveryservicessiterecovery.models.RemoveDisksInput + :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 ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_remove_disks( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + remove_disks_input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Removes disk(s). + + Operation to remove disk(s) from the replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param remove_disks_input: Remove disks input. Required. + :type remove_disks_input: JSON + :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 ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_remove_disks( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + remove_disks_input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Removes disk(s). + + Operation to remove disk(s) from the replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param remove_disks_input: Remove disks input. Required. + :type remove_disks_input: 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 ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_remove_disks( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + remove_disks_input: Union[_models.RemoveDisksInput, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Removes disk(s). + + Operation to remove disk(s) from the replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param remove_disks_input: Remove disks input. Is one of the following types: RemoveDisksInput, + JSON, IO[bytes] Required. + :type remove_disks_input: ~azure.mgmt.recoveryservicessiterecovery.models.RemoveDisksInput or + JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :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.ReplicationProtectedItem] = 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._remove_disks_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_name, + remove_disks_input=remove_disks_input, + 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.ReplicationProtectedItem, 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.ReplicationProtectedItem].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ReplicationProtectedItem]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _repair_replication_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_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_replication_protected_items_repair_replication_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_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) + raise HttpResponseError(response=response, 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")) + + 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_repair_replication( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Resynchronize or repair replication. + + The operation to start resynchronize/repair replication for a replication protected item + requiring resynchronization. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :return: An instance of AsyncLROPoller that returns ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ReplicationProtectedItem] = 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._repair_replication_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.ReplicationProtectedItem, 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.ReplicationProtectedItem].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ReplicationProtectedItem]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _reprotect_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + reprotect_input: Union[_models.ReverseReplicationInput, JSON, 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(reprotect_input, (IOBase, bytes)): + _content = reprotect_input + else: + _content = json.dumps(reprotect_input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_protected_items_reprotect_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_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) + raise HttpResponseError(response=response, 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")) + + 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_reprotect( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + reprotect_input: _models.ReverseReplicationInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Execute Reverse Replication\\Reprotect. + + Operation to reprotect or reverse replicate a failed over replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param reprotect_input: Reverse replication input. Required. + :type reprotect_input: ~azure.mgmt.recoveryservicessiterecovery.models.ReverseReplicationInput + :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 ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reprotect( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + reprotect_input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Execute Reverse Replication\\Reprotect. + + Operation to reprotect or reverse replicate a failed over replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param reprotect_input: Reverse replication input. Required. + :type reprotect_input: JSON + :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 ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reprotect( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + reprotect_input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Execute Reverse Replication\\Reprotect. + + Operation to reprotect or reverse replicate a failed over replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param reprotect_input: Reverse replication input. Required. + :type reprotect_input: 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 ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_reprotect( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + reprotect_input: Union[_models.ReverseReplicationInput, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Execute Reverse Replication\\Reprotect. + + Operation to reprotect or reverse replicate a failed over replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param reprotect_input: Reverse replication input. Is one of the following types: + ReverseReplicationInput, JSON, IO[bytes] Required. + :type reprotect_input: ~azure.mgmt.recoveryservicessiterecovery.models.ReverseReplicationInput + or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :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.ReplicationProtectedItem] = 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._reprotect_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_name, + reprotect_input=reprotect_input, + 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.ReplicationProtectedItem, 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.ReplicationProtectedItem].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ReplicationProtectedItem]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _resolve_health_errors_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + resolve_health_input: Union[_models.ResolveHealthInput, JSON, 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(resolve_health_input, (IOBase, bytes)): + _content = resolve_health_input + else: + _content = json.dumps(resolve_health_input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_protected_items_resolve_health_errors_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_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) + raise HttpResponseError(response=response, 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")) + + 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_resolve_health_errors( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + resolve_health_input: _models.ResolveHealthInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Resolve health errors. + + Operation to resolve health issues of the replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param resolve_health_input: Health issue input object. Required. + :type resolve_health_input: ~azure.mgmt.recoveryservicessiterecovery.models.ResolveHealthInput + :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 ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_resolve_health_errors( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + resolve_health_input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Resolve health errors. + + Operation to resolve health issues of the replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param resolve_health_input: Health issue input object. Required. + :type resolve_health_input: JSON + :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 ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_resolve_health_errors( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + resolve_health_input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Resolve health errors. + + Operation to resolve health issues of the replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param resolve_health_input: Health issue input object. Required. + :type resolve_health_input: 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 ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_resolve_health_errors( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + resolve_health_input: Union[_models.ResolveHealthInput, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Resolve health errors. + + Operation to resolve health issues of the replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param resolve_health_input: Health issue input object. Is one of the following types: + ResolveHealthInput, JSON, IO[bytes] Required. + :type resolve_health_input: ~azure.mgmt.recoveryservicessiterecovery.models.ResolveHealthInput + or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :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.ReplicationProtectedItem] = 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._resolve_health_errors_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_name, + resolve_health_input=resolve_health_input, + 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.ReplicationProtectedItem, 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.ReplicationProtectedItem].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ReplicationProtectedItem]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _switch_provider_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + switch_provider_input: Union[_models.SwitchProviderInput, JSON, 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(switch_provider_input, (IOBase, bytes)): + _content = switch_provider_input + else: + _content = json.dumps(switch_provider_input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_protected_items_switch_provider_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + 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_switch_provider( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + switch_provider_input: _models.SwitchProviderInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Execute switch provider. + + Operation to initiate a switch provider of the replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param switch_provider_input: Switch provider input. Required. + :type switch_provider_input: + ~azure.mgmt.recoveryservicessiterecovery.models.SwitchProviderInput + :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 ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_switch_provider( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + switch_provider_input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Execute switch provider. + + Operation to initiate a switch provider of the replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param switch_provider_input: Switch provider input. Required. + :type switch_provider_input: JSON + :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 ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_switch_provider( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + switch_provider_input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Execute switch provider. + + Operation to initiate a switch provider of the replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param switch_provider_input: Switch provider input. Required. + :type switch_provider_input: 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 ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_switch_provider( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + switch_provider_input: Union[_models.SwitchProviderInput, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Execute switch provider. + + Operation to initiate a switch provider of the replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param switch_provider_input: Switch provider input. Is one of the following types: + SwitchProviderInput, JSON, IO[bytes] Required. + :type switch_provider_input: + ~azure.mgmt.recoveryservicessiterecovery.models.SwitchProviderInput or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :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.ReplicationProtectedItem] = 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._switch_provider_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_name, + switch_provider_input=switch_provider_input, + 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.ReplicationProtectedItem, 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.ReplicationProtectedItem].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ReplicationProtectedItem]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _test_failover_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + testfailover_input: Union[_models.TestFailoverInput, JSON, 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(testfailover_input, (IOBase, bytes)): + _content = testfailover_input + else: + _content = json.dumps(testfailover_input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_protected_items_test_failover_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_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) + raise HttpResponseError(response=response, 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")) + + 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_test_failover( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + testfailover_input: _models.TestFailoverInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Execute test failover. + + Operation to perform a test failover of the replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param testfailover_input: Test failover input. Required. + :type testfailover_input: ~azure.mgmt.recoveryservicessiterecovery.models.TestFailoverInput + :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 ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_test_failover( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + testfailover_input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Execute test failover. + + Operation to perform a test failover of the replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param testfailover_input: Test failover input. Required. + :type testfailover_input: JSON + :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 ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_test_failover( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + testfailover_input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Execute test failover. + + Operation to perform a test failover of the replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param testfailover_input: Test failover input. Required. + :type testfailover_input: 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 ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_test_failover( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + testfailover_input: Union[_models.TestFailoverInput, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Execute test failover. + + Operation to perform a test failover of the replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param testfailover_input: Test failover input. Is one of the following types: + TestFailoverInput, JSON, IO[bytes] Required. + :type testfailover_input: ~azure.mgmt.recoveryservicessiterecovery.models.TestFailoverInput or + JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :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.ReplicationProtectedItem] = 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._test_failover_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_name, + testfailover_input=testfailover_input, + 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.ReplicationProtectedItem, 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.ReplicationProtectedItem].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ReplicationProtectedItem]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _test_failover_cleanup_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + cleanup_input: Union[_models.TestFailoverCleanupInput, JSON, 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(cleanup_input, (IOBase, bytes)): + _content = cleanup_input + else: + _content = json.dumps(cleanup_input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_protected_items_test_failover_cleanup_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_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) + raise HttpResponseError(response=response, 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")) + + 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_test_failover_cleanup( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + cleanup_input: _models.TestFailoverCleanupInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Execute test failover cleanup. + + Operation to clean up the test failover of a replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param cleanup_input: Test failover cleanup input. Required. + :type cleanup_input: ~azure.mgmt.recoveryservicessiterecovery.models.TestFailoverCleanupInput + :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 ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_test_failover_cleanup( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + cleanup_input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Execute test failover cleanup. + + Operation to clean up the test failover of a replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param cleanup_input: Test failover cleanup input. Required. + :type cleanup_input: JSON + :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 ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_test_failover_cleanup( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + cleanup_input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Execute test failover cleanup. + + Operation to clean up the test failover of a replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param cleanup_input: Test failover cleanup input. Required. + :type cleanup_input: 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 ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_test_failover_cleanup( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + cleanup_input: Union[_models.TestFailoverCleanupInput, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Execute test failover cleanup. + + Operation to clean up the test failover of a replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param cleanup_input: Test failover cleanup input. Is one of the following types: + TestFailoverCleanupInput, JSON, IO[bytes] Required. + :type cleanup_input: ~azure.mgmt.recoveryservicessiterecovery.models.TestFailoverCleanupInput + or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :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.ReplicationProtectedItem] = 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._test_failover_cleanup_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_name, + cleanup_input=cleanup_input, + 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.ReplicationProtectedItem, 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.ReplicationProtectedItem].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ReplicationProtectedItem]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _unplanned_failover_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + failover_input: Union[_models.UnplannedFailoverInput, JSON, 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(failover_input, (IOBase, bytes)): + _content = failover_input + else: + _content = json.dumps(failover_input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_protected_items_unplanned_failover_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_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) + raise HttpResponseError(response=response, 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")) + + 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_unplanned_failover( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + failover_input: _models.UnplannedFailoverInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Execute unplanned failover. + + Operation to initiate a failover of the replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param failover_input: Failover input. Required. + :type failover_input: ~azure.mgmt.recoveryservicessiterecovery.models.UnplannedFailoverInput + :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 ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_unplanned_failover( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + failover_input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Execute unplanned failover. + + Operation to initiate a failover of the replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param failover_input: Failover input. Required. + :type failover_input: JSON + :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 ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_unplanned_failover( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + failover_input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Execute unplanned failover. + + Operation to initiate a failover of the replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param failover_input: Failover input. Required. + :type failover_input: 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 ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_unplanned_failover( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + failover_input: Union[_models.UnplannedFailoverInput, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Execute unplanned failover. + + Operation to initiate a failover of the replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param failover_input: Failover input. Is one of the following types: UnplannedFailoverInput, + JSON, IO[bytes] Required. + :type failover_input: ~azure.mgmt.recoveryservicessiterecovery.models.UnplannedFailoverInput or + JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :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.ReplicationProtectedItem] = 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._unplanned_failover_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_name, + failover_input=failover_input, + 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.ReplicationProtectedItem, 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.ReplicationProtectedItem].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ReplicationProtectedItem]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _update_appliance_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + appliance_update_input: Union[_models.UpdateApplianceForReplicationProtectedItemInput, JSON, 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(appliance_update_input, (IOBase, bytes)): + _content = appliance_update_input + else: + _content = json.dumps(appliance_update_input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_protected_items_update_appliance_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_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) + raise HttpResponseError(response=response, 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")) + + 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_appliance( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + appliance_update_input: _models.UpdateApplianceForReplicationProtectedItemInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Updates appliance for replication protected Item. + + The operation to update appliance of an ASR replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param appliance_update_input: Appliance update protection input. Required. + :type appliance_update_input: + ~azure.mgmt.recoveryservicessiterecovery.models.UpdateApplianceForReplicationProtectedItemInput + :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 ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_appliance( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + appliance_update_input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Updates appliance for replication protected Item. + + The operation to update appliance of an ASR replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param appliance_update_input: Appliance update protection input. Required. + :type appliance_update_input: JSON + :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 ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_appliance( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + appliance_update_input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Updates appliance for replication protected Item. + + The operation to update appliance of an ASR replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param appliance_update_input: Appliance update protection input. Required. + :type appliance_update_input: 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 ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update_appliance( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + appliance_update_input: Union[_models.UpdateApplianceForReplicationProtectedItemInput, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Updates appliance for replication protected Item. + + The operation to update appliance of an ASR replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param appliance_update_input: Appliance update protection input. Is one of the following + types: UpdateApplianceForReplicationProtectedItemInput, JSON, IO[bytes] Required. + :type appliance_update_input: + ~azure.mgmt.recoveryservicessiterecovery.models.UpdateApplianceForReplicationProtectedItemInput + or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :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.ReplicationProtectedItem] = 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_appliance_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_name, + appliance_update_input=appliance_update_input, + 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.ReplicationProtectedItem, 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.ReplicationProtectedItem].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ReplicationProtectedItem]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _update_mobility_service_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + update_mobility_service_request: Union[_models.UpdateMobilityServiceRequest, JSON, 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(update_mobility_service_request, (IOBase, bytes)): + _content = update_mobility_service_request + else: + _content = json.dumps(update_mobility_service_request, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_protected_items_update_mobility_service_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_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) + raise HttpResponseError(response=response, 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")) + + 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_mobility_service( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + update_mobility_service_request: _models.UpdateMobilityServiceRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Update the mobility service on a protected item. + + The operation to update(push update) the installed mobility service software on a replication + protected item to the latest available version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param update_mobility_service_request: Request to update the mobility service on the protected + item. Required. + :type update_mobility_service_request: + ~azure.mgmt.recoveryservicessiterecovery.models.UpdateMobilityServiceRequest + :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 ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_mobility_service( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + update_mobility_service_request: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Update the mobility service on a protected item. + + The operation to update(push update) the installed mobility service software on a replication + protected item to the latest available version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param update_mobility_service_request: Request to update the mobility service on the protected + item. Required. + :type update_mobility_service_request: JSON + :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 ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_mobility_service( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + update_mobility_service_request: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Update the mobility service on a protected item. + + The operation to update(push update) the installed mobility service software on a replication + protected item to the latest available version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param update_mobility_service_request: Request to update the mobility service on the protected + item. Required. + :type update_mobility_service_request: 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 ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update_mobility_service( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + update_mobility_service_request: Union[_models.UpdateMobilityServiceRequest, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Update the mobility service on a protected item. + + The operation to update(push update) the installed mobility service software on a replication + protected item to the latest available version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param update_mobility_service_request: Request to update the mobility service on the protected + item. Is one of the following types: UpdateMobilityServiceRequest, JSON, IO[bytes] Required. + :type update_mobility_service_request: + ~azure.mgmt.recoveryservicessiterecovery.models.UpdateMobilityServiceRequest or JSON or + IO[bytes] + :return: An instance of AsyncLROPoller that returns ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :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.ReplicationProtectedItem] = 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_mobility_service_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_name, + update_mobility_service_request=update_mobility_service_request, + 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.ReplicationProtectedItem, 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.ReplicationProtectedItem].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ReplicationProtectedItem]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _reinstall_mobility_service_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + update_mobility_service_request: Union[_models.ReinstallMobilityServiceRequest, JSON, 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(update_mobility_service_request, (IOBase, bytes)): + _content = update_mobility_service_request + else: + _content = json.dumps(update_mobility_service_request, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_protected_items_reinstall_mobility_service_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_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.ErrorResponse, + 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")) + + 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_reinstall_mobility_service( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + update_mobility_service_request: _models.ReinstallMobilityServiceRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Reinstall the mobility service on a protected item. + + The operation to reinstall the installed mobility service software on a replication protected + item to the latest available version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: The name of the protected item on which the agent is to + be updated. Required. + :type replicated_protected_item_name: str + :param update_mobility_service_request: Request to update the mobility service on the protected + item. Required. + :type update_mobility_service_request: + ~azure.mgmt.recoveryservicessiterecovery.models.ReinstallMobilityServiceRequest + :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 ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reinstall_mobility_service( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + update_mobility_service_request: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Reinstall the mobility service on a protected item. + + The operation to reinstall the installed mobility service software on a replication protected + item to the latest available version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: The name of the protected item on which the agent is to + be updated. Required. + :type replicated_protected_item_name: str + :param update_mobility_service_request: Request to update the mobility service on the protected + item. Required. + :type update_mobility_service_request: JSON + :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 ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reinstall_mobility_service( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + update_mobility_service_request: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Reinstall the mobility service on a protected item. + + The operation to reinstall the installed mobility service software on a replication protected + item to the latest available version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: The name of the protected item on which the agent is to + be updated. Required. + :type replicated_protected_item_name: str + :param update_mobility_service_request: Request to update the mobility service on the protected + item. Required. + :type update_mobility_service_request: 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 ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_reinstall_mobility_service( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + update_mobility_service_request: Union[_models.ReinstallMobilityServiceRequest, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: + """Reinstall the mobility service on a protected item. + + The operation to reinstall the installed mobility service software on a replication protected + item to the latest available version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: The name of the protected item on which the agent is to + be updated. Required. + :type replicated_protected_item_name: str + :param update_mobility_service_request: Request to update the mobility service on the protected + item. Is one of the following types: ReinstallMobilityServiceRequest, JSON, IO[bytes] Required. + :type update_mobility_service_request: + ~azure.mgmt.recoveryservicessiterecovery.models.ReinstallMobilityServiceRequest or JSON or + IO[bytes] + :return: An instance of AsyncLROPoller that returns ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :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.ReplicationProtectedItem] = 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._reinstall_mobility_service_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_name, + update_mobility_service_request=update_mobility_service_request, + 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["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.ReplicationProtectedItem, 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.ReplicationProtectedItem].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ReplicationProtectedItem]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def list( + self, + resource_group_name: str, + resource_name: str, + *, + skip_token: Optional[str] = None, + filter: Optional[str] = None, + **kwargs: Any + ) -> AsyncItemPaged["_models.ReplicationProtectedItem"]: + """Gets the list of replication protected items. + + Gets the list of ASR replication protected items in the vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :keyword skip_token: The pagination token. Possible values: "FabricId" or "FabricId_CloudId" or + null. Default value is None. + :paramtype skip_token: str + :keyword filter: OData filter options. Default value is None. + :paramtype filter: str + :return: An iterator like instance of ReplicationProtectedItem + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ReplicationProtectedItem]] = 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_replication_protected_items_list_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + skip_token=skip_token, + filter=filter, + 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), 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.ReplicationProtectedItem], + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class TargetComputeSizesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.aio.SiteRecoveryManagementClient`'s + :attr:`target_compute_sizes` 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: SiteRecoveryManagementClientConfiguration = ( + 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_replication_protected_items( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + **kwargs: Any + ) -> AsyncItemPaged["_models.TargetComputeSize"]: + """Gets the list of target compute sizes for the replication protected item. + + Lists the available target compute sizes for a replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :return: An iterator like instance of TargetComputeSize + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.TargetComputeSize] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.TargetComputeSize]] = 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_target_compute_sizes_list_by_replication_protected_items_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_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), 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.TargetComputeSize], + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class RecoveryPointsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.aio.SiteRecoveryManagementClient`'s + :attr:`recovery_points` 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: SiteRecoveryManagementClientConfiguration = ( + 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, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + recovery_point_name: str, + **kwargs: Any + ) -> _models.RecoveryPoint: + """Gets a recovery point. + + Get the details of specified recovery point. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param recovery_point_name: The recovery point name. Required. + :type recovery_point_name: str + :return: RecoveryPoint. The RecoveryPoint is compatible with MutableMapping + :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPoint + :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.RecoveryPoint] = kwargs.pop("cls", None) + + _request = build_recovery_points_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_name, + recovery_point_name=recovery_point_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.RecoveryPoint, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_replication_protected_items( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + **kwargs: Any + ) -> AsyncItemPaged["_models.RecoveryPoint"]: + """Gets the list of recovery points for a replication protected item. + + Lists the available recovery points for a replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :return: An iterator like instance of RecoveryPoint + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.RecoveryPoint]] = 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_recovery_points_list_by_replication_protected_items_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_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), 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.RecoveryPoint], + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class ReplicationProtectionClustersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.aio.SiteRecoveryManagementClient`'s + :attr:`replication_protection_clusters` 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: SiteRecoveryManagementClientConfiguration = ( + 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, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replication_protection_cluster_name: str, + **kwargs: Any + ) -> _models.ReplicationProtectionCluster: + """Gets the details of a Replication protection cluster. + + Gets the details of an ASR replication protection cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replication_protection_cluster_name: Replication protection cluster name. Required. + :type replication_protection_cluster_name: str + :return: ReplicationProtectionCluster. The ReplicationProtectionCluster is compatible with + MutableMapping + :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster + :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.ReplicationProtectionCluster] = kwargs.pop("cls", None) + + _request = build_replication_protection_clusters_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replication_protection_cluster_name=replication_protection_cluster_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.ErrorResponse, + 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.ReplicationProtectionCluster, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replication_protection_cluster_name: str, + replication_protection_cluster: Union[_models.ReplicationProtectionCluster, JSON, 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(replication_protection_cluster, (IOBase, bytes)): + _content = replication_protection_cluster + else: + _content = json.dumps(replication_protection_cluster, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_protection_clusters_create_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replication_protection_cluster_name=replication_protection_cluster_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.ErrorResponse, + 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["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + 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, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replication_protection_cluster_name: str, + replication_protection_cluster: _models.ReplicationProtectionCluster, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectionCluster]: + """Create Replication protection Cluster. + + The operation to create an ASR replication protection cluster item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replication_protection_cluster_name: Replication protection cluster name. Required. + :type replication_protection_cluster_name: str + :param replication_protection_cluster: Create replication protection cluster Input. Required. + :type replication_protection_cluster: + ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster + :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 ReplicationProtectionCluster. The + ReplicationProtectionCluster is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replication_protection_cluster_name: str, + replication_protection_cluster: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectionCluster]: + """Create Replication protection Cluster. + + The operation to create an ASR replication protection cluster item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replication_protection_cluster_name: Replication protection cluster name. Required. + :type replication_protection_cluster_name: str + :param replication_protection_cluster: Create replication protection cluster Input. Required. + :type replication_protection_cluster: JSON + :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 ReplicationProtectionCluster. The + ReplicationProtectionCluster is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replication_protection_cluster_name: str, + replication_protection_cluster: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectionCluster]: + """Create Replication protection Cluster. + + The operation to create an ASR replication protection cluster item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replication_protection_cluster_name: Replication protection cluster name. Required. + :type replication_protection_cluster_name: str + :param replication_protection_cluster: Create replication protection cluster Input. Required. + :type replication_protection_cluster: 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 ReplicationProtectionCluster. The + ReplicationProtectionCluster is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replication_protection_cluster_name: str, + replication_protection_cluster: Union[_models.ReplicationProtectionCluster, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectionCluster]: + """Create Replication protection Cluster. + + The operation to create an ASR replication protection cluster item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replication_protection_cluster_name: Replication protection cluster name. Required. + :type replication_protection_cluster_name: str + :param replication_protection_cluster: Create replication protection cluster Input. Is one of + the following types: ReplicationProtectionCluster, JSON, IO[bytes] Required. + :type replication_protection_cluster: + ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster or JSON or + IO[bytes] + :return: An instance of AsyncLROPoller that returns ReplicationProtectionCluster. The + ReplicationProtectionCluster is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster] + :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.ReplicationProtectionCluster] = 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, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replication_protection_cluster_name=replication_protection_cluster_name, + replication_protection_cluster=replication_protection_cluster, + 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.ReplicationProtectionCluster, 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.ReplicationProtectionCluster].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ReplicationProtectionCluster]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _purge_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replication_protection_cluster_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_replication_protection_clusters_purge_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replication_protection_cluster_name=replication_protection_cluster_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 [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.ErrorResponse, + 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["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + 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_purge( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replication_protection_cluster_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Purge the replication protection cluster. + + The operation to purge the replication protection cluster. This operation will force delete the + replication protection cluster. Use the remove operation on replication protection cluster to + perform a clean disable replication protection cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replication_protection_cluster_name: Replication protection cluster name. Required. + :type replication_protection_cluster_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._purge_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replication_protection_cluster_name=replication_protection_cluster_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 + + async def _apply_recovery_point_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replication_protection_cluster_name: str, + apply_cluster_recovery_point_input: Union[_models.ApplyClusterRecoveryPointInput, JSON, 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(apply_cluster_recovery_point_input, (IOBase, bytes)): + _content = apply_cluster_recovery_point_input + else: + _content = json.dumps(apply_cluster_recovery_point_input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_protection_clusters_apply_recovery_point_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replication_protection_cluster_name=replication_protection_cluster_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.ErrorResponse, + 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["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + 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_apply_recovery_point( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replication_protection_cluster_name: str, + apply_cluster_recovery_point_input: _models.ApplyClusterRecoveryPointInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectionCluster]: + """Execute the change recovery point operation for cluster. + + Operation to apply a new cluster recovery point on the Protection cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replication_protection_cluster_name: Replication protection cluster name. Required. + :type replication_protection_cluster_name: str + :param apply_cluster_recovery_point_input: Apply recovery point input. Required. + :type apply_cluster_recovery_point_input: + ~azure.mgmt.recoveryservicessiterecovery.models.ApplyClusterRecoveryPointInput + :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 ReplicationProtectionCluster. The + ReplicationProtectionCluster is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_apply_recovery_point( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replication_protection_cluster_name: str, + apply_cluster_recovery_point_input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectionCluster]: + """Execute the change recovery point operation for cluster. + + Operation to apply a new cluster recovery point on the Protection cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replication_protection_cluster_name: Replication protection cluster name. Required. + :type replication_protection_cluster_name: str + :param apply_cluster_recovery_point_input: Apply recovery point input. Required. + :type apply_cluster_recovery_point_input: JSON + :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 ReplicationProtectionCluster. The + ReplicationProtectionCluster is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_apply_recovery_point( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replication_protection_cluster_name: str, + apply_cluster_recovery_point_input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectionCluster]: + """Execute the change recovery point operation for cluster. + + Operation to apply a new cluster recovery point on the Protection cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replication_protection_cluster_name: Replication protection cluster name. Required. + :type replication_protection_cluster_name: str + :param apply_cluster_recovery_point_input: Apply recovery point input. Required. + :type apply_cluster_recovery_point_input: 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 ReplicationProtectionCluster. The + ReplicationProtectionCluster is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_apply_recovery_point( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replication_protection_cluster_name: str, + apply_cluster_recovery_point_input: Union[_models.ApplyClusterRecoveryPointInput, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectionCluster]: + """Execute the change recovery point operation for cluster. + + Operation to apply a new cluster recovery point on the Protection cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replication_protection_cluster_name: Replication protection cluster name. Required. + :type replication_protection_cluster_name: str + :param apply_cluster_recovery_point_input: Apply recovery point input. Is one of the following + types: ApplyClusterRecoveryPointInput, JSON, IO[bytes] Required. + :type apply_cluster_recovery_point_input: + ~azure.mgmt.recoveryservicessiterecovery.models.ApplyClusterRecoveryPointInput or JSON or + IO[bytes] + :return: An instance of AsyncLROPoller that returns ReplicationProtectionCluster. The + ReplicationProtectionCluster is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster] + :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.ReplicationProtectionCluster] = 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._apply_recovery_point_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replication_protection_cluster_name=replication_protection_cluster_name, + apply_cluster_recovery_point_input=apply_cluster_recovery_point_input, + 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["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.ReplicationProtectionCluster, 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.ReplicationProtectionCluster].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ReplicationProtectionCluster]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _failover_commit_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replication_protection_cluster_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_replication_protection_clusters_failover_commit_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replication_protection_cluster_name=replication_protection_cluster_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.ErrorResponse, + 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["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + 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_failover_commit( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replication_protection_cluster_name: str, + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectionCluster]: + """Execute commit failover for cluster. + + Operation to initiate commit failover of the replication protection cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replication_protection_cluster_name: Replication protection cluster name. Required. + :type replication_protection_cluster_name: str + :return: An instance of AsyncLROPoller that returns ReplicationProtectionCluster. The + ReplicationProtectionCluster is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ReplicationProtectionCluster] = 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._failover_commit_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replication_protection_cluster_name=replication_protection_cluster_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): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.ReplicationProtectionCluster, 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.ReplicationProtectionCluster].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ReplicationProtectionCluster]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _repair_replication_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replication_protection_cluster_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_replication_protection_clusters_repair_replication_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replication_protection_cluster_name=replication_protection_cluster_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.ErrorResponse, + 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["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + 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_repair_replication( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replication_protection_cluster_name: str, + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectionCluster]: + """Resynchronize or repair replication of protection cluster. + + The operation to repair replication protection cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replication_protection_cluster_name: Replication protection cluster name. Required. + :type replication_protection_cluster_name: str + :return: An instance of AsyncLROPoller that returns ReplicationProtectionCluster. The + ReplicationProtectionCluster is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ReplicationProtectionCluster] = 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._repair_replication_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replication_protection_cluster_name=replication_protection_cluster_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): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.ReplicationProtectionCluster, 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.ReplicationProtectionCluster].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ReplicationProtectionCluster]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _test_failover_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replication_protection_cluster_name: str, + failover_input: Union[_models.ClusterTestFailoverInput, JSON, 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(failover_input, (IOBase, bytes)): + _content = failover_input + else: + _content = json.dumps(failover_input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_protection_clusters_test_failover_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replication_protection_cluster_name=replication_protection_cluster_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.ErrorResponse, + 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["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + 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_test_failover( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replication_protection_cluster_name: str, + failover_input: _models.ClusterTestFailoverInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectionCluster]: + """Execute test failover for cluster. + + Operation to initiate a failover of the replication protection cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replication_protection_cluster_name: Replication protection cluster name. Required. + :type replication_protection_cluster_name: str + :param failover_input: Cluster test failover input body. Required. + :type failover_input: ~azure.mgmt.recoveryservicessiterecovery.models.ClusterTestFailoverInput + :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 ReplicationProtectionCluster. The + ReplicationProtectionCluster is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_test_failover( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replication_protection_cluster_name: str, + failover_input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectionCluster]: + """Execute test failover for cluster. + + Operation to initiate a failover of the replication protection cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replication_protection_cluster_name: Replication protection cluster name. Required. + :type replication_protection_cluster_name: str + :param failover_input: Cluster test failover input body. Required. + :type failover_input: JSON + :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 ReplicationProtectionCluster. The + ReplicationProtectionCluster is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_test_failover( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replication_protection_cluster_name: str, + failover_input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectionCluster]: + """Execute test failover for cluster. + + Operation to initiate a failover of the replication protection cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replication_protection_cluster_name: Replication protection cluster name. Required. + :type replication_protection_cluster_name: str + :param failover_input: Cluster test failover input body. Required. + :type failover_input: 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 ReplicationProtectionCluster. The + ReplicationProtectionCluster is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_test_failover( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replication_protection_cluster_name: str, + failover_input: Union[_models.ClusterTestFailoverInput, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectionCluster]: + """Execute test failover for cluster. + + Operation to initiate a failover of the replication protection cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replication_protection_cluster_name: Replication protection cluster name. Required. + :type replication_protection_cluster_name: str + :param failover_input: Cluster test failover input body. Is one of the following types: + ClusterTestFailoverInput, JSON, IO[bytes] Required. + :type failover_input: ~azure.mgmt.recoveryservicessiterecovery.models.ClusterTestFailoverInput + or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns ReplicationProtectionCluster. The + ReplicationProtectionCluster is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster] + :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.ReplicationProtectionCluster] = 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._test_failover_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replication_protection_cluster_name=replication_protection_cluster_name, + failover_input=failover_input, + 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["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.ReplicationProtectionCluster, 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.ReplicationProtectionCluster].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ReplicationProtectionCluster]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _test_failover_cleanup_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replication_protection_cluster_name: str, + cleanup_input: Union[_models.ClusterTestFailoverCleanupInput, JSON, 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(cleanup_input, (IOBase, bytes)): + _content = cleanup_input + else: + _content = json.dumps(cleanup_input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_protection_clusters_test_failover_cleanup_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replication_protection_cluster_name=replication_protection_cluster_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.ErrorResponse, + 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["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + 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_test_failover_cleanup( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replication_protection_cluster_name: str, + cleanup_input: _models.ClusterTestFailoverCleanupInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectionCluster]: + """Execute test failover cleanup for cluster. + + Operation to clean up the test failover of a replication protected cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replication_protection_cluster_name: Replication protection cluster name. Required. + :type replication_protection_cluster_name: str + :param cleanup_input: Test failover cleanup input. Required. + :type cleanup_input: + ~azure.mgmt.recoveryservicessiterecovery.models.ClusterTestFailoverCleanupInput + :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 ReplicationProtectionCluster. The + ReplicationProtectionCluster is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_test_failover_cleanup( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replication_protection_cluster_name: str, + cleanup_input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectionCluster]: + """Execute test failover cleanup for cluster. + + Operation to clean up the test failover of a replication protected cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replication_protection_cluster_name: Replication protection cluster name. Required. + :type replication_protection_cluster_name: str + :param cleanup_input: Test failover cleanup input. Required. + :type cleanup_input: JSON + :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 ReplicationProtectionCluster. The + ReplicationProtectionCluster is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_test_failover_cleanup( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replication_protection_cluster_name: str, + cleanup_input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectionCluster]: + """Execute test failover cleanup for cluster. + + Operation to clean up the test failover of a replication protected cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replication_protection_cluster_name: Replication protection cluster name. Required. + :type replication_protection_cluster_name: str + :param cleanup_input: Test failover cleanup input. Required. + :type cleanup_input: 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 ReplicationProtectionCluster. The + ReplicationProtectionCluster is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_test_failover_cleanup( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replication_protection_cluster_name: str, + cleanup_input: Union[_models.ClusterTestFailoverCleanupInput, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectionCluster]: + """Execute test failover cleanup for cluster. + + Operation to clean up the test failover of a replication protected cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replication_protection_cluster_name: Replication protection cluster name. Required. + :type replication_protection_cluster_name: str + :param cleanup_input: Test failover cleanup input. Is one of the following types: + ClusterTestFailoverCleanupInput, JSON, IO[bytes] Required. + :type cleanup_input: + ~azure.mgmt.recoveryservicessiterecovery.models.ClusterTestFailoverCleanupInput or JSON or + IO[bytes] + :return: An instance of AsyncLROPoller that returns ReplicationProtectionCluster. The + ReplicationProtectionCluster is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster] + :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.ReplicationProtectionCluster] = 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._test_failover_cleanup_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replication_protection_cluster_name=replication_protection_cluster_name, + cleanup_input=cleanup_input, + 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["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.ReplicationProtectionCluster, 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.ReplicationProtectionCluster].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ReplicationProtectionCluster]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _unplanned_failover_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replication_protection_cluster_name: str, + failover_input: Union[_models.ClusterUnplannedFailoverInput, JSON, 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(failover_input, (IOBase, bytes)): + _content = failover_input + else: + _content = json.dumps(failover_input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_protection_clusters_unplanned_failover_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replication_protection_cluster_name=replication_protection_cluster_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.ErrorResponse, + 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["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + 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_unplanned_failover( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replication_protection_cluster_name: str, + failover_input: _models.ClusterUnplannedFailoverInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectionCluster]: + """Execute unplanned cluster failover. + + Operation to initiate a failover of the replication protection cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replication_protection_cluster_name: Replication protection cluster name. Required. + :type replication_protection_cluster_name: str + :param failover_input: Failover input. Required. + :type failover_input: + ~azure.mgmt.recoveryservicessiterecovery.models.ClusterUnplannedFailoverInput + :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 ReplicationProtectionCluster. The + ReplicationProtectionCluster is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_unplanned_failover( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replication_protection_cluster_name: str, + failover_input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectionCluster]: + """Execute unplanned cluster failover. + + Operation to initiate a failover of the replication protection cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replication_protection_cluster_name: Replication protection cluster name. Required. + :type replication_protection_cluster_name: str + :param failover_input: Failover input. Required. + :type failover_input: JSON + :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 ReplicationProtectionCluster. The + ReplicationProtectionCluster is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_unplanned_failover( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replication_protection_cluster_name: str, + failover_input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectionCluster]: + """Execute unplanned cluster failover. + + Operation to initiate a failover of the replication protection cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replication_protection_cluster_name: Replication protection cluster name. Required. + :type replication_protection_cluster_name: str + :param failover_input: Failover input. Required. + :type failover_input: 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 ReplicationProtectionCluster. The + ReplicationProtectionCluster is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_unplanned_failover( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replication_protection_cluster_name: str, + failover_input: Union[_models.ClusterUnplannedFailoverInput, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.ReplicationProtectionCluster]: + """Execute unplanned cluster failover. + + Operation to initiate a failover of the replication protection cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replication_protection_cluster_name: Replication protection cluster name. Required. + :type replication_protection_cluster_name: str + :param failover_input: Failover input. Is one of the following types: + ClusterUnplannedFailoverInput, JSON, IO[bytes] Required. + :type failover_input: + ~azure.mgmt.recoveryservicessiterecovery.models.ClusterUnplannedFailoverInput or JSON or + IO[bytes] + :return: An instance of AsyncLROPoller that returns ReplicationProtectionCluster. The + ReplicationProtectionCluster is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster] + :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.ReplicationProtectionCluster] = 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._unplanned_failover_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replication_protection_cluster_name=replication_protection_cluster_name, + failover_input=failover_input, + 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["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.ReplicationProtectionCluster, 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.ReplicationProtectionCluster].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ReplicationProtectionCluster]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace_async + async def get_operation_results( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replication_protection_cluster_name: str, + job_id: str, + **kwargs: Any + ) -> _models.ReplicationProtectionCluster: + """Tracks the Replication protection cluster async operation. + + Track the results of an asynchronous operation on the replication protection cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replication_protection_cluster_name: Replication protection cluster name. Required. + :type replication_protection_cluster_name: str + :param job_id: job id to track. Required. + :type job_id: str + :return: ReplicationProtectionCluster. The ReplicationProtectionCluster is compatible with + MutableMapping + :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster + :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.ReplicationProtectionCluster] = kwargs.pop("cls", None) + + _request = build_replication_protection_clusters_get_operation_results_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replication_protection_cluster_name=replication_protection_cluster_name, + job_id=job_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.ErrorResponse, + 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.ReplicationProtectionCluster, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_replication_protection_containers( # pylint: disable=name-too-long + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + **kwargs: Any + ) -> AsyncItemPaged["_models.ReplicationProtectionCluster"]: + """Gets the list of Replication protection clusters in fabric, container. + + Gets the list of ASR replication protected clusters in the protection container. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :return: An iterator like instance of ReplicationProtectionCluster + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ReplicationProtectionCluster]] = 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_replication_protection_clusters_list_by_replication_protection_containers_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_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), 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.ReplicationProtectionCluster], + 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.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list( + self, + resource_group_name: str, + resource_name: str, + *, + skip_token: Optional[str] = None, + filter: Optional[str] = None, + **kwargs: Any + ) -> AsyncItemPaged["_models.ReplicationProtectionCluster"]: + """Gets the list of Replication protection clusters in vault. + + Gets the list of ASR replication protected clusters in the vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :keyword skip_token: The pagination token. Possible values: "FabricId" or "FabricId_CloudId" or + null. Default value is None. + :paramtype skip_token: str + :keyword filter: OData filter options. Default value is None. + :paramtype filter: str + :return: An iterator like instance of ReplicationProtectionCluster + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ReplicationProtectionCluster]] = 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_replication_protection_clusters_list_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + skip_token=skip_token, + filter=filter, + 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), 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.ReplicationProtectionCluster], + 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.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class ClusterRecoveryPointsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.aio.SiteRecoveryManagementClient`'s + :attr:`cluster_recovery_points` 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: SiteRecoveryManagementClientConfiguration = ( + 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_replication_protection_cluster( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replication_protection_cluster_name: str, + **kwargs: Any + ) -> AsyncItemPaged["_models.ClusterRecoveryPoint"]: + """Gets the list of cluster recovery points. + + The list of cluster recovery points. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replication_protection_cluster_name: Replication protection cluster name. Required. + :type replication_protection_cluster_name: str + :return: An iterator like instance of ClusterRecoveryPoint + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.ClusterRecoveryPoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ClusterRecoveryPoint]] = 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_cluster_recovery_points_list_by_replication_protection_cluster_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replication_protection_cluster_name=replication_protection_cluster_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), 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.ClusterRecoveryPoint], + 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.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class ReplicationProtectionIntentsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.aio.SiteRecoveryManagementClient`'s + :attr:`replication_protection_intents` 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: SiteRecoveryManagementClientConfiguration = ( + 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, resource_name: str, intent_object_name: str, **kwargs: Any + ) -> _models.ReplicationProtectionIntent: + """Gets the details of a Replication protection intent item. + + Gets the details of an ASR replication protection intent. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param intent_object_name: Replication protection intent name. Required. + :type intent_object_name: str + :return: ReplicationProtectionIntent. The ReplicationProtectionIntent is compatible with + MutableMapping + :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionIntent + :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.ReplicationProtectionIntent] = kwargs.pop("cls", None) + + _request = build_replication_protection_intents_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + intent_object_name=intent_object_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ReplicationProtectionIntent, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def create( + self, + resource_group_name: str, + resource_name: str, + intent_object_name: str, + input: _models.CreateProtectionIntentInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ReplicationProtectionIntent: + """Create protection intent Resource. + + The operation to create an ASR replication protection intent item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param intent_object_name: Replication protection intent name. Required. + :type intent_object_name: str + :param input: Create Protection Intent Input. Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.CreateProtectionIntentInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ReplicationProtectionIntent. The ReplicationProtectionIntent is compatible with + MutableMapping + :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionIntent + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create( + self, + resource_group_name: str, + resource_name: str, + intent_object_name: str, + input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ReplicationProtectionIntent: + """Create protection intent Resource. + + The operation to create an ASR replication protection intent item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param intent_object_name: Replication protection intent name. Required. + :type intent_object_name: str + :param input: Create Protection Intent Input. Required. + :type input: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ReplicationProtectionIntent. The ReplicationProtectionIntent is compatible with + MutableMapping + :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionIntent + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create( + self, + resource_group_name: str, + resource_name: str, + intent_object_name: str, + input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ReplicationProtectionIntent: + """Create protection intent Resource. + + The operation to create an ASR replication protection intent item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param intent_object_name: Replication protection intent name. Required. + :type intent_object_name: str + :param input: Create Protection Intent Input. Required. + :type input: 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: ReplicationProtectionIntent. The ReplicationProtectionIntent is compatible with + MutableMapping + :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionIntent + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create( + self, + resource_group_name: str, + resource_name: str, + intent_object_name: str, + input: Union[_models.CreateProtectionIntentInput, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.ReplicationProtectionIntent: + """Create protection intent Resource. + + The operation to create an ASR replication protection intent item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param intent_object_name: Replication protection intent name. Required. + :type intent_object_name: str + :param input: Create Protection Intent Input. Is one of the following types: + CreateProtectionIntentInput, JSON, IO[bytes] Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.CreateProtectionIntentInput or + JSON or IO[bytes] + :return: ReplicationProtectionIntent. The ReplicationProtectionIntent is compatible with + MutableMapping + :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionIntent + :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.ReplicationProtectionIntent] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(input, (IOBase, bytes)): + _content = input + else: + _content = json.dumps(input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_protection_intents_create_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + intent_object_name=intent_object_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ReplicationProtectionIntent, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + resource_name: str, + *, + skip_token: Optional[str] = None, + take_token: Optional[str] = None, + **kwargs: Any + ) -> AsyncItemPaged["_models.ReplicationProtectionIntent"]: + """Gets the list of replication protection intent objects. + + Gets the list of ASR replication protection intent objects in the vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :keyword skip_token: The pagination token. Default value is None. + :paramtype skip_token: str + :keyword take_token: The page size. Default value is None. + :paramtype take_token: str + :return: An iterator like instance of ReplicationProtectionIntent + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionIntent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ReplicationProtectionIntent]] = 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_replication_protection_intents_list_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + skip_token=skip_token, + take_token=take_token, + 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), 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.ReplicationProtectionIntent], + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class ReplicationAlertSettingsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.aio.SiteRecoveryManagementClient`'s + :attr:`replication_alert_settings` 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: SiteRecoveryManagementClientConfiguration = ( + 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, resource_name: str, alert_setting_name: str, **kwargs: Any + ) -> _models.Alert: + """Gets an email notification(alert) configuration. + + Gets the details of the specified email notification(alert) configuration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param alert_setting_name: The name of the email notification configuration. Required. + :type alert_setting_name: str + :return: Alert. The Alert is compatible with MutableMapping + :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.Alert + :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.Alert] = kwargs.pop("cls", None) + + _request = build_replication_alert_settings_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + alert_setting_name=alert_setting_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Alert, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def create( + self, + resource_group_name: str, + resource_name: str, + alert_setting_name: str, + request: _models.ConfigureAlertRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Alert: + """Configures email notifications for this vault. + + Create or update an email notification(alert) configuration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param alert_setting_name: The name of the email notification configuration. Required. + :type alert_setting_name: str + :param request: The input to configure the email notification(alert). Required. + :type request: ~azure.mgmt.recoveryservicessiterecovery.models.ConfigureAlertRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Alert. The Alert is compatible with MutableMapping + :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.Alert + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create( + self, + resource_group_name: str, + resource_name: str, + alert_setting_name: str, + request: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Alert: + """Configures email notifications for this vault. + + Create or update an email notification(alert) configuration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param alert_setting_name: The name of the email notification configuration. Required. + :type alert_setting_name: str + :param request: The input to configure the email notification(alert). Required. + :type request: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Alert. The Alert is compatible with MutableMapping + :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.Alert + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create( + self, + resource_group_name: str, + resource_name: str, + alert_setting_name: str, + request: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Alert: + """Configures email notifications for this vault. + + Create or update an email notification(alert) configuration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param alert_setting_name: The name of the email notification configuration. Required. + :type alert_setting_name: str + :param request: The input to configure the email notification(alert). Required. + :type request: 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: Alert. The Alert is compatible with MutableMapping + :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.Alert + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create( + self, + resource_group_name: str, + resource_name: str, + alert_setting_name: str, + request: Union[_models.ConfigureAlertRequest, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.Alert: + """Configures email notifications for this vault. + + Create or update an email notification(alert) configuration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param alert_setting_name: The name of the email notification configuration. Required. + :type alert_setting_name: str + :param request: The input to configure the email notification(alert). Is one of the following + types: ConfigureAlertRequest, JSON, IO[bytes] Required. + :type request: ~azure.mgmt.recoveryservicessiterecovery.models.ConfigureAlertRequest or JSON or + IO[bytes] + :return: Alert. The Alert is compatible with MutableMapping + :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.Alert + :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.Alert] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(request, (IOBase, bytes)): + _content = request + else: + _content = json.dumps(request, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_alert_settings_create_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + alert_setting_name=alert_setting_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Alert, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncItemPaged["_models.Alert"]: + """Gets the list of configured email notification(alert) configurations. + + Gets the list of email notification(alert) configurations for the vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :return: An iterator like instance of Alert + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.Alert] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Alert]] = 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_replication_alert_settings_list_request( + resource_group_name=resource_group_name, + resource_name=resource_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), 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.Alert], + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class ReplicationEligibilityResultsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.aio.SiteRecoveryManagementClient`'s + :attr:`replication_eligibility_results` 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: SiteRecoveryManagementClientConfiguration = ( + 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, virtual_machine_name: str, **kwargs: Any + ) -> _models.ReplicationEligibilityResults: + """Gets the validation errors in case the VM is unsuitable for protection. + + Validates whether a given VM can be protected or not in which case returns list of errors. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param virtual_machine_name: Virtual Machine name. Required. + :type virtual_machine_name: str + :return: ReplicationEligibilityResults. The ReplicationEligibilityResults is compatible with + MutableMapping + :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationEligibilityResults + :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.ReplicationEligibilityResults] = kwargs.pop("cls", None) + + _request = build_replication_eligibility_results_get_request( + resource_group_name=resource_group_name, + virtual_machine_name=virtual_machine_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ReplicationEligibilityResults, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def list( + self, resource_group_name: str, virtual_machine_name: str, **kwargs: Any + ) -> _models.ReplicationEligibilityResultsCollection: + """Gets the validation errors in case the VM is unsuitable for protection. + + Validates whether a given VM can be protected or not in which case returns list of errors. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param virtual_machine_name: Virtual Machine name. Required. + :type virtual_machine_name: str + :return: ReplicationEligibilityResultsCollection. The ReplicationEligibilityResultsCollection + is compatible with MutableMapping + :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationEligibilityResultsCollection + :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.ReplicationEligibilityResultsCollection] = kwargs.pop("cls", None) + + _request = build_replication_eligibility_results_list_request( + resource_group_name=resource_group_name, + virtual_machine_name=virtual_machine_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ReplicationEligibilityResultsCollection, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class ReplicationEventsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.aio.SiteRecoveryManagementClient`'s + :attr:`replication_events` 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: SiteRecoveryManagementClientConfiguration = ( + 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, resource_name: str, event_name: str, **kwargs: Any) -> _models.Event: + """Get the details of an Azure Site recovery event. + + The operation to get the details of an Azure Site recovery event. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param event_name: The name of the Azure Site Recovery event. Required. + :type event_name: str + :return: Event. The Event is compatible with MutableMapping + :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.Event + :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.Event] = kwargs.pop("cls", None) + + _request = build_replication_events_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + event_name=event_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Event, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list( + self, resource_group_name: str, resource_name: str, *, filter: Optional[str] = None, **kwargs: Any + ) -> AsyncItemPaged["_models.Event"]: + """Gets the list of Azure Site Recovery events. + + Gets the list of Azure Site Recovery events for the vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :keyword filter: OData filter options. Default value is None. + :paramtype filter: str + :return: An iterator like instance of Event + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.Event] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Event]] = 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_replication_events_list_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + filter=filter, + 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), 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.Event], + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class ReplicationFabricsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.aio.SiteRecoveryManagementClient`'s + :attr:`replication_fabrics` 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: SiteRecoveryManagementClientConfiguration = ( + 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, + resource_name: str, + fabric_name: str, + *, + filter: Optional[str] = None, + **kwargs: Any + ) -> _models.Fabric: + """Gets the details of an ASR fabric. + + Gets the details of an Azure Site Recovery fabric. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :keyword filter: OData filter options. Default value is None. + :paramtype filter: str + :return: Fabric. The Fabric is compatible with MutableMapping + :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.Fabric + :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.Fabric] = kwargs.pop("cls", None) + + _request = build_replication_fabrics_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + subscription_id=self._config.subscription_id, + filter=filter, + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Fabric, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + input: Union[_models.FabricCreationInput, JSON, 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(input, (IOBase, bytes)): + _content = input + else: + _content = json.dumps(input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_fabrics_create_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_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) + raise HttpResponseError(response=response, 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")) + + 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, + resource_name: str, + fabric_name: str, + input: _models.FabricCreationInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Fabric]: + """Creates an Azure Site Recovery fabric. + + The operation to create an Azure Site Recovery fabric (for e.g. Hyper-V site). + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param input: Fabric creation input. Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.FabricCreationInput + :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 Fabric. The Fabric is compatible with + MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Fabric] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Fabric]: + """Creates an Azure Site Recovery fabric. + + The operation to create an Azure Site Recovery fabric (for e.g. Hyper-V site). + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param input: Fabric creation input. Required. + :type input: JSON + :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 Fabric. The Fabric is compatible with + MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Fabric] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Fabric]: + """Creates an Azure Site Recovery fabric. + + The operation to create an Azure Site Recovery fabric (for e.g. Hyper-V site). + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param input: Fabric creation input. Required. + :type input: 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 Fabric. The Fabric is compatible with + MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Fabric] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + input: Union[_models.FabricCreationInput, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.Fabric]: + """Creates an Azure Site Recovery fabric. + + The operation to create an Azure Site Recovery fabric (for e.g. Hyper-V site). + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param input: Fabric creation input. Is one of the following types: FabricCreationInput, JSON, + IO[bytes] Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.FabricCreationInput or JSON or + IO[bytes] + :return: An instance of AsyncLROPoller that returns Fabric. The Fabric is compatible with + MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Fabric] + :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.Fabric] = 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, + resource_name=resource_name, + fabric_name=fabric_name, + input=input, + 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.Fabric, 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.Fabric].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.Fabric]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _purge_initial( + self, resource_group_name: str, resource_name: str, fabric_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_replication_fabrics_purge_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_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 [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) + raise HttpResponseError(response=response, 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")) + + 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_purge( + self, resource_group_name: str, resource_name: str, fabric_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Purges the site. + + The operation to purge(force delete) an Azure Site Recovery fabric. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_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._purge_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_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(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncItemPaged["_models.Fabric"]: + """Gets the list of ASR fabrics. + + Gets a list of the Azure Site Recovery fabrics in the vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :return: An iterator like instance of Fabric + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.Fabric] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Fabric]] = 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_replication_fabrics_list_request( + resource_group_name=resource_group_name, + resource_name=resource_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), 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.Fabric], + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + async def _check_consistency_initial( + self, resource_group_name: str, resource_name: str, fabric_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_replication_fabrics_check_consistency_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_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) + raise HttpResponseError(response=response, 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")) + + 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_check_consistency( + self, resource_group_name: str, resource_name: str, fabric_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.Fabric]: + """Checks the consistency of the ASR fabric. + + The operation to perform a consistency check on the fabric. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :return: An instance of AsyncLROPoller that returns Fabric. The Fabric is compatible with + MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Fabric] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Fabric] = 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._check_consistency_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.Fabric, 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.Fabric].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.Fabric]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _migrate_to_aad_initial( + self, resource_group_name: str, resource_name: str, fabric_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_replication_fabrics_migrate_to_aad_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_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 [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) + raise HttpResponseError(response=response, 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")) + + 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_migrate_to_aad( + self, resource_group_name: str, resource_name: str, fabric_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Migrates the site to AAD. + + The operation to migrate an Azure Site Recovery fabric to AAD. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_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._migrate_to_aad_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_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 + + async def _reassociate_gateway_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + failover_process_server_request: Union[_models.FailoverProcessServerRequest, JSON, 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(failover_process_server_request, (IOBase, bytes)): + _content = failover_process_server_request + else: + _content = json.dumps(failover_process_server_request, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_fabrics_reassociate_gateway_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_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) + raise HttpResponseError(response=response, 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")) + + 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_reassociate_gateway( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + failover_process_server_request: _models.FailoverProcessServerRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Fabric]: + """Perform failover of the process server. + + The operation to move replications from a process server to another process server. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param failover_process_server_request: The input to the failover process server operation. + Required. + :type failover_process_server_request: + ~azure.mgmt.recoveryservicessiterecovery.models.FailoverProcessServerRequest + :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 Fabric. The Fabric is compatible with + MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Fabric] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reassociate_gateway( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + failover_process_server_request: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Fabric]: + """Perform failover of the process server. + + The operation to move replications from a process server to another process server. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param failover_process_server_request: The input to the failover process server operation. + Required. + :type failover_process_server_request: JSON + :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 Fabric. The Fabric is compatible with + MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Fabric] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reassociate_gateway( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + failover_process_server_request: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Fabric]: + """Perform failover of the process server. + + The operation to move replications from a process server to another process server. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param failover_process_server_request: The input to the failover process server operation. + Required. + :type failover_process_server_request: 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 Fabric. The Fabric is compatible with + MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Fabric] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_reassociate_gateway( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + failover_process_server_request: Union[_models.FailoverProcessServerRequest, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.Fabric]: + """Perform failover of the process server. + + The operation to move replications from a process server to another process server. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param failover_process_server_request: The input to the failover process server operation. Is + one of the following types: FailoverProcessServerRequest, JSON, IO[bytes] Required. + :type failover_process_server_request: + ~azure.mgmt.recoveryservicessiterecovery.models.FailoverProcessServerRequest or JSON or + IO[bytes] + :return: An instance of AsyncLROPoller that returns Fabric. The Fabric is compatible with + MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Fabric] + :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.Fabric] = 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._reassociate_gateway_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + failover_process_server_request=failover_process_server_request, + 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.Fabric, 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.Fabric].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.Fabric]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, resource_name: str, fabric_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_replication_fabrics_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_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 [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) + raise HttpResponseError(response=response, 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")) + + 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, resource_name: str, fabric_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the site. + + The operation to delete or remove an Azure Site Recovery fabric. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_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, + resource_name=resource_name, + fabric_name=fabric_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 + + async def _renew_certificate_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + renew_certificate: Union[_models.RenewCertificateInput, JSON, 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(renew_certificate, (IOBase, bytes)): + _content = renew_certificate + else: + _content = json.dumps(renew_certificate, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_fabrics_renew_certificate_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_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) + raise HttpResponseError(response=response, 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")) + + 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_renew_certificate( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + renew_certificate: _models.RenewCertificateInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Fabric]: + """Renews certificate for the fabric. + + Renews the connection certificate for the ASR replication fabric. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param renew_certificate: Renew certificate input. Required. + :type renew_certificate: ~azure.mgmt.recoveryservicessiterecovery.models.RenewCertificateInput + :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 Fabric. The Fabric is compatible with + MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Fabric] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_renew_certificate( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + renew_certificate: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Fabric]: + """Renews certificate for the fabric. + + Renews the connection certificate for the ASR replication fabric. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param renew_certificate: Renew certificate input. Required. + :type renew_certificate: JSON + :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 Fabric. The Fabric is compatible with + MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Fabric] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_renew_certificate( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + renew_certificate: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Fabric]: + """Renews certificate for the fabric. + + Renews the connection certificate for the ASR replication fabric. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param renew_certificate: Renew certificate input. Required. + :type renew_certificate: 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 Fabric. The Fabric is compatible with + MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Fabric] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_renew_certificate( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + renew_certificate: Union[_models.RenewCertificateInput, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.Fabric]: + """Renews certificate for the fabric. + + Renews the connection certificate for the ASR replication fabric. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param renew_certificate: Renew certificate input. Is one of the following types: + RenewCertificateInput, JSON, IO[bytes] Required. + :type renew_certificate: ~azure.mgmt.recoveryservicessiterecovery.models.RenewCertificateInput + or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns Fabric. The Fabric is compatible with + MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Fabric] + :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.Fabric] = 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._renew_certificate_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + renew_certificate=renew_certificate, + 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.Fabric, 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.Fabric].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.Fabric]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _remove_infra_initial( + self, resource_group_name: str, resource_name: str, fabric_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_replication_fabrics_remove_infra_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_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 [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 = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + 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_remove_infra( + self, resource_group_name: str, resource_name: str, fabric_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Removes the appliance's infrastructure under the fabric. + + Removes the appliance's infrastructure under the fabric. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_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._remove_infra_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_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 + + +class ReplicationLogicalNetworksOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.aio.SiteRecoveryManagementClient`'s + :attr:`replication_logical_networks` 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: SiteRecoveryManagementClientConfiguration = ( + 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, resource_name: str, fabric_name: str, logical_network_name: str, **kwargs: Any + ) -> _models.LogicalNetwork: + """Gets a logical network with specified server id and logical network name. + + Gets the details of a logical network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param logical_network_name: Logical network name. Required. + :type logical_network_name: str + :return: LogicalNetwork. The LogicalNetwork is compatible with MutableMapping + :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.LogicalNetwork + :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.LogicalNetwork] = kwargs.pop("cls", None) + + _request = build_replication_logical_networks_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + logical_network_name=logical_network_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.LogicalNetwork, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_replication_fabrics( + self, resource_group_name: str, resource_name: str, fabric_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.LogicalNetwork"]: + """Gets the list of logical networks under a fabric. + + Lists all the logical networks of the Azure Site Recovery fabric. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :return: An iterator like instance of LogicalNetwork + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.LogicalNetwork] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.LogicalNetwork]] = 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_replication_logical_networks_list_by_replication_fabrics_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_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), 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.LogicalNetwork], + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class ReplicationNetworksOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.aio.SiteRecoveryManagementClient`'s + :attr:`replication_networks` 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: SiteRecoveryManagementClientConfiguration = ( + 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, resource_name: str, fabric_name: str, network_name: str, **kwargs: Any + ) -> _models.Network: + """Gets a network with specified server id and network name. + + Gets the details of a network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param network_name: Primary network name. Required. + :type network_name: str + :return: Network. The Network is compatible with MutableMapping + :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.Network + :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.Network] = kwargs.pop("cls", None) + + _request = build_replication_networks_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + network_name=network_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Network, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_replication_fabrics( + self, resource_group_name: str, resource_name: str, fabric_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.Network"]: + """Gets the list of networks under a fabric. + + Lists the networks available for a fabric. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :return: An iterator like instance of Network + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.Network] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Network]] = 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_replication_networks_list_by_replication_fabrics_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_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), 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.Network], + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncItemPaged["_models.Network"]: + """Gets the list of networks. View-only API. + + Lists the networks available in a vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :return: An iterator like instance of Network + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.Network] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Network]] = 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_replication_networks_list_request( + resource_group_name=resource_group_name, + resource_name=resource_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), 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.Network], + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class ReplicationNetworkMappingsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.aio.SiteRecoveryManagementClient`'s + :attr:`replication_network_mappings` 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: SiteRecoveryManagementClientConfiguration = ( + 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, + resource_name: str, + fabric_name: str, + network_name: str, + network_mapping_name: str, + **kwargs: Any + ) -> _models.NetworkMapping: + """Gets network mapping by name. + + Gets the details of an ASR network mapping. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param network_name: Primary network name. Required. + :type network_name: str + :param network_mapping_name: Network mapping name. Required. + :type network_mapping_name: str + :return: NetworkMapping. The NetworkMapping is compatible with MutableMapping + :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.NetworkMapping + :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.NetworkMapping] = kwargs.pop("cls", None) + + _request = build_replication_network_mappings_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + network_name=network_name, + network_mapping_name=network_mapping_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.NetworkMapping, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + network_name: str, + network_mapping_name: str, + input: Union[_models.CreateNetworkMappingInput, JSON, 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(input, (IOBase, bytes)): + _content = input + else: + _content = json.dumps(input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_network_mappings_create_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + network_name=network_name, + network_mapping_name=network_mapping_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) + raise HttpResponseError(response=response, 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")) + + 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, + resource_name: str, + fabric_name: str, + network_name: str, + network_mapping_name: str, + input: _models.CreateNetworkMappingInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NetworkMapping]: + """Creates network mapping. + + The operation to create an ASR network mapping. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param network_name: Primary network name. Required. + :type network_name: str + :param network_mapping_name: Network mapping name. Required. + :type network_mapping_name: str + :param input: Create network mapping input. Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.CreateNetworkMappingInput + :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 NetworkMapping. The NetworkMapping is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.NetworkMapping] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + network_name: str, + network_mapping_name: str, + input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NetworkMapping]: + """Creates network mapping. + + The operation to create an ASR network mapping. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param network_name: Primary network name. Required. + :type network_name: str + :param network_mapping_name: Network mapping name. Required. + :type network_mapping_name: str + :param input: Create network mapping input. Required. + :type input: JSON + :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 NetworkMapping. The NetworkMapping is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.NetworkMapping] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + network_name: str, + network_mapping_name: str, + input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NetworkMapping]: + """Creates network mapping. + + The operation to create an ASR network mapping. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param network_name: Primary network name. Required. + :type network_name: str + :param network_mapping_name: Network mapping name. Required. + :type network_mapping_name: str + :param input: Create network mapping input. Required. + :type input: 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 NetworkMapping. The NetworkMapping is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.NetworkMapping] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + network_name: str, + network_mapping_name: str, + input: Union[_models.CreateNetworkMappingInput, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.NetworkMapping]: + """Creates network mapping. + + The operation to create an ASR network mapping. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param network_name: Primary network name. Required. + :type network_name: str + :param network_mapping_name: Network mapping name. Required. + :type network_mapping_name: str + :param input: Create network mapping input. Is one of the following types: + CreateNetworkMappingInput, JSON, IO[bytes] Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.CreateNetworkMappingInput or JSON + or IO[bytes] + :return: An instance of AsyncLROPoller that returns NetworkMapping. The NetworkMapping is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.NetworkMapping] + :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.NetworkMapping] = 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, + resource_name=resource_name, + fabric_name=fabric_name, + network_name=network_name, + network_mapping_name=network_mapping_name, + input=input, + 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.NetworkMapping, 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.NetworkMapping].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.NetworkMapping]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _update_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + network_name: str, + network_mapping_name: str, + input: Union[_models.UpdateNetworkMappingInput, JSON, 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(input, (IOBase, bytes)): + _content = input + else: + _content = json.dumps(input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_network_mappings_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + network_name=network_name, + network_mapping_name=network_mapping_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) + raise HttpResponseError(response=response, 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")) + + 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, + resource_name: str, + fabric_name: str, + network_name: str, + network_mapping_name: str, + input: _models.UpdateNetworkMappingInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NetworkMapping]: + """Updates network mapping. + + The operation to update an ASR network mapping. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param network_name: Primary network name. Required. + :type network_name: str + :param network_mapping_name: Network mapping name. Required. + :type network_mapping_name: str + :param input: Update network mapping input. Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.UpdateNetworkMappingInput + :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 NetworkMapping. The NetworkMapping is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.NetworkMapping] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + network_name: str, + network_mapping_name: str, + input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NetworkMapping]: + """Updates network mapping. + + The operation to update an ASR network mapping. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param network_name: Primary network name. Required. + :type network_name: str + :param network_mapping_name: Network mapping name. Required. + :type network_mapping_name: str + :param input: Update network mapping input. Required. + :type input: JSON + :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 NetworkMapping. The NetworkMapping is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.NetworkMapping] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + network_name: str, + network_mapping_name: str, + input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NetworkMapping]: + """Updates network mapping. + + The operation to update an ASR network mapping. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param network_name: Primary network name. Required. + :type network_name: str + :param network_mapping_name: Network mapping name. Required. + :type network_mapping_name: str + :param input: Update network mapping input. Required. + :type input: 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 NetworkMapping. The NetworkMapping is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.NetworkMapping] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + network_name: str, + network_mapping_name: str, + input: Union[_models.UpdateNetworkMappingInput, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.NetworkMapping]: + """Updates network mapping. + + The operation to update an ASR network mapping. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param network_name: Primary network name. Required. + :type network_name: str + :param network_mapping_name: Network mapping name. Required. + :type network_mapping_name: str + :param input: Update network mapping input. Is one of the following types: + UpdateNetworkMappingInput, JSON, IO[bytes] Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.UpdateNetworkMappingInput or JSON + or IO[bytes] + :return: An instance of AsyncLROPoller that returns NetworkMapping. The NetworkMapping is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.NetworkMapping] + :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.NetworkMapping] = 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, + resource_name=resource_name, + fabric_name=fabric_name, + network_name=network_name, + network_mapping_name=network_mapping_name, + input=input, + 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.NetworkMapping, 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.NetworkMapping].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.NetworkMapping]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + network_name: str, + network_mapping_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_replication_network_mappings_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + network_name=network_name, + network_mapping_name=network_mapping_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 [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) + raise HttpResponseError(response=response, 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")) + + 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, + resource_name: str, + fabric_name: str, + network_name: str, + network_mapping_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete network mapping. + + The operation to delete a network mapping. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param network_name: Primary network name. Required. + :type network_name: str + :param network_mapping_name: Network mapping name. Required. + :type network_mapping_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, + resource_name=resource_name, + fabric_name=fabric_name, + network_name=network_name, + network_mapping_name=network_mapping_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_replication_networks( + self, resource_group_name: str, resource_name: str, fabric_name: str, network_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.NetworkMapping"]: + """Gets all the network mappings under a network. + + Lists all ASR network mappings for the specified network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param network_name: Primary network name. Required. + :type network_name: str + :return: An iterator like instance of NetworkMapping + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.NetworkMapping] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.NetworkMapping]] = 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_replication_network_mappings_list_by_replication_networks_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + network_name=network_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), 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.NetworkMapping], + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.NetworkMapping"]: + """Gets all the network mappings under a vault. + + Lists all ASR network mappings in the vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :return: An iterator like instance of NetworkMapping + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.NetworkMapping] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.NetworkMapping]] = 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_replication_network_mappings_list_request( + resource_group_name=resource_group_name, + resource_name=resource_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), 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.NetworkMapping], + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class ReplicationProtectionContainersOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.aio.SiteRecoveryManagementClient`'s + :attr:`replication_protection_containers` 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: SiteRecoveryManagementClientConfiguration = ( + 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, + resource_name: str, + fabric_name: str, + protection_container_name: str, + **kwargs: Any + ) -> _models.ProtectionContainer: + """Gets the protection container details. + + Gets the details of a protection container. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :return: ProtectionContainer. The ProtectionContainer is compatible with MutableMapping + :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer + :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.ProtectionContainer] = kwargs.pop("cls", None) + + _request = build_replication_protection_containers_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ProtectionContainer, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + creation_input: Union[_models.CreateProtectionContainerInput, JSON, 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(creation_input, (IOBase, bytes)): + _content = creation_input + else: + _content = json.dumps(creation_input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_protection_containers_create_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_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) + raise HttpResponseError(response=response, 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")) + + 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, + resource_name: str, + fabric_name: str, + protection_container_name: str, + creation_input: _models.CreateProtectionContainerInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ProtectionContainer]: + """Create a protection container. + + Operation to create a protection container. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param creation_input: Creation input. Required. + :type creation_input: + ~azure.mgmt.recoveryservicessiterecovery.models.CreateProtectionContainerInput + :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 ProtectionContainer. The + ProtectionContainer is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + creation_input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ProtectionContainer]: + """Create a protection container. + + Operation to create a protection container. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param creation_input: Creation input. Required. + :type creation_input: JSON + :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 ProtectionContainer. The + ProtectionContainer is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + creation_input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ProtectionContainer]: + """Create a protection container. + + Operation to create a protection container. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param creation_input: Creation input. Required. + :type creation_input: 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 ProtectionContainer. The + ProtectionContainer is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + creation_input: Union[_models.CreateProtectionContainerInput, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.ProtectionContainer]: + """Create a protection container. + + Operation to create a protection container. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param creation_input: Creation input. Is one of the following types: + CreateProtectionContainerInput, JSON, IO[bytes] Required. + :type creation_input: + ~azure.mgmt.recoveryservicessiterecovery.models.CreateProtectionContainerInput or JSON or + IO[bytes] + :return: An instance of AsyncLROPoller that returns ProtectionContainer. The + ProtectionContainer is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] + :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.ProtectionContainer] = 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, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + creation_input=creation_input, + 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.ProtectionContainer, 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.ProtectionContainer].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ProtectionContainer]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def list_by_replication_fabrics( + self, resource_group_name: str, resource_name: str, fabric_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.ProtectionContainer"]: + """Gets the list of protection container for a fabric. + + Lists the protection containers in the specified fabric. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :return: An iterator like instance of ProtectionContainer + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ProtectionContainer]] = 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_replication_protection_containers_list_by_replication_fabrics_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_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), 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.ProtectionContainer], + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + async def _discover_protectable_item_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + discover_protectable_item_request: Union[_models.DiscoverProtectableItemRequest, JSON, 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(discover_protectable_item_request, (IOBase, bytes)): + _content = discover_protectable_item_request + else: + _content = json.dumps(discover_protectable_item_request, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_protection_containers_discover_protectable_item_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_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) + raise HttpResponseError(response=response, 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")) + + 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_discover_protectable_item( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + discover_protectable_item_request: _models.DiscoverProtectableItemRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ProtectionContainer]: + """Adds a protectable item to the replication protection container. + + The operation to a add a protectable item to a protection container(Add physical server). + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param discover_protectable_item_request: The request object to add a protectable item. + Required. + :type discover_protectable_item_request: + ~azure.mgmt.recoveryservicessiterecovery.models.DiscoverProtectableItemRequest + :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 ProtectionContainer. The + ProtectionContainer is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_discover_protectable_item( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + discover_protectable_item_request: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ProtectionContainer]: + """Adds a protectable item to the replication protection container. + + The operation to a add a protectable item to a protection container(Add physical server). + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param discover_protectable_item_request: The request object to add a protectable item. + Required. + :type discover_protectable_item_request: JSON + :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 ProtectionContainer. The + ProtectionContainer is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_discover_protectable_item( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + discover_protectable_item_request: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ProtectionContainer]: + """Adds a protectable item to the replication protection container. + + The operation to a add a protectable item to a protection container(Add physical server). + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param discover_protectable_item_request: The request object to add a protectable item. + Required. + :type discover_protectable_item_request: 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 ProtectionContainer. The + ProtectionContainer is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_discover_protectable_item( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + discover_protectable_item_request: Union[_models.DiscoverProtectableItemRequest, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.ProtectionContainer]: + """Adds a protectable item to the replication protection container. + + The operation to a add a protectable item to a protection container(Add physical server). + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param discover_protectable_item_request: The request object to add a protectable item. Is one + of the following types: DiscoverProtectableItemRequest, JSON, IO[bytes] Required. + :type discover_protectable_item_request: + ~azure.mgmt.recoveryservicessiterecovery.models.DiscoverProtectableItemRequest or JSON or + IO[bytes] + :return: An instance of AsyncLROPoller that returns ProtectionContainer. The + ProtectionContainer is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] + :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.ProtectionContainer] = 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._discover_protectable_item_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + discover_protectable_item_request=discover_protectable_item_request, + 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.ProtectionContainer, 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.ProtectionContainer].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ProtectionContainer]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_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_replication_protection_containers_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_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 [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) + raise HttpResponseError(response=response, 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")) + + 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, + resource_name: str, + fabric_name: str, + protection_container_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Removes a protection container. + + Operation to remove a protection container. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_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, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_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 + + async def _switch_cluster_protection_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + switch_input: Union[_models.SwitchClusterProtectionInput, JSON, 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(switch_input, (IOBase, bytes)): + _content = switch_input + else: + _content = json.dumps(switch_input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_protection_containers_switch_cluster_protection_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_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.ErrorResponse, + 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["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + 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_switch_cluster_protection( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + switch_input: _models.SwitchClusterProtectionInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ProtectionContainer]: + """Switches protection from one container to another. + + Operation to switch protection from one container to another. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param switch_input: Switch protection input. Required. + :type switch_input: + ~azure.mgmt.recoveryservicessiterecovery.models.SwitchClusterProtectionInput + :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 ProtectionContainer. The + ProtectionContainer is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_switch_cluster_protection( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + switch_input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ProtectionContainer]: + """Switches protection from one container to another. + + Operation to switch protection from one container to another. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param switch_input: Switch protection input. Required. + :type switch_input: JSON + :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 ProtectionContainer. The + ProtectionContainer is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_switch_cluster_protection( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + switch_input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ProtectionContainer]: + """Switches protection from one container to another. + + Operation to switch protection from one container to another. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param switch_input: Switch protection input. Required. + :type switch_input: 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 ProtectionContainer. The + ProtectionContainer is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_switch_cluster_protection( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + switch_input: Union[_models.SwitchClusterProtectionInput, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.ProtectionContainer]: + """Switches protection from one container to another. + + Operation to switch protection from one container to another. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param switch_input: Switch protection input. Is one of the following types: + SwitchClusterProtectionInput, JSON, IO[bytes] Required. + :type switch_input: + ~azure.mgmt.recoveryservicessiterecovery.models.SwitchClusterProtectionInput or JSON or + IO[bytes] + :return: An instance of AsyncLROPoller that returns ProtectionContainer. The + ProtectionContainer is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] + :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.ProtectionContainer] = 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._switch_cluster_protection_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + switch_input=switch_input, + 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["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.ProtectionContainer, 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.ProtectionContainer].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ProtectionContainer]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _switch_protection_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + switch_input: Union[_models.SwitchProtectionInput, JSON, 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(switch_input, (IOBase, bytes)): + _content = switch_input + else: + _content = json.dumps(switch_input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_protection_containers_switch_protection_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + 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_switch_protection( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + switch_input: _models.SwitchProtectionInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ProtectionContainer]: + """Switches protection from one container to another or one replication provider to another. + + Operation to switch protection from one container to another or one replication provider to + another. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param switch_input: Switch protection input. Required. + :type switch_input: ~azure.mgmt.recoveryservicessiterecovery.models.SwitchProtectionInput + :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 ProtectionContainer. The + ProtectionContainer is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_switch_protection( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + switch_input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ProtectionContainer]: + """Switches protection from one container to another or one replication provider to another. + + Operation to switch protection from one container to another or one replication provider to + another. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param switch_input: Switch protection input. Required. + :type switch_input: JSON + :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 ProtectionContainer. The + ProtectionContainer is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_switch_protection( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + switch_input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ProtectionContainer]: + """Switches protection from one container to another or one replication provider to another. + + Operation to switch protection from one container to another or one replication provider to + another. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param switch_input: Switch protection input. Required. + :type switch_input: 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 ProtectionContainer. The + ProtectionContainer is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_switch_protection( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + switch_input: Union[_models.SwitchProtectionInput, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.ProtectionContainer]: + """Switches protection from one container to another or one replication provider to another. + + Operation to switch protection from one container to another or one replication provider to + another. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param switch_input: Switch protection input. Is one of the following types: + SwitchProtectionInput, JSON, IO[bytes] Required. + :type switch_input: ~azure.mgmt.recoveryservicessiterecovery.models.SwitchProtectionInput or + JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns ProtectionContainer. The + ProtectionContainer is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] + :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.ProtectionContainer] = 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._switch_protection_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + switch_input=switch_input, + 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.ProtectionContainer, 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.ProtectionContainer].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ProtectionContainer]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def list( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.ProtectionContainer"]: + """Gets the list of all protection containers in a vault. + + Lists the protection containers in a vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :return: An iterator like instance of ProtectionContainer + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ProtectionContainer]] = 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_replication_protection_containers_list_request( + resource_group_name=resource_group_name, + resource_name=resource_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), 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.ProtectionContainer], + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class ReplicationMigrationItemsOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.aio.SiteRecoveryManagementClient`'s + :attr:`replication_migration_items` 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: SiteRecoveryManagementClientConfiguration = ( + 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, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + **kwargs: Any + ) -> _models.MigrationItem: + """Gets the details of a migration item. + + Gets the details of a migration item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :return: MigrationItem. The MigrationItem is compatible with MutableMapping + :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem + :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.MigrationItem] = kwargs.pop("cls", None) + + _request = build_replication_migration_items_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + migration_item_name=migration_item_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.MigrationItem, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + input: Union[_models.EnableMigrationInput, JSON, 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(input, (IOBase, bytes)): + _content = input + else: + _content = json.dumps(input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_migration_items_create_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + migration_item_name=migration_item_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) + raise HttpResponseError(response=response, 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")) + + 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, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + input: _models.EnableMigrationInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.MigrationItem]: + """Enables migration. + + The operation to create an ASR migration item (enable migration). + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param input: Enable migration input. Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.EnableMigrationInput + :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 MigrationItem. The MigrationItem is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.MigrationItem]: + """Enables migration. + + The operation to create an ASR migration item (enable migration). + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param input: Enable migration input. Required. + :type input: JSON + :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 MigrationItem. The MigrationItem is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.MigrationItem]: + """Enables migration. + + The operation to create an ASR migration item (enable migration). + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param input: Enable migration input. Required. + :type input: 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 MigrationItem. The MigrationItem is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + input: Union[_models.EnableMigrationInput, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.MigrationItem]: + """Enables migration. + + The operation to create an ASR migration item (enable migration). + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param input: Enable migration input. Is one of the following types: EnableMigrationInput, + JSON, IO[bytes] Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.EnableMigrationInput or JSON or + IO[bytes] + :return: An instance of AsyncLROPoller that returns MigrationItem. The MigrationItem is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :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.MigrationItem] = 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, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + migration_item_name=migration_item_name, + input=input, + 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.MigrationItem, 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.MigrationItem].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.MigrationItem]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _update_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + input: Union[_models.UpdateMigrationItemInput, JSON, 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(input, (IOBase, bytes)): + _content = input + else: + _content = json.dumps(input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_migration_items_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + migration_item_name=migration_item_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) + raise HttpResponseError(response=response, 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")) + + 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, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + input: _models.UpdateMigrationItemInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.MigrationItem]: + """Updates migration item. + + The operation to update the recovery settings of an ASR migration item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param input: Update migration item input. Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.UpdateMigrationItemInput + :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 MigrationItem. The MigrationItem is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.MigrationItem]: + """Updates migration item. + + The operation to update the recovery settings of an ASR migration item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param input: Update migration item input. Required. + :type input: JSON + :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 MigrationItem. The MigrationItem is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.MigrationItem]: + """Updates migration item. + + The operation to update the recovery settings of an ASR migration item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param input: Update migration item input. Required. + :type input: 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 MigrationItem. The MigrationItem is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + input: Union[_models.UpdateMigrationItemInput, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.MigrationItem]: + """Updates migration item. + + The operation to update the recovery settings of an ASR migration item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param input: Update migration item input. Is one of the following types: + UpdateMigrationItemInput, JSON, IO[bytes] Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.UpdateMigrationItemInput or JSON + or IO[bytes] + :return: An instance of AsyncLROPoller that returns MigrationItem. The MigrationItem is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :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.MigrationItem] = 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, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + migration_item_name=migration_item_name, + input=input, + 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.MigrationItem, 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.MigrationItem].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.MigrationItem]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + *, + delete_option: Optional[str] = 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 = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_replication_migration_items_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + migration_item_name=migration_item_name, + subscription_id=self._config.subscription_id, + delete_option=delete_option, + 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 [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) + raise HttpResponseError(response=response, 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")) + + 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, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + *, + delete_option: Optional[str] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete the migration item. + + The operation to delete an ASR migration item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :keyword delete_option: The delete option. Default value is None. + :paramtype delete_option: 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, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + migration_item_name=migration_item_name, + delete_option=delete_option, + 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_replication_protection_containers( # pylint: disable=name-too-long + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + *, + skip_token: Optional[str] = None, + take_token: Optional[str] = None, + filter: Optional[str] = None, + **kwargs: Any + ) -> AsyncItemPaged["_models.MigrationItem"]: + """Gets the list of migration items in the protection container. + + Gets the list of ASR migration items in the protection container. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :keyword skip_token: The pagination token. Default value is None. + :paramtype skip_token: str + :keyword take_token: The page size. Default value is None. + :paramtype take_token: str + :keyword filter: OData filter options. Default value is None. + :paramtype filter: str + :return: An iterator like instance of MigrationItem + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.MigrationItem]] = 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_replication_migration_items_list_by_replication_protection_containers_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + subscription_id=self._config.subscription_id, + skip_token=skip_token, + take_token=take_token, + filter=filter, + 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), 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.MigrationItem], + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + async def _migrate_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + migrate_input: Union[_models.MigrateInput, JSON, 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(migrate_input, (IOBase, bytes)): + _content = migrate_input + else: + _content = json.dumps(migrate_input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_migration_items_migrate_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + migration_item_name=migration_item_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) + raise HttpResponseError(response=response, 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")) + + 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_migrate( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + migrate_input: _models.MigrateInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.MigrationItem]: + """Migrate item. + + The operation to initiate migration of the item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param migrate_input: Migrate input. Required. + :type migrate_input: ~azure.mgmt.recoveryservicessiterecovery.models.MigrateInput + :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 MigrationItem. The MigrationItem is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_migrate( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + migrate_input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.MigrationItem]: + """Migrate item. + + The operation to initiate migration of the item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param migrate_input: Migrate input. Required. + :type migrate_input: JSON + :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 MigrationItem. The MigrationItem is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_migrate( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + migrate_input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.MigrationItem]: + """Migrate item. + + The operation to initiate migration of the item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param migrate_input: Migrate input. Required. + :type migrate_input: 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 MigrationItem. The MigrationItem is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_migrate( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + migrate_input: Union[_models.MigrateInput, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.MigrationItem]: + """Migrate item. + + The operation to initiate migration of the item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param migrate_input: Migrate input. Is one of the following types: MigrateInput, JSON, + IO[bytes] Required. + :type migrate_input: ~azure.mgmt.recoveryservicessiterecovery.models.MigrateInput or JSON or + IO[bytes] + :return: An instance of AsyncLROPoller that returns MigrationItem. The MigrationItem is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :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.MigrationItem] = 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._migrate_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + migration_item_name=migration_item_name, + migrate_input=migrate_input, + 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.MigrationItem, 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.MigrationItem].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.MigrationItem]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _pause_replication_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + pause_replication_input: Union[_models.PauseReplicationInput, JSON, 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(pause_replication_input, (IOBase, bytes)): + _content = pause_replication_input + else: + _content = json.dumps(pause_replication_input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_migration_items_pause_replication_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + migration_item_name=migration_item_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) + raise HttpResponseError(response=response, 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")) + + 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_pause_replication( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + pause_replication_input: _models.PauseReplicationInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.MigrationItem]: + """Pause replication. + + The operation to initiate pause replication of the item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param pause_replication_input: Pause replication input. Required. + :type pause_replication_input: + ~azure.mgmt.recoveryservicessiterecovery.models.PauseReplicationInput + :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 MigrationItem. The MigrationItem is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_pause_replication( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + pause_replication_input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.MigrationItem]: + """Pause replication. + + The operation to initiate pause replication of the item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param pause_replication_input: Pause replication input. Required. + :type pause_replication_input: JSON + :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 MigrationItem. The MigrationItem is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_pause_replication( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + pause_replication_input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.MigrationItem]: + """Pause replication. + + The operation to initiate pause replication of the item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param pause_replication_input: Pause replication input. Required. + :type pause_replication_input: 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 MigrationItem. The MigrationItem is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_pause_replication( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + pause_replication_input: Union[_models.PauseReplicationInput, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.MigrationItem]: + """Pause replication. + + The operation to initiate pause replication of the item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param pause_replication_input: Pause replication input. Is one of the following types: + PauseReplicationInput, JSON, IO[bytes] Required. + :type pause_replication_input: + ~azure.mgmt.recoveryservicessiterecovery.models.PauseReplicationInput or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns MigrationItem. The MigrationItem is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :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.MigrationItem] = 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._pause_replication_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + migration_item_name=migration_item_name, + pause_replication_input=pause_replication_input, + 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.MigrationItem, 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.MigrationItem].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.MigrationItem]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _resume_replication_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + resume_replication_input: Union[_models.ResumeReplicationInput, JSON, 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(resume_replication_input, (IOBase, bytes)): + _content = resume_replication_input + else: + _content = json.dumps(resume_replication_input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_migration_items_resume_replication_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + migration_item_name=migration_item_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) + raise HttpResponseError(response=response, 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")) + + 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_resume_replication( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + resume_replication_input: _models.ResumeReplicationInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.MigrationItem]: + """Resume replication. + + The operation to initiate resume replication of the item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param resume_replication_input: Resume replication input. Required. + :type resume_replication_input: + ~azure.mgmt.recoveryservicessiterecovery.models.ResumeReplicationInput + :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 MigrationItem. The MigrationItem is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_resume_replication( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + resume_replication_input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.MigrationItem]: + """Resume replication. + + The operation to initiate resume replication of the item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param resume_replication_input: Resume replication input. Required. + :type resume_replication_input: JSON + :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 MigrationItem. The MigrationItem is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_resume_replication( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + resume_replication_input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.MigrationItem]: + """Resume replication. + + The operation to initiate resume replication of the item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param resume_replication_input: Resume replication input. Required. + :type resume_replication_input: 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 MigrationItem. The MigrationItem is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_resume_replication( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + resume_replication_input: Union[_models.ResumeReplicationInput, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.MigrationItem]: + """Resume replication. + + The operation to initiate resume replication of the item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param resume_replication_input: Resume replication input. Is one of the following types: + ResumeReplicationInput, JSON, IO[bytes] Required. + :type resume_replication_input: + ~azure.mgmt.recoveryservicessiterecovery.models.ResumeReplicationInput or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns MigrationItem. The MigrationItem is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :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.MigrationItem] = 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._resume_replication_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + migration_item_name=migration_item_name, + resume_replication_input=resume_replication_input, + 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.MigrationItem, 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.MigrationItem].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.MigrationItem]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _resync_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + input: Union[_models.ResyncInput, JSON, 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(input, (IOBase, bytes)): + _content = input + else: + _content = json.dumps(input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_migration_items_resync_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + migration_item_name=migration_item_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) + raise HttpResponseError(response=response, 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")) + + 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_resync( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + input: _models.ResyncInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.MigrationItem]: + """Resynchronizes replication. + + The operation to resynchronize replication of an ASR migration item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param input: Resync input. Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.ResyncInput + :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 MigrationItem. The MigrationItem is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_resync( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.MigrationItem]: + """Resynchronizes replication. + + The operation to resynchronize replication of an ASR migration item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param input: Resync input. Required. + :type input: JSON + :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 MigrationItem. The MigrationItem is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_resync( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.MigrationItem]: + """Resynchronizes replication. + + The operation to resynchronize replication of an ASR migration item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param input: Resync input. Required. + :type input: 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 MigrationItem. The MigrationItem is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_resync( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + input: Union[_models.ResyncInput, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.MigrationItem]: + """Resynchronizes replication. + + The operation to resynchronize replication of an ASR migration item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param input: Resync input. Is one of the following types: ResyncInput, JSON, IO[bytes] + Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.ResyncInput or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns MigrationItem. The MigrationItem is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :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.MigrationItem] = 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._resync_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + migration_item_name=migration_item_name, + input=input, + 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.MigrationItem, 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.MigrationItem].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.MigrationItem]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _test_migrate_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + test_migrate_input: Union[_models.TestMigrateInput, JSON, 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(test_migrate_input, (IOBase, bytes)): + _content = test_migrate_input + else: + _content = json.dumps(test_migrate_input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_migration_items_test_migrate_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + migration_item_name=migration_item_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) + raise HttpResponseError(response=response, 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")) + + 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_test_migrate( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + test_migrate_input: _models.TestMigrateInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.MigrationItem]: + """Test migrate item. + + The operation to initiate test migration of the item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param test_migrate_input: Test migrate input. Required. + :type test_migrate_input: ~azure.mgmt.recoveryservicessiterecovery.models.TestMigrateInput + :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 MigrationItem. The MigrationItem is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_test_migrate( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + test_migrate_input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.MigrationItem]: + """Test migrate item. + + The operation to initiate test migration of the item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param test_migrate_input: Test migrate input. Required. + :type test_migrate_input: JSON + :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 MigrationItem. The MigrationItem is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_test_migrate( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + test_migrate_input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.MigrationItem]: + """Test migrate item. + + The operation to initiate test migration of the item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param test_migrate_input: Test migrate input. Required. + :type test_migrate_input: 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 MigrationItem. The MigrationItem is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_test_migrate( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + test_migrate_input: Union[_models.TestMigrateInput, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.MigrationItem]: + """Test migrate item. + + The operation to initiate test migration of the item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param test_migrate_input: Test migrate input. Is one of the following types: TestMigrateInput, + JSON, IO[bytes] Required. + :type test_migrate_input: ~azure.mgmt.recoveryservicessiterecovery.models.TestMigrateInput or + JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns MigrationItem. The MigrationItem is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :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.MigrationItem] = 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._test_migrate_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + migration_item_name=migration_item_name, + test_migrate_input=test_migrate_input, + 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.MigrationItem, 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.MigrationItem].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.MigrationItem]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _test_migrate_cleanup_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + test_migrate_cleanup_input: Union[_models.TestMigrateCleanupInput, JSON, 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(test_migrate_cleanup_input, (IOBase, bytes)): + _content = test_migrate_cleanup_input + else: + _content = json.dumps(test_migrate_cleanup_input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_migration_items_test_migrate_cleanup_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + migration_item_name=migration_item_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) + raise HttpResponseError(response=response, 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")) + + 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_test_migrate_cleanup( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + test_migrate_cleanup_input: _models.TestMigrateCleanupInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.MigrationItem]: + """Test migrate cleanup. + + The operation to initiate test migrate cleanup. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param test_migrate_cleanup_input: Test migrate cleanup input. Required. + :type test_migrate_cleanup_input: + ~azure.mgmt.recoveryservicessiterecovery.models.TestMigrateCleanupInput + :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 MigrationItem. The MigrationItem is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_test_migrate_cleanup( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + test_migrate_cleanup_input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.MigrationItem]: + """Test migrate cleanup. + + The operation to initiate test migrate cleanup. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param test_migrate_cleanup_input: Test migrate cleanup input. Required. + :type test_migrate_cleanup_input: JSON + :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 MigrationItem. The MigrationItem is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_test_migrate_cleanup( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + test_migrate_cleanup_input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.MigrationItem]: + """Test migrate cleanup. + + The operation to initiate test migrate cleanup. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param test_migrate_cleanup_input: Test migrate cleanup input. Required. + :type test_migrate_cleanup_input: 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 MigrationItem. The MigrationItem is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_test_migrate_cleanup( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + test_migrate_cleanup_input: Union[_models.TestMigrateCleanupInput, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.MigrationItem]: + """Test migrate cleanup. + + The operation to initiate test migrate cleanup. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param test_migrate_cleanup_input: Test migrate cleanup input. Is one of the following types: + TestMigrateCleanupInput, JSON, IO[bytes] Required. + :type test_migrate_cleanup_input: + ~azure.mgmt.recoveryservicessiterecovery.models.TestMigrateCleanupInput or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns MigrationItem. The MigrationItem is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :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.MigrationItem] = 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._test_migrate_cleanup_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + migration_item_name=migration_item_name, + test_migrate_cleanup_input=test_migrate_cleanup_input, + 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.MigrationItem, 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.MigrationItem].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.MigrationItem]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def list( + self, + resource_group_name: str, + resource_name: str, + *, + skip_token: Optional[str] = None, + take_token: Optional[str] = None, + filter: Optional[str] = None, + **kwargs: Any + ) -> AsyncItemPaged["_models.MigrationItem"]: + """Gets the list of migration items in the vault. + + Gets the list of migration items in the vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :keyword skip_token: The pagination token. Default value is None. + :paramtype skip_token: str + :keyword take_token: The page size. Default value is None. + :paramtype take_token: str + :keyword filter: OData filter options. Default value is None. + :paramtype filter: str + :return: An iterator like instance of MigrationItem + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.MigrationItem]] = 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_replication_migration_items_list_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + skip_token=skip_token, + take_token=take_token, + filter=filter, + 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), 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.MigrationItem], + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class ReplicationProtectableItemsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.aio.SiteRecoveryManagementClient`'s + :attr:`replication_protectable_items` 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: SiteRecoveryManagementClientConfiguration = ( + 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, + resource_name: str, + fabric_name: str, + protection_container_name: str, + protectable_item_name: str, + **kwargs: Any + ) -> _models.ProtectableItem: + """Gets the details of a protectable item. + + The operation to get the details of a protectable item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param protectable_item_name: Protectable item name. Required. + :type protectable_item_name: str + :return: ProtectableItem. The ProtectableItem is compatible with MutableMapping + :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.ProtectableItem + :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.ProtectableItem] = kwargs.pop("cls", None) + + _request = build_replication_protectable_items_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + protectable_item_name=protectable_item_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ProtectableItem, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_replication_protection_containers( # pylint: disable=name-too-long + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + *, + filter: Optional[str] = None, + take: Optional[str] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> AsyncItemPaged["_models.ProtectableItem"]: + """Gets the list of protectable items. + + Lists the protectable items in a protection container. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :keyword filter: OData filter options. Default value is None. + :paramtype filter: str + :keyword take: take OData query parameter. Default value is None. + :paramtype take: str + :keyword skip_token: skipToken OData query parameter. Default value is None. + :paramtype skip_token: str + :return: An iterator like instance of ProtectableItem + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.ProtectableItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ProtectableItem]] = 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_replication_protectable_items_list_by_replication_protection_containers_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + subscription_id=self._config.subscription_id, + filter=filter, + take=take, + skip_token=skip_token, + 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), 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.ProtectableItem], + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class ClusterRecoveryPointOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.aio.SiteRecoveryManagementClient`'s + :attr:`cluster_recovery_point` 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: SiteRecoveryManagementClientConfiguration = ( + 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, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replication_protection_cluster_name: str, + recovery_point_name: str, + **kwargs: Any + ) -> _models.ClusterRecoveryPoint: + """Gets a recovery point. + + Get the details of specified recovery point. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replication_protection_cluster_name: Replication protection cluster name. Required. + :type replication_protection_cluster_name: str + :param recovery_point_name: The recovery point name. Required. + :type recovery_point_name: str + :return: ClusterRecoveryPoint. The ClusterRecoveryPoint is compatible with MutableMapping + :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.ClusterRecoveryPoint + :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.ClusterRecoveryPoint] = kwargs.pop("cls", None) + + _request = build_cluster_recovery_point_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replication_protection_cluster_name=replication_protection_cluster_name, + recovery_point_name=recovery_point_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.ErrorResponse, + 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.ClusterRecoveryPoint, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class ReplicationProtectionContainerMappingsOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.aio.SiteRecoveryManagementClient`'s + :attr:`replication_protection_container_mappings` 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: SiteRecoveryManagementClientConfiguration = ( + 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, + resource_name: str, + fabric_name: str, + protection_container_name: str, + mapping_name: str, + **kwargs: Any + ) -> _models.ProtectionContainerMapping: + """Gets a protection container mapping. + + Gets the details of a protection container mapping. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param mapping_name: Protection Container mapping name. Required. + :type mapping_name: str + :return: ProtectionContainerMapping. The ProtectionContainerMapping is compatible with + MutableMapping + :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerMapping + :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.ProtectionContainerMapping] = kwargs.pop("cls", None) + + _request = build_replication_protection_container_mappings_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + mapping_name=mapping_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ProtectionContainerMapping, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + mapping_name: str, + creation_input: Union[_models.CreateProtectionContainerMappingInput, JSON, 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(creation_input, (IOBase, bytes)): + _content = creation_input + else: + _content = json.dumps(creation_input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_protection_container_mappings_create_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + mapping_name=mapping_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) + raise HttpResponseError(response=response, 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")) + + 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, + resource_name: str, + fabric_name: str, + protection_container_name: str, + mapping_name: str, + creation_input: _models.CreateProtectionContainerMappingInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ProtectionContainerMapping]: + """Create protection container mapping. + + The operation to create a protection container mapping. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param mapping_name: Protection Container mapping name. Required. + :type mapping_name: str + :param creation_input: Mapping creation input. Required. + :type creation_input: + ~azure.mgmt.recoveryservicessiterecovery.models.CreateProtectionContainerMappingInput + :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 ProtectionContainerMapping. The + ProtectionContainerMapping is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerMapping] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + mapping_name: str, + creation_input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ProtectionContainerMapping]: + """Create protection container mapping. + + The operation to create a protection container mapping. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param mapping_name: Protection Container mapping name. Required. + :type mapping_name: str + :param creation_input: Mapping creation input. Required. + :type creation_input: JSON + :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 ProtectionContainerMapping. The + ProtectionContainerMapping is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerMapping] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + mapping_name: str, + creation_input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ProtectionContainerMapping]: + """Create protection container mapping. + + The operation to create a protection container mapping. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param mapping_name: Protection Container mapping name. Required. + :type mapping_name: str + :param creation_input: Mapping creation input. Required. + :type creation_input: 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 ProtectionContainerMapping. The + ProtectionContainerMapping is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerMapping] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + mapping_name: str, + creation_input: Union[_models.CreateProtectionContainerMappingInput, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.ProtectionContainerMapping]: + """Create protection container mapping. + + The operation to create a protection container mapping. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param mapping_name: Protection Container mapping name. Required. + :type mapping_name: str + :param creation_input: Mapping creation input. Is one of the following types: + CreateProtectionContainerMappingInput, JSON, IO[bytes] Required. + :type creation_input: + ~azure.mgmt.recoveryservicessiterecovery.models.CreateProtectionContainerMappingInput or JSON + or IO[bytes] + :return: An instance of AsyncLROPoller that returns ProtectionContainerMapping. The + ProtectionContainerMapping is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerMapping] + :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.ProtectionContainerMapping] = 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, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + mapping_name=mapping_name, + creation_input=creation_input, + 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.ProtectionContainerMapping, 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.ProtectionContainerMapping].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ProtectionContainerMapping]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _update_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + mapping_name: str, + update_input: Union[_models.UpdateProtectionContainerMappingInput, JSON, 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(update_input, (IOBase, bytes)): + _content = update_input + else: + _content = json.dumps(update_input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_protection_container_mappings_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + mapping_name=mapping_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) + raise HttpResponseError(response=response, 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")) + + 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, + resource_name: str, + fabric_name: str, + protection_container_name: str, + mapping_name: str, + update_input: _models.UpdateProtectionContainerMappingInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ProtectionContainerMapping]: + """Update protection container mapping. + + The operation to update protection container mapping. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param mapping_name: Protection Container mapping name. Required. + :type mapping_name: str + :param update_input: Mapping update input. Required. + :type update_input: + ~azure.mgmt.recoveryservicessiterecovery.models.UpdateProtectionContainerMappingInput + :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 ProtectionContainerMapping. The + ProtectionContainerMapping is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerMapping] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + mapping_name: str, + update_input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ProtectionContainerMapping]: + """Update protection container mapping. + + The operation to update protection container mapping. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param mapping_name: Protection Container mapping name. Required. + :type mapping_name: str + :param update_input: Mapping update input. Required. + :type update_input: JSON + :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 ProtectionContainerMapping. The + ProtectionContainerMapping is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerMapping] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + mapping_name: str, + update_input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ProtectionContainerMapping]: + """Update protection container mapping. + + The operation to update protection container mapping. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param mapping_name: Protection Container mapping name. Required. + :type mapping_name: str + :param update_input: Mapping update input. Required. + :type update_input: 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 ProtectionContainerMapping. The + ProtectionContainerMapping is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerMapping] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + mapping_name: str, + update_input: Union[_models.UpdateProtectionContainerMappingInput, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.ProtectionContainerMapping]: + """Update protection container mapping. + + The operation to update protection container mapping. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param mapping_name: Protection Container mapping name. Required. + :type mapping_name: str + :param update_input: Mapping update input. Is one of the following types: + UpdateProtectionContainerMappingInput, JSON, IO[bytes] Required. + :type update_input: + ~azure.mgmt.recoveryservicessiterecovery.models.UpdateProtectionContainerMappingInput or JSON + or IO[bytes] + :return: An instance of AsyncLROPoller that returns ProtectionContainerMapping. The + ProtectionContainerMapping is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerMapping] + :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.ProtectionContainerMapping] = 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, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + mapping_name=mapping_name, + update_input=update_input, + 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.ProtectionContainerMapping, 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.ProtectionContainerMapping].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ProtectionContainerMapping]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _purge_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + mapping_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_replication_protection_container_mappings_purge_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + mapping_name=mapping_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 [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) + raise HttpResponseError(response=response, 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")) + + 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_purge( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + mapping_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Purge protection container mapping. + + The operation to purge(force delete) a protection container mapping. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param mapping_name: Protection Container mapping name. Required. + :type mapping_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._purge_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + mapping_name=mapping_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_replication_protection_containers( # pylint: disable=name-too-long + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + **kwargs: Any + ) -> AsyncItemPaged["_models.ProtectionContainerMapping"]: + """Gets the list of protection container mappings for a protection container. + + Lists the protection container mappings for a protection container. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :return: An iterator like instance of ProtectionContainerMapping + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerMapping] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ProtectionContainerMapping]] = 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_replication_protection_container_mappings_list_by_replication_protection_containers_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_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), 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.ProtectionContainerMapping], + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + async def _delete_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + mapping_name: str, + removal_input: Union[_models.RemoveProtectionContainerMappingInput, JSON, 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(removal_input, (IOBase, bytes)): + _content = removal_input + else: + _content = json.dumps(removal_input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_protection_container_mappings_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + mapping_name=mapping_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 [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) + raise HttpResponseError(response=response, 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")) + + 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_delete( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + mapping_name: str, + removal_input: _models.RemoveProtectionContainerMappingInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Remove protection container mapping. + + The operation to delete or remove a protection container mapping. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param mapping_name: Protection Container mapping name. Required. + :type mapping_name: str + :param removal_input: Removal input. Required. + :type removal_input: + ~azure.mgmt.recoveryservicessiterecovery.models.RemoveProtectionContainerMappingInput + :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_delete( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + mapping_name: str, + removal_input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Remove protection container mapping. + + The operation to delete or remove a protection container mapping. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param mapping_name: Protection Container mapping name. Required. + :type mapping_name: str + :param removal_input: Removal input. Required. + :type removal_input: JSON + :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_delete( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + mapping_name: str, + removal_input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Remove protection container mapping. + + The operation to delete or remove a protection container mapping. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param mapping_name: Protection Container mapping name. Required. + :type mapping_name: str + :param removal_input: Removal input. Required. + :type removal_input: 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_delete( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + mapping_name: str, + removal_input: Union[_models.RemoveProtectionContainerMappingInput, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Remove protection container mapping. + + The operation to delete or remove a protection container mapping. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param mapping_name: Protection Container mapping name. Required. + :type mapping_name: str + :param removal_input: Removal input. Is one of the following types: + RemoveProtectionContainerMappingInput, JSON, IO[bytes] Required. + :type removal_input: + ~azure.mgmt.recoveryservicessiterecovery.models.RemoveProtectionContainerMappingInput or JSON + 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._delete_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + mapping_name=mapping_name, + removal_input=removal_input, + 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 + def list( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.ProtectionContainerMapping"]: + """Gets the list of all protection container mappings in a vault. + + Lists the protection container mappings in the vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :return: An iterator like instance of ProtectionContainerMapping + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerMapping] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ProtectionContainerMapping]] = 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_replication_protection_container_mappings_list_request( + resource_group_name=resource_group_name, + resource_name=resource_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), 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.ProtectionContainerMapping], + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class ReplicationRecoveryServicesProvidersOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.aio.SiteRecoveryManagementClient`'s + :attr:`replication_recovery_services_providers` 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: SiteRecoveryManagementClientConfiguration = ( + 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, resource_name: str, fabric_name: str, provider_name: str, **kwargs: Any + ) -> _models.RecoveryServicesProvider: + """Gets the details of a recovery services provider. + + Gets the details of registered recovery services provider. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param provider_name: Recovery services provider name. Required. + :type provider_name: str + :return: RecoveryServicesProvider. The RecoveryServicesProvider is compatible with + MutableMapping + :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryServicesProvider + :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.RecoveryServicesProvider] = kwargs.pop("cls", None) + + _request = build_replication_recovery_services_providers_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + provider_name=provider_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.RecoveryServicesProvider, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + provider_name: str, + add_provider_input: Union[_models.AddRecoveryServicesProviderInput, JSON, 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(add_provider_input, (IOBase, bytes)): + _content = add_provider_input + else: + _content = json.dumps(add_provider_input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_recovery_services_providers_create_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + provider_name=provider_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) + raise HttpResponseError(response=response, 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")) + + 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, + resource_name: str, + fabric_name: str, + provider_name: str, + add_provider_input: _models.AddRecoveryServicesProviderInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RecoveryServicesProvider]: + """Adds a recovery services provider. + + The operation to add a recovery services provider. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param provider_name: Recovery services provider name. Required. + :type provider_name: str + :param add_provider_input: Add provider input. Required. + :type add_provider_input: + ~azure.mgmt.recoveryservicessiterecovery.models.AddRecoveryServicesProviderInput + :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 RecoveryServicesProvider. The + RecoveryServicesProvider is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryServicesProvider] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + provider_name: str, + add_provider_input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RecoveryServicesProvider]: + """Adds a recovery services provider. + + The operation to add a recovery services provider. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param provider_name: Recovery services provider name. Required. + :type provider_name: str + :param add_provider_input: Add provider input. Required. + :type add_provider_input: JSON + :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 RecoveryServicesProvider. The + RecoveryServicesProvider is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryServicesProvider] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + provider_name: str, + add_provider_input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RecoveryServicesProvider]: + """Adds a recovery services provider. + + The operation to add a recovery services provider. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param provider_name: Recovery services provider name. Required. + :type provider_name: str + :param add_provider_input: Add provider input. Required. + :type add_provider_input: 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 RecoveryServicesProvider. The + RecoveryServicesProvider is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryServicesProvider] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + provider_name: str, + add_provider_input: Union[_models.AddRecoveryServicesProviderInput, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.RecoveryServicesProvider]: + """Adds a recovery services provider. + + The operation to add a recovery services provider. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param provider_name: Recovery services provider name. Required. + :type provider_name: str + :param add_provider_input: Add provider input. Is one of the following types: + AddRecoveryServicesProviderInput, JSON, IO[bytes] Required. + :type add_provider_input: + ~azure.mgmt.recoveryservicessiterecovery.models.AddRecoveryServicesProviderInput or JSON or + IO[bytes] + :return: An instance of AsyncLROPoller that returns RecoveryServicesProvider. The + RecoveryServicesProvider is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryServicesProvider] + :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.RecoveryServicesProvider] = 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, + resource_name=resource_name, + fabric_name=fabric_name, + provider_name=provider_name, + add_provider_input=add_provider_input, + 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.RecoveryServicesProvider, 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.RecoveryServicesProvider].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.RecoveryServicesProvider]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _purge_initial( + self, resource_group_name: str, resource_name: str, fabric_name: str, provider_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_replication_recovery_services_providers_purge_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + provider_name=provider_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 [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) + raise HttpResponseError(response=response, 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")) + + 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_purge( + self, resource_group_name: str, resource_name: str, fabric_name: str, provider_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Purges recovery service provider from fabric. + + The operation to purge(force delete) a recovery services provider from the vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param provider_name: Recovery services provider name. Required. + :type provider_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._purge_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + provider_name=provider_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_replication_fabrics( + self, resource_group_name: str, resource_name: str, fabric_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.RecoveryServicesProvider"]: + """Gets the list of registered recovery services providers for the fabric. + + Lists the registered recovery services providers for the specified fabric. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :return: An iterator like instance of RecoveryServicesProvider + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryServicesProvider] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.RecoveryServicesProvider]] = 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_replication_recovery_services_providers_list_by_replication_fabrics_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_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), 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.RecoveryServicesProvider], + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + async def _refresh_provider_initial( + self, resource_group_name: str, resource_name: str, fabric_name: str, provider_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_replication_recovery_services_providers_refresh_provider_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + provider_name=provider_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) + raise HttpResponseError(response=response, 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")) + + 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_refresh_provider( + self, resource_group_name: str, resource_name: str, fabric_name: str, provider_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.RecoveryServicesProvider]: + """Refresh details from the recovery services provider. + + The operation to refresh the information from the recovery services provider. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param provider_name: Recovery services provider name. Required. + :type provider_name: str + :return: An instance of AsyncLROPoller that returns RecoveryServicesProvider. The + RecoveryServicesProvider is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryServicesProvider] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.RecoveryServicesProvider] = 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._refresh_provider_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + provider_name=provider_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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.RecoveryServicesProvider, 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.RecoveryServicesProvider].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.RecoveryServicesProvider]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, resource_name: str, fabric_name: str, provider_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_replication_recovery_services_providers_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + provider_name=provider_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 [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) + raise HttpResponseError(response=response, 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")) + + 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, resource_name: str, fabric_name: str, provider_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes provider from fabric. Note: Deleting provider for any fabric other than SingleHost is + unsupported. To maintain backward compatibility for released clients the object + "deleteRspInput" is used (if the object is empty we assume that it is old client and continue + the old behavior). + + The operation to removes/delete(unregister) a recovery services provider from the vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param provider_name: Recovery services provider name. Required. + :type provider_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, + resource_name=resource_name, + fabric_name=fabric_name, + provider_name=provider_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( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.RecoveryServicesProvider"]: + """Gets the list of registered recovery services providers in the vault. This is a view only api. + + Lists the registered recovery services providers in the vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :return: An iterator like instance of RecoveryServicesProvider + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryServicesProvider] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.RecoveryServicesProvider]] = 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_replication_recovery_services_providers_list_request( + resource_group_name=resource_group_name, + resource_name=resource_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), 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.RecoveryServicesProvider], + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class ReplicationStorageClassificationsOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.aio.SiteRecoveryManagementClient`'s + :attr:`replication_storage_classifications` 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: SiteRecoveryManagementClientConfiguration = ( + 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, + resource_name: str, + fabric_name: str, + storage_classification_name: str, + **kwargs: Any + ) -> _models.StorageClassification: + """Gets the details of a storage classification. + + Gets the details of the specified storage classification. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param storage_classification_name: Storage classification name. Required. + :type storage_classification_name: str + :return: StorageClassification. The StorageClassification is compatible with MutableMapping + :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.StorageClassification + :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.StorageClassification] = kwargs.pop("cls", None) + + _request = build_replication_storage_classifications_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + storage_classification_name=storage_classification_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.StorageClassification, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_replication_fabrics( + self, resource_group_name: str, resource_name: str, fabric_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.StorageClassification"]: + """Gets the list of storage classification objects under a fabric. + + Lists the storage classifications available in the specified fabric. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :return: An iterator like instance of StorageClassification + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.StorageClassification] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.StorageClassification]] = 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_replication_storage_classifications_list_by_replication_fabrics_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_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), 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.StorageClassification], + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.StorageClassification"]: + """Gets the list of storage classification objects under a vault. + + Lists the storage classifications in the vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :return: An iterator like instance of StorageClassification + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.StorageClassification] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.StorageClassification]] = 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_replication_storage_classifications_list_request( + resource_group_name=resource_group_name, + resource_name=resource_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), 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.StorageClassification], + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class ReplicationStorageClassificationMappingsOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.aio.SiteRecoveryManagementClient`'s + :attr:`replication_storage_classification_mappings` 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: SiteRecoveryManagementClientConfiguration = ( + 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, + resource_name: str, + fabric_name: str, + storage_classification_name: str, + storage_classification_mapping_name: str, + **kwargs: Any + ) -> _models.StorageClassificationMapping: + """Gets the details of a storage classification mapping. + + Gets the details of the specified storage classification mapping. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param storage_classification_name: Storage classification name. Required. + :type storage_classification_name: str + :param storage_classification_mapping_name: Storage classification mapping name. Required. + :type storage_classification_mapping_name: str + :return: StorageClassificationMapping. The StorageClassificationMapping is compatible with + MutableMapping + :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.StorageClassificationMapping + :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.StorageClassificationMapping] = kwargs.pop("cls", None) + + _request = build_replication_storage_classification_mappings_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + storage_classification_name=storage_classification_name, + storage_classification_mapping_name=storage_classification_mapping_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.StorageClassificationMapping, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + storage_classification_name: str, + storage_classification_mapping_name: str, + pairing_input: Union[_models.StorageClassificationMappingInput, JSON, 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(pairing_input, (IOBase, bytes)): + _content = pairing_input + else: + _content = json.dumps(pairing_input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_storage_classification_mappings_create_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + storage_classification_name=storage_classification_name, + storage_classification_mapping_name=storage_classification_mapping_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) + raise HttpResponseError(response=response, 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")) + + 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, + resource_name: str, + fabric_name: str, + storage_classification_name: str, + storage_classification_mapping_name: str, + pairing_input: _models.StorageClassificationMappingInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.StorageClassificationMapping]: + """Create storage classification mapping. + + The operation to create a storage classification mapping. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param storage_classification_name: Storage classification name. Required. + :type storage_classification_name: str + :param storage_classification_mapping_name: Storage classification mapping name. Required. + :type storage_classification_mapping_name: str + :param pairing_input: Pairing input. Required. + :type pairing_input: + ~azure.mgmt.recoveryservicessiterecovery.models.StorageClassificationMappingInput + :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 StorageClassificationMapping. The + StorageClassificationMapping is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.StorageClassificationMapping] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + storage_classification_name: str, + storage_classification_mapping_name: str, + pairing_input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.StorageClassificationMapping]: + """Create storage classification mapping. + + The operation to create a storage classification mapping. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param storage_classification_name: Storage classification name. Required. + :type storage_classification_name: str + :param storage_classification_mapping_name: Storage classification mapping name. Required. + :type storage_classification_mapping_name: str + :param pairing_input: Pairing input. Required. + :type pairing_input: JSON + :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 StorageClassificationMapping. The + StorageClassificationMapping is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.StorageClassificationMapping] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + storage_classification_name: str, + storage_classification_mapping_name: str, + pairing_input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.StorageClassificationMapping]: + """Create storage classification mapping. + + The operation to create a storage classification mapping. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param storage_classification_name: Storage classification name. Required. + :type storage_classification_name: str + :param storage_classification_mapping_name: Storage classification mapping name. Required. + :type storage_classification_mapping_name: str + :param pairing_input: Pairing input. Required. + :type pairing_input: 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 StorageClassificationMapping. The + StorageClassificationMapping is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.StorageClassificationMapping] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + storage_classification_name: str, + storage_classification_mapping_name: str, + pairing_input: Union[_models.StorageClassificationMappingInput, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.StorageClassificationMapping]: + """Create storage classification mapping. + + The operation to create a storage classification mapping. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param storage_classification_name: Storage classification name. Required. + :type storage_classification_name: str + :param storage_classification_mapping_name: Storage classification mapping name. Required. + :type storage_classification_mapping_name: str + :param pairing_input: Pairing input. Is one of the following types: + StorageClassificationMappingInput, JSON, IO[bytes] Required. + :type pairing_input: + ~azure.mgmt.recoveryservicessiterecovery.models.StorageClassificationMappingInput or JSON or + IO[bytes] + :return: An instance of AsyncLROPoller that returns StorageClassificationMapping. The + StorageClassificationMapping is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.StorageClassificationMapping] + :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.StorageClassificationMapping] = 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, + resource_name=resource_name, + fabric_name=fabric_name, + storage_classification_name=storage_classification_name, + storage_classification_mapping_name=storage_classification_mapping_name, + pairing_input=pairing_input, + 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.StorageClassificationMapping, 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.StorageClassificationMapping].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.StorageClassificationMapping]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + storage_classification_name: str, + storage_classification_mapping_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_replication_storage_classification_mappings_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + storage_classification_name=storage_classification_name, + storage_classification_mapping_name=storage_classification_mapping_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 [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) + raise HttpResponseError(response=response, 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")) + + 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, + resource_name: str, + fabric_name: str, + storage_classification_name: str, + storage_classification_mapping_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a storage classification mapping. + + The operation to delete a storage classification mapping. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param storage_classification_name: Storage classification name. Required. + :type storage_classification_name: str + :param storage_classification_mapping_name: Storage classification mapping name. Required. + :type storage_classification_mapping_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, + resource_name=resource_name, + fabric_name=fabric_name, + storage_classification_name=storage_classification_name, + storage_classification_mapping_name=storage_classification_mapping_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_replication_storage_classifications( # pylint: disable=name-too-long + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + storage_classification_name: str, + **kwargs: Any + ) -> AsyncItemPaged["_models.StorageClassificationMapping"]: + """Gets the list of storage classification mappings objects under a storage. + + Lists the storage classification mappings for the fabric. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param storage_classification_name: Storage classification name. Required. + :type storage_classification_name: str + :return: An iterator like instance of StorageClassificationMapping + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.StorageClassificationMapping] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.StorageClassificationMapping]] = 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_replication_storage_classification_mappings_list_by_replication_storage_classifications_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + storage_classification_name=storage_classification_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), 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.StorageClassificationMapping], + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.StorageClassificationMapping"]: + """Gets the list of storage classification mappings objects under a vault. + + Lists the storage classification mappings in the vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :return: An iterator like instance of StorageClassificationMapping + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.StorageClassificationMapping] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.StorageClassificationMapping]] = 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_replication_storage_classification_mappings_list_request( + resource_group_name=resource_group_name, + resource_name=resource_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), 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.StorageClassificationMapping], + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class ReplicationvCentersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.aio.SiteRecoveryManagementClient`'s + :attr:`replicationv_centers` 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: SiteRecoveryManagementClientConfiguration = ( + 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, resource_name: str, fabric_name: str, vcenter_name: str, **kwargs: Any + ) -> _models.VCenter: + """Gets the details of a vCenter. + + Gets the details of a registered vCenter server(Add vCenter server). + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param vcenter_name: vcenter name. Required. + :type vcenter_name: str + :return: VCenter. The VCenter is compatible with MutableMapping + :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.VCenter + :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.VCenter] = kwargs.pop("cls", None) + + _request = build_replicationv_centers_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + vcenter_name=vcenter_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.VCenter, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + vcenter_name: str, + add_v_center_request: Union[_models.AddVCenterRequest, JSON, 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(add_v_center_request, (IOBase, bytes)): + _content = add_v_center_request + else: + _content = json.dumps(add_v_center_request, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replicationv_centers_create_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + vcenter_name=vcenter_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) + raise HttpResponseError(response=response, 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")) + + 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, + resource_name: str, + fabric_name: str, + vcenter_name: str, + add_v_center_request: _models.AddVCenterRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VCenter]: + """Add vCenter. + + The operation to create a vCenter object.. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param vcenter_name: vcenter name. Required. + :type vcenter_name: str + :param add_v_center_request: The input to the add vCenter operation. Required. + :type add_v_center_request: ~azure.mgmt.recoveryservicessiterecovery.models.AddVCenterRequest + :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 VCenter. The VCenter is compatible with + MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.VCenter] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + vcenter_name: str, + add_v_center_request: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VCenter]: + """Add vCenter. + + The operation to create a vCenter object.. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param vcenter_name: vcenter name. Required. + :type vcenter_name: str + :param add_v_center_request: The input to the add vCenter operation. Required. + :type add_v_center_request: JSON + :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 VCenter. The VCenter is compatible with + MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.VCenter] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + vcenter_name: str, + add_v_center_request: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VCenter]: + """Add vCenter. + + The operation to create a vCenter object.. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param vcenter_name: vcenter name. Required. + :type vcenter_name: str + :param add_v_center_request: The input to the add vCenter operation. Required. + :type add_v_center_request: 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 VCenter. The VCenter is compatible with + MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.VCenter] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + vcenter_name: str, + add_v_center_request: Union[_models.AddVCenterRequest, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.VCenter]: + """Add vCenter. + + The operation to create a vCenter object.. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param vcenter_name: vcenter name. Required. + :type vcenter_name: str + :param add_v_center_request: The input to the add vCenter operation. Is one of the following + types: AddVCenterRequest, JSON, IO[bytes] Required. + :type add_v_center_request: ~azure.mgmt.recoveryservicessiterecovery.models.AddVCenterRequest + or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns VCenter. The VCenter is compatible with + MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.VCenter] + :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.VCenter] = 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, + resource_name=resource_name, + fabric_name=fabric_name, + vcenter_name=vcenter_name, + add_v_center_request=add_v_center_request, + 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.VCenter, 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.VCenter].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.VCenter]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _update_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + vcenter_name: str, + update_v_center_request: Union[_models.UpdateVCenterRequest, JSON, 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(update_v_center_request, (IOBase, bytes)): + _content = update_v_center_request + else: + _content = json.dumps(update_v_center_request, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replicationv_centers_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + vcenter_name=vcenter_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) + raise HttpResponseError(response=response, 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")) + + 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, + resource_name: str, + fabric_name: str, + vcenter_name: str, + update_v_center_request: _models.UpdateVCenterRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VCenter]: + """Update vCenter operation. + + The operation to update a registered vCenter. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param vcenter_name: vcenter name. Required. + :type vcenter_name: str + :param update_v_center_request: The input to the update vCenter operation. Required. + :type update_v_center_request: + ~azure.mgmt.recoveryservicessiterecovery.models.UpdateVCenterRequest + :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 VCenter. The VCenter is compatible with + MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.VCenter] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + vcenter_name: str, + update_v_center_request: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VCenter]: + """Update vCenter operation. + + The operation to update a registered vCenter. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param vcenter_name: vcenter name. Required. + :type vcenter_name: str + :param update_v_center_request: The input to the update vCenter operation. Required. + :type update_v_center_request: JSON + :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 VCenter. The VCenter is compatible with + MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.VCenter] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + vcenter_name: str, + update_v_center_request: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VCenter]: + """Update vCenter operation. + + The operation to update a registered vCenter. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param vcenter_name: vcenter name. Required. + :type vcenter_name: str + :param update_v_center_request: The input to the update vCenter operation. Required. + :type update_v_center_request: 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 VCenter. The VCenter is compatible with + MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.VCenter] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + vcenter_name: str, + update_v_center_request: Union[_models.UpdateVCenterRequest, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.VCenter]: + """Update vCenter operation. + + The operation to update a registered vCenter. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param vcenter_name: vcenter name. Required. + :type vcenter_name: str + :param update_v_center_request: The input to the update vCenter operation. Is one of the + following types: UpdateVCenterRequest, JSON, IO[bytes] Required. + :type update_v_center_request: + ~azure.mgmt.recoveryservicessiterecovery.models.UpdateVCenterRequest or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns VCenter. The VCenter is compatible with + MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.VCenter] + :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.VCenter] = 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, + resource_name=resource_name, + fabric_name=fabric_name, + vcenter_name=vcenter_name, + update_v_center_request=update_v_center_request, + 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.VCenter, 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.VCenter].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.VCenter]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, resource_name: str, fabric_name: str, vcenter_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_replicationv_centers_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + vcenter_name=vcenter_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 [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) + raise HttpResponseError(response=response, 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")) + + 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, resource_name: str, fabric_name: str, vcenter_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Remove vcenter operation. + + The operation to remove(unregister) a registered vCenter server from the vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param vcenter_name: vcenter name. Required. + :type vcenter_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, + resource_name=resource_name, + fabric_name=fabric_name, + vcenter_name=vcenter_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_replication_fabrics( + self, resource_group_name: str, resource_name: str, fabric_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.VCenter"]: + """Gets the list of vCenter registered under a fabric. + + Lists the vCenter servers registered in a fabric. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :return: An iterator like instance of VCenter + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.VCenter] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.VCenter]] = 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_replicationv_centers_list_by_replication_fabrics_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_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), 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.VCenter], + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncItemPaged["_models.VCenter"]: + """Gets the list of vCenter registered under the vault. + + Lists the vCenter servers registered in the vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :return: An iterator like instance of VCenter + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.VCenter] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.VCenter]] = 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_replicationv_centers_list_request( + resource_group_name=resource_group_name, + resource_name=resource_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), 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.VCenter], + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class ReplicationJobsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.aio.SiteRecoveryManagementClient`'s + :attr:`replication_jobs` 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: SiteRecoveryManagementClientConfiguration = ( + 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, resource_name: str, job_name: str, **kwargs: Any) -> _models.Job: + """Gets the job details. + + Get the details of an Azure Site Recovery job. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param job_name: Job identifier. Required. + :type job_name: str + :return: Job. The Job is compatible with MutableMapping + :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.Job + :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.Job] = kwargs.pop("cls", None) + + _request = build_replication_jobs_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + job_name=job_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Job, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list( + self, resource_group_name: str, resource_name: str, *, filter: Optional[str] = None, **kwargs: Any + ) -> AsyncItemPaged["_models.Job"]: + """Gets the list of jobs. + + Gets the list of Azure Site Recovery Jobs for the vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :keyword filter: OData filter options. Default value is None. + :paramtype filter: str + :return: An iterator like instance of Job + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.Job] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Job]] = 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_replication_jobs_list_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + filter=filter, + 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), 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.Job], + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + async def _cancel_initial( + self, resource_group_name: str, resource_name: str, job_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_replication_jobs_cancel_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + job_name=job_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) + raise HttpResponseError(response=response, 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")) + + 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_cancel( + self, resource_group_name: str, resource_name: str, job_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.Job]: + """Cancels the specified job. + + The operation to cancel an Azure Site Recovery job. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param job_name: Job identifier. Required. + :type job_name: str + :return: An instance of AsyncLROPoller that returns Job. The Job is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Job] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Job] = 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._cancel_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + job_name=job_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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.Job, 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.Job].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.Job]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _restart_initial( + self, resource_group_name: str, resource_name: str, job_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_replication_jobs_restart_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + job_name=job_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) + raise HttpResponseError(response=response, 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")) + + 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_restart( + self, resource_group_name: str, resource_name: str, job_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.Job]: + """Restarts the specified job. + + The operation to restart an Azure Site Recovery job. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param job_name: Job identifier. Required. + :type job_name: str + :return: An instance of AsyncLROPoller that returns Job. The Job is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Job] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Job] = 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._restart_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + job_name=job_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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.Job, 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.Job].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.Job]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _resume_initial( + self, + resource_group_name: str, + resource_name: str, + job_name: str, + resume_job_params: Union[_models.ResumeJobParams, JSON, 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(resume_job_params, (IOBase, bytes)): + _content = resume_job_params + else: + _content = json.dumps(resume_job_params, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_jobs_resume_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + job_name=job_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) + raise HttpResponseError(response=response, 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")) + + 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_resume( + self, + resource_group_name: str, + resource_name: str, + job_name: str, + resume_job_params: _models.ResumeJobParams, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Job]: + """Resumes the specified job. + + The operation to resume an Azure Site Recovery job. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param job_name: Job identifier. Required. + :type job_name: str + :param resume_job_params: Resume rob comments. Required. + :type resume_job_params: ~azure.mgmt.recoveryservicessiterecovery.models.ResumeJobParams + :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 Job. The Job is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Job] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_resume( + self, + resource_group_name: str, + resource_name: str, + job_name: str, + resume_job_params: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Job]: + """Resumes the specified job. + + The operation to resume an Azure Site Recovery job. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param job_name: Job identifier. Required. + :type job_name: str + :param resume_job_params: Resume rob comments. Required. + :type resume_job_params: JSON + :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 Job. The Job is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Job] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_resume( + self, + resource_group_name: str, + resource_name: str, + job_name: str, + resume_job_params: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Job]: + """Resumes the specified job. + + The operation to resume an Azure Site Recovery job. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param job_name: Job identifier. Required. + :type job_name: str + :param resume_job_params: Resume rob comments. Required. + :type resume_job_params: 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 Job. The Job is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Job] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_resume( + self, + resource_group_name: str, + resource_name: str, + job_name: str, + resume_job_params: Union[_models.ResumeJobParams, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.Job]: + """Resumes the specified job. + + The operation to resume an Azure Site Recovery job. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param job_name: Job identifier. Required. + :type job_name: str + :param resume_job_params: Resume rob comments. Is one of the following types: ResumeJobParams, + JSON, IO[bytes] Required. + :type resume_job_params: ~azure.mgmt.recoveryservicessiterecovery.models.ResumeJobParams or + JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns Job. The Job is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Job] + :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.Job] = 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._resume_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + job_name=job_name, + resume_job_params=resume_job_params, + 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.Job, 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.Job].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.Job]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _export_initial( + self, + resource_group_name: str, + resource_name: str, + job_query_parameter: Union[_models.JobQueryParameter, JSON, 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(job_query_parameter, (IOBase, bytes)): + _content = job_query_parameter + else: + _content = json.dumps(job_query_parameter, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_jobs_export_request( + resource_group_name=resource_group_name, + resource_name=resource_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) + raise HttpResponseError(response=response, 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")) + + 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_export( + self, + resource_group_name: str, + resource_name: str, + job_query_parameter: _models.JobQueryParameter, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Job]: + """Exports the details of the Azure Site Recovery jobs of the vault. + + The operation to export the details of the Azure Site Recovery jobs of the vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :param job_query_parameter: The request body. Required. + :type job_query_parameter: ~azure.mgmt.recoveryservicessiterecovery.models.JobQueryParameter + :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 Job. The Job is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Job] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_export( + self, + resource_group_name: str, + resource_name: str, + job_query_parameter: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Job]: + """Exports the details of the Azure Site Recovery jobs of the vault. + + The operation to export the details of the Azure Site Recovery jobs of the vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :param job_query_parameter: The request body. Required. + :type job_query_parameter: JSON + :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 Job. The Job is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Job] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_export( + self, + resource_group_name: str, + resource_name: str, + job_query_parameter: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Job]: + """Exports the details of the Azure Site Recovery jobs of the vault. + + The operation to export the details of the Azure Site Recovery jobs of the vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :param job_query_parameter: The request body. Required. + :type job_query_parameter: 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 Job. The Job is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Job] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_export( + self, + resource_group_name: str, + resource_name: str, + job_query_parameter: Union[_models.JobQueryParameter, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.Job]: + """Exports the details of the Azure Site Recovery jobs of the vault. + + The operation to export the details of the Azure Site Recovery jobs of the vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :param job_query_parameter: The request body. Is one of the following types: JobQueryParameter, + JSON, IO[bytes] Required. + :type job_query_parameter: ~azure.mgmt.recoveryservicessiterecovery.models.JobQueryParameter or + JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns Job. The Job is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Job] + :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.Job] = 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._export_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + job_query_parameter=job_query_parameter, + 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["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.Job, 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.Job].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.Job]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + +class ReplicationPoliciesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.aio.SiteRecoveryManagementClient`'s + :attr:`replication_policies` 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: SiteRecoveryManagementClientConfiguration = ( + 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, resource_name: str, policy_name: str, **kwargs: Any + ) -> _models.Policy: + """Gets the requested policy. + + Gets the details of a replication policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param policy_name: Replication policy name. Required. + :type policy_name: str + :return: Policy. The Policy is compatible with MutableMapping + :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.Policy + :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.Policy] = kwargs.pop("cls", None) + + _request = build_replication_policies_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + policy_name=policy_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Policy, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + resource_name: str, + policy_name: str, + input: Union[_models.CreatePolicyInput, JSON, 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(input, (IOBase, bytes)): + _content = input + else: + _content = json.dumps(input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_policies_create_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + policy_name=policy_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) + raise HttpResponseError(response=response, 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")) + + 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, + resource_name: str, + policy_name: str, + input: _models.CreatePolicyInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Policy]: + """Creates the policy. + + The operation to create a replication policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param policy_name: Replication policy name. Required. + :type policy_name: str + :param input: Create policy input. Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.CreatePolicyInput + :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 Policy. The Policy is compatible with + MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Policy] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + resource_name: str, + policy_name: str, + input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Policy]: + """Creates the policy. + + The operation to create a replication policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param policy_name: Replication policy name. Required. + :type policy_name: str + :param input: Create policy input. Required. + :type input: JSON + :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 Policy. The Policy is compatible with + MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Policy] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + resource_name: str, + policy_name: str, + input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Policy]: + """Creates the policy. + + The operation to create a replication policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param policy_name: Replication policy name. Required. + :type policy_name: str + :param input: Create policy input. Required. + :type input: 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 Policy. The Policy is compatible with + MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Policy] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + resource_name: str, + policy_name: str, + input: Union[_models.CreatePolicyInput, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.Policy]: + """Creates the policy. + + The operation to create a replication policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param policy_name: Replication policy name. Required. + :type policy_name: str + :param input: Create policy input. Is one of the following types: CreatePolicyInput, JSON, + IO[bytes] Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.CreatePolicyInput or JSON or + IO[bytes] + :return: An instance of AsyncLROPoller that returns Policy. The Policy is compatible with + MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Policy] + :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.Policy] = 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, + resource_name=resource_name, + policy_name=policy_name, + input=input, + 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.Policy, 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.Policy].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.Policy]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _update_initial( + self, + resource_group_name: str, + resource_name: str, + policy_name: str, + input: Union[_models.UpdatePolicyInput, JSON, 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(input, (IOBase, bytes)): + _content = input + else: + _content = json.dumps(input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_policies_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + policy_name=policy_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) + raise HttpResponseError(response=response, 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")) + + 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, + resource_name: str, + policy_name: str, + input: _models.UpdatePolicyInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Policy]: + """Updates the policy. + + The operation to update a replication policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param policy_name: Replication policy name. Required. + :type policy_name: str + :param input: Update Policy Input. Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.UpdatePolicyInput + :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 Policy. The Policy is compatible with + MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Policy] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + resource_name: str, + policy_name: str, + input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Policy]: + """Updates the policy. + + The operation to update a replication policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param policy_name: Replication policy name. Required. + :type policy_name: str + :param input: Update Policy Input. Required. + :type input: JSON + :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 Policy. The Policy is compatible with + MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Policy] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + resource_name: str, + policy_name: str, + input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Policy]: + """Updates the policy. + + The operation to update a replication policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param policy_name: Replication policy name. Required. + :type policy_name: str + :param input: Update Policy Input. Required. + :type input: 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 Policy. The Policy is compatible with + MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Policy] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + resource_name: str, + policy_name: str, + input: Union[_models.UpdatePolicyInput, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.Policy]: + """Updates the policy. + + The operation to update a replication policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param policy_name: Replication policy name. Required. + :type policy_name: str + :param input: Update Policy Input. Is one of the following types: UpdatePolicyInput, JSON, + IO[bytes] Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.UpdatePolicyInput or JSON or + IO[bytes] + :return: An instance of AsyncLROPoller that returns Policy. The Policy is compatible with + MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Policy] + :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.Policy] = 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, + resource_name=resource_name, + policy_name=policy_name, + input=input, + 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.Policy, 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.Policy].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.Policy]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, resource_name: str, policy_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_replication_policies_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + policy_name=policy_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 [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) + raise HttpResponseError(response=response, 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")) + + 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, resource_name: str, policy_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete the policy. + + The operation to delete a replication policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param policy_name: Replication policy name. Required. + :type policy_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, + resource_name=resource_name, + policy_name=policy_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(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncItemPaged["_models.Policy"]: + """Gets the list of replication policies. + + Lists the replication policies for a vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :return: An iterator like instance of Policy + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.Policy] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Policy]] = 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_replication_policies_list_request( + resource_group_name=resource_group_name, + resource_name=resource_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), 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.Policy], + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class ReplicationRecoveryPlansOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.aio.SiteRecoveryManagementClient`'s + :attr:`replication_recovery_plans` 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: SiteRecoveryManagementClientConfiguration = ( + 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, resource_name: str, recovery_plan_name: str, **kwargs: Any + ) -> _models.RecoveryPlan: + """Gets the requested recovery plan. + + Gets the details of the recovery plan. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param recovery_plan_name: Name of the recovery plan. Required. + :type recovery_plan_name: str + :return: RecoveryPlan. The RecoveryPlan is compatible with MutableMapping + :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan + :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.RecoveryPlan] = kwargs.pop("cls", None) + + _request = build_replication_recovery_plans_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + recovery_plan_name=recovery_plan_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.RecoveryPlan, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + resource_name: str, + recovery_plan_name: str, + input: Union[_models.CreateRecoveryPlanInput, JSON, 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(input, (IOBase, bytes)): + _content = input + else: + _content = json.dumps(input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_recovery_plans_create_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + recovery_plan_name=recovery_plan_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) + raise HttpResponseError(response=response, 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")) + + 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, + resource_name: str, + recovery_plan_name: str, + input: _models.CreateRecoveryPlanInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RecoveryPlan]: + """Creates a recovery plan with the given details. + + The operation to create a recovery plan. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param recovery_plan_name: Name of the recovery plan. Required. + :type recovery_plan_name: str + :param input: Recovery Plan creation input. Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.CreateRecoveryPlanInput + :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 RecoveryPlan. The RecoveryPlan is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + resource_name: str, + recovery_plan_name: str, + input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RecoveryPlan]: + """Creates a recovery plan with the given details. + + The operation to create a recovery plan. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param recovery_plan_name: Name of the recovery plan. Required. + :type recovery_plan_name: str + :param input: Recovery Plan creation input. Required. + :type input: JSON + :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 RecoveryPlan. The RecoveryPlan is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + resource_name: str, + recovery_plan_name: str, + input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RecoveryPlan]: + """Creates a recovery plan with the given details. + + The operation to create a recovery plan. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param recovery_plan_name: Name of the recovery plan. Required. + :type recovery_plan_name: str + :param input: Recovery Plan creation input. Required. + :type input: 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 RecoveryPlan. The RecoveryPlan is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + resource_name: str, + recovery_plan_name: str, + input: Union[_models.CreateRecoveryPlanInput, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.RecoveryPlan]: + """Creates a recovery plan with the given details. + + The operation to create a recovery plan. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param recovery_plan_name: Name of the recovery plan. Required. + :type recovery_plan_name: str + :param input: Recovery Plan creation input. Is one of the following types: + CreateRecoveryPlanInput, JSON, IO[bytes] Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.CreateRecoveryPlanInput or JSON or + IO[bytes] + :return: An instance of AsyncLROPoller that returns RecoveryPlan. The RecoveryPlan is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :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.RecoveryPlan] = 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, + resource_name=resource_name, + recovery_plan_name=recovery_plan_name, + input=input, + 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.RecoveryPlan, 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.RecoveryPlan].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.RecoveryPlan]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _update_initial( + self, + resource_group_name: str, + resource_name: str, + recovery_plan_name: str, + input: Union[_models.UpdateRecoveryPlanInput, JSON, 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(input, (IOBase, bytes)): + _content = input + else: + _content = json.dumps(input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_recovery_plans_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + recovery_plan_name=recovery_plan_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) + raise HttpResponseError(response=response, 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")) + + 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, + resource_name: str, + recovery_plan_name: str, + input: _models.UpdateRecoveryPlanInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RecoveryPlan]: + """Updates the given recovery plan. + + The operation to update a recovery plan. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param recovery_plan_name: Name of the recovery plan. Required. + :type recovery_plan_name: str + :param input: Update recovery plan input. Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.UpdateRecoveryPlanInput + :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 RecoveryPlan. The RecoveryPlan is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + resource_name: str, + recovery_plan_name: str, + input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RecoveryPlan]: + """Updates the given recovery plan. + + The operation to update a recovery plan. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param recovery_plan_name: Name of the recovery plan. Required. + :type recovery_plan_name: str + :param input: Update recovery plan input. Required. + :type input: JSON + :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 RecoveryPlan. The RecoveryPlan is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + resource_name: str, + recovery_plan_name: str, + input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RecoveryPlan]: + """Updates the given recovery plan. + + The operation to update a recovery plan. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param recovery_plan_name: Name of the recovery plan. Required. + :type recovery_plan_name: str + :param input: Update recovery plan input. Required. + :type input: 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 RecoveryPlan. The RecoveryPlan is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + resource_name: str, + recovery_plan_name: str, + input: Union[_models.UpdateRecoveryPlanInput, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.RecoveryPlan]: + """Updates the given recovery plan. + + The operation to update a recovery plan. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param recovery_plan_name: Name of the recovery plan. Required. + :type recovery_plan_name: str + :param input: Update recovery plan input. Is one of the following types: + UpdateRecoveryPlanInput, JSON, IO[bytes] Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.UpdateRecoveryPlanInput or JSON or + IO[bytes] + :return: An instance of AsyncLROPoller that returns RecoveryPlan. The RecoveryPlan is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :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.RecoveryPlan] = 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, + resource_name=resource_name, + recovery_plan_name=recovery_plan_name, + input=input, + 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.RecoveryPlan, 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.RecoveryPlan].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.RecoveryPlan]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, resource_name: str, recovery_plan_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_replication_recovery_plans_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + recovery_plan_name=recovery_plan_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 [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) + raise HttpResponseError(response=response, 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")) + + 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, resource_name: str, recovery_plan_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified recovery plan. + + Delete a recovery plan. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param recovery_plan_name: Name of the recovery plan. Required. + :type recovery_plan_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, + resource_name=resource_name, + recovery_plan_name=recovery_plan_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( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.RecoveryPlan"]: + """Gets the list of recovery plans. + + Lists the recovery plans in the vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :return: An iterator like instance of RecoveryPlan + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.RecoveryPlan]] = 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_replication_recovery_plans_list_request( + resource_group_name=resource_group_name, + resource_name=resource_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), 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.RecoveryPlan], + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + async def _failover_cancel_initial( + self, resource_group_name: str, resource_name: str, recovery_plan_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_replication_recovery_plans_failover_cancel_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + recovery_plan_name=recovery_plan_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) + raise HttpResponseError(response=response, 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")) + + 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_failover_cancel( + self, resource_group_name: str, resource_name: str, recovery_plan_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.RecoveryPlan]: + """Execute cancel failover of the recovery plan. + + The operation to cancel the failover of a recovery plan. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param recovery_plan_name: Name of the recovery plan. Required. + :type recovery_plan_name: str + :return: An instance of AsyncLROPoller that returns RecoveryPlan. The RecoveryPlan is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.RecoveryPlan] = 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._failover_cancel_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + recovery_plan_name=recovery_plan_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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.RecoveryPlan, 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.RecoveryPlan].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.RecoveryPlan]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _failover_commit_initial( + self, resource_group_name: str, resource_name: str, recovery_plan_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_replication_recovery_plans_failover_commit_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + recovery_plan_name=recovery_plan_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) + raise HttpResponseError(response=response, 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")) + + 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_failover_commit( + self, resource_group_name: str, resource_name: str, recovery_plan_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.RecoveryPlan]: + """Execute commit failover of the recovery plan. + + The operation to commit the failover of a recovery plan. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param recovery_plan_name: Name of the recovery plan. Required. + :type recovery_plan_name: str + :return: An instance of AsyncLROPoller that returns RecoveryPlan. The RecoveryPlan is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.RecoveryPlan] = 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._failover_commit_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + recovery_plan_name=recovery_plan_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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.RecoveryPlan, 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.RecoveryPlan].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.RecoveryPlan]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _planned_failover_initial( + self, + resource_group_name: str, + resource_name: str, + recovery_plan_name: str, + input: Union[_models.RecoveryPlanPlannedFailoverInput, JSON, 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(input, (IOBase, bytes)): + _content = input + else: + _content = json.dumps(input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_recovery_plans_planned_failover_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + recovery_plan_name=recovery_plan_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) + raise HttpResponseError(response=response, 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")) + + 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_planned_failover( + self, + resource_group_name: str, + resource_name: str, + recovery_plan_name: str, + input: _models.RecoveryPlanPlannedFailoverInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RecoveryPlan]: + """Execute planned failover of the recovery plan. + + The operation to start the planned failover of a recovery plan. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param recovery_plan_name: Name of the recovery plan. Required. + :type recovery_plan_name: str + :param input: Failover input. Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanPlannedFailoverInput + :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 RecoveryPlan. The RecoveryPlan is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_planned_failover( + self, + resource_group_name: str, + resource_name: str, + recovery_plan_name: str, + input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RecoveryPlan]: + """Execute planned failover of the recovery plan. + + The operation to start the planned failover of a recovery plan. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param recovery_plan_name: Name of the recovery plan. Required. + :type recovery_plan_name: str + :param input: Failover input. Required. + :type input: JSON + :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 RecoveryPlan. The RecoveryPlan is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_planned_failover( + self, + resource_group_name: str, + resource_name: str, + recovery_plan_name: str, + input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RecoveryPlan]: + """Execute planned failover of the recovery plan. + + The operation to start the planned failover of a recovery plan. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param recovery_plan_name: Name of the recovery plan. Required. + :type recovery_plan_name: str + :param input: Failover input. Required. + :type input: 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 RecoveryPlan. The RecoveryPlan is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_planned_failover( + self, + resource_group_name: str, + resource_name: str, + recovery_plan_name: str, + input: Union[_models.RecoveryPlanPlannedFailoverInput, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.RecoveryPlan]: + """Execute planned failover of the recovery plan. + + The operation to start the planned failover of a recovery plan. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param recovery_plan_name: Name of the recovery plan. Required. + :type recovery_plan_name: str + :param input: Failover input. Is one of the following types: RecoveryPlanPlannedFailoverInput, + JSON, IO[bytes] Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanPlannedFailoverInput + or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns RecoveryPlan. The RecoveryPlan is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :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.RecoveryPlan] = 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._planned_failover_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + recovery_plan_name=recovery_plan_name, + input=input, + 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.RecoveryPlan, 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.RecoveryPlan].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.RecoveryPlan]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _reprotect_initial( + self, resource_group_name: str, resource_name: str, recovery_plan_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_replication_recovery_plans_reprotect_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + recovery_plan_name=recovery_plan_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) + raise HttpResponseError(response=response, 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")) + + 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_reprotect( + self, resource_group_name: str, resource_name: str, recovery_plan_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.RecoveryPlan]: + """Execute reprotect of the recovery plan. + + The operation to reprotect(reverse replicate) a recovery plan. This api is for deprecated + scenarios and no longer works. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param recovery_plan_name: Name of the recovery plan. Required. + :type recovery_plan_name: str + :return: An instance of AsyncLROPoller that returns RecoveryPlan. The RecoveryPlan is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.RecoveryPlan] = 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._reprotect_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + recovery_plan_name=recovery_plan_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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.RecoveryPlan, 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.RecoveryPlan].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.RecoveryPlan]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _test_failover_initial( + self, + resource_group_name: str, + resource_name: str, + recovery_plan_name: str, + input: Union[_models.RecoveryPlanTestFailoverInput, JSON, 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(input, (IOBase, bytes)): + _content = input + else: + _content = json.dumps(input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_recovery_plans_test_failover_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + recovery_plan_name=recovery_plan_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) + raise HttpResponseError(response=response, 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")) + + 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_test_failover( + self, + resource_group_name: str, + resource_name: str, + recovery_plan_name: str, + input: _models.RecoveryPlanTestFailoverInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RecoveryPlan]: + """Execute test failover of the recovery plan. + + The operation to start the test failover of a recovery plan. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param recovery_plan_name: Name of the recovery plan. Required. + :type recovery_plan_name: str + :param input: Recovery plan test failover input. Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanTestFailoverInput + :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 RecoveryPlan. The RecoveryPlan is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_test_failover( + self, + resource_group_name: str, + resource_name: str, + recovery_plan_name: str, + input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RecoveryPlan]: + """Execute test failover of the recovery plan. + + The operation to start the test failover of a recovery plan. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param recovery_plan_name: Name of the recovery plan. Required. + :type recovery_plan_name: str + :param input: Recovery plan test failover input. Required. + :type input: JSON + :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 RecoveryPlan. The RecoveryPlan is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_test_failover( + self, + resource_group_name: str, + resource_name: str, + recovery_plan_name: str, + input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RecoveryPlan]: + """Execute test failover of the recovery plan. + + The operation to start the test failover of a recovery plan. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param recovery_plan_name: Name of the recovery plan. Required. + :type recovery_plan_name: str + :param input: Recovery plan test failover input. Required. + :type input: 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 RecoveryPlan. The RecoveryPlan is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_test_failover( + self, + resource_group_name: str, + resource_name: str, + recovery_plan_name: str, + input: Union[_models.RecoveryPlanTestFailoverInput, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.RecoveryPlan]: + """Execute test failover of the recovery plan. + + The operation to start the test failover of a recovery plan. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param recovery_plan_name: Name of the recovery plan. Required. + :type recovery_plan_name: str + :param input: Recovery plan test failover input. Is one of the following types: + RecoveryPlanTestFailoverInput, JSON, IO[bytes] Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanTestFailoverInput or + JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns RecoveryPlan. The RecoveryPlan is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :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.RecoveryPlan] = 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._test_failover_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + recovery_plan_name=recovery_plan_name, + input=input, + 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.RecoveryPlan, 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.RecoveryPlan].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.RecoveryPlan]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _test_failover_cleanup_initial( + self, + resource_group_name: str, + resource_name: str, + recovery_plan_name: str, + input: Union[_models.RecoveryPlanTestFailoverCleanupInput, JSON, 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(input, (IOBase, bytes)): + _content = input + else: + _content = json.dumps(input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_recovery_plans_test_failover_cleanup_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + recovery_plan_name=recovery_plan_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) + raise HttpResponseError(response=response, 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")) + + 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_test_failover_cleanup( + self, + resource_group_name: str, + resource_name: str, + recovery_plan_name: str, + input: _models.RecoveryPlanTestFailoverCleanupInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RecoveryPlan]: + """Execute test failover cleanup of the recovery plan. + + The operation to cleanup test failover of a recovery plan. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param recovery_plan_name: Name of the recovery plan. Required. + :type recovery_plan_name: str + :param input: Recovery plan test failover cleanup input. Required. + :type input: + ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanTestFailoverCleanupInput + :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 RecoveryPlan. The RecoveryPlan is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_test_failover_cleanup( + self, + resource_group_name: str, + resource_name: str, + recovery_plan_name: str, + input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RecoveryPlan]: + """Execute test failover cleanup of the recovery plan. + + The operation to cleanup test failover of a recovery plan. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param recovery_plan_name: Name of the recovery plan. Required. + :type recovery_plan_name: str + :param input: Recovery plan test failover cleanup input. Required. + :type input: JSON + :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 RecoveryPlan. The RecoveryPlan is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_test_failover_cleanup( + self, + resource_group_name: str, + resource_name: str, + recovery_plan_name: str, + input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RecoveryPlan]: + """Execute test failover cleanup of the recovery plan. + + The operation to cleanup test failover of a recovery plan. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param recovery_plan_name: Name of the recovery plan. Required. + :type recovery_plan_name: str + :param input: Recovery plan test failover cleanup input. Required. + :type input: 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 RecoveryPlan. The RecoveryPlan is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_test_failover_cleanup( + self, + resource_group_name: str, + resource_name: str, + recovery_plan_name: str, + input: Union[_models.RecoveryPlanTestFailoverCleanupInput, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.RecoveryPlan]: + """Execute test failover cleanup of the recovery plan. + + The operation to cleanup test failover of a recovery plan. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param recovery_plan_name: Name of the recovery plan. Required. + :type recovery_plan_name: str + :param input: Recovery plan test failover cleanup input. Is one of the following types: + RecoveryPlanTestFailoverCleanupInput, JSON, IO[bytes] Required. + :type input: + ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanTestFailoverCleanupInput or JSON or + IO[bytes] + :return: An instance of AsyncLROPoller that returns RecoveryPlan. The RecoveryPlan is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :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.RecoveryPlan] = 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._test_failover_cleanup_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + recovery_plan_name=recovery_plan_name, + input=input, + 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.RecoveryPlan, 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.RecoveryPlan].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.RecoveryPlan]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _unplanned_failover_initial( + self, + resource_group_name: str, + resource_name: str, + recovery_plan_name: str, + input: Union[_models.RecoveryPlanUnplannedFailoverInput, JSON, 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(input, (IOBase, bytes)): + _content = input + else: + _content = json.dumps(input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_recovery_plans_unplanned_failover_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + recovery_plan_name=recovery_plan_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) + raise HttpResponseError(response=response, 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")) + + 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_unplanned_failover( + self, + resource_group_name: str, + resource_name: str, + recovery_plan_name: str, + input: _models.RecoveryPlanUnplannedFailoverInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RecoveryPlan]: + """Execute unplanned failover of the recovery plan. + + The operation to start the unplanned failover of a recovery plan. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param recovery_plan_name: Name of the recovery plan. Required. + :type recovery_plan_name: str + :param input: Recovery plan unplanned failover input. Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanUnplannedFailoverInput + :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 RecoveryPlan. The RecoveryPlan is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_unplanned_failover( + self, + resource_group_name: str, + resource_name: str, + recovery_plan_name: str, + input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RecoveryPlan]: + """Execute unplanned failover of the recovery plan. + + The operation to start the unplanned failover of a recovery plan. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param recovery_plan_name: Name of the recovery plan. Required. + :type recovery_plan_name: str + :param input: Recovery plan unplanned failover input. Required. + :type input: JSON + :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 RecoveryPlan. The RecoveryPlan is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_unplanned_failover( + self, + resource_group_name: str, + resource_name: str, + recovery_plan_name: str, + input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RecoveryPlan]: + """Execute unplanned failover of the recovery plan. + + The operation to start the unplanned failover of a recovery plan. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param recovery_plan_name: Name of the recovery plan. Required. + :type recovery_plan_name: str + :param input: Recovery plan unplanned failover input. Required. + :type input: 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 RecoveryPlan. The RecoveryPlan is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_unplanned_failover( + self, + resource_group_name: str, + resource_name: str, + recovery_plan_name: str, + input: Union[_models.RecoveryPlanUnplannedFailoverInput, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.RecoveryPlan]: + """Execute unplanned failover of the recovery plan. + + The operation to start the unplanned failover of a recovery plan. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param recovery_plan_name: Name of the recovery plan. Required. + :type recovery_plan_name: str + :param input: Recovery plan unplanned failover input. Is one of the following types: + RecoveryPlanUnplannedFailoverInput, JSON, IO[bytes] Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanUnplannedFailoverInput + or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns RecoveryPlan. The RecoveryPlan is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :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.RecoveryPlan] = 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._unplanned_failover_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + recovery_plan_name=recovery_plan_name, + input=input, + 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.RecoveryPlan, 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.RecoveryPlan].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.RecoveryPlan]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + +class ReplicationVaultSettingOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.aio.SiteRecoveryManagementClient`'s + :attr:`replication_vault_setting` 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: SiteRecoveryManagementClientConfiguration = ( + 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, resource_name: str, vault_setting_name: str, **kwargs: Any + ) -> _models.VaultSetting: + """Gets the vault setting. + + Gets the vault setting. This includes the Migration Hub connection settings. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param vault_setting_name: Vault setting name. Required. + :type vault_setting_name: str + :return: VaultSetting. The VaultSetting is compatible with MutableMapping + :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.VaultSetting + :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.VaultSetting] = kwargs.pop("cls", None) + + _request = build_replication_vault_setting_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + vault_setting_name=vault_setting_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.VaultSetting, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + resource_name: str, + vault_setting_name: str, + input: Union[_models.VaultSettingCreationInput, JSON, 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(input, (IOBase, bytes)): + _content = input + else: + _content = json.dumps(input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_vault_setting_create_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + vault_setting_name=vault_setting_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]: + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + 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, + resource_name: str, + vault_setting_name: str, + input: _models.VaultSettingCreationInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VaultSetting]: + """Updates vault setting. A vault setting object is a singleton per vault and it is always present + by default. + + The operation to configure vault setting. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param vault_setting_name: Vault setting name. Required. + :type vault_setting_name: str + :param input: Vault setting creation input. Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.VaultSettingCreationInput + :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 VaultSetting. The VaultSetting is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.VaultSetting] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + resource_name: str, + vault_setting_name: str, + input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VaultSetting]: + """Updates vault setting. A vault setting object is a singleton per vault and it is always present + by default. + + The operation to configure vault setting. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param vault_setting_name: Vault setting name. Required. + :type vault_setting_name: str + :param input: Vault setting creation input. Required. + :type input: JSON + :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 VaultSetting. The VaultSetting is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.VaultSetting] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + resource_name: str, + vault_setting_name: str, + input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VaultSetting]: + """Updates vault setting. A vault setting object is a singleton per vault and it is always present + by default. + + The operation to configure vault setting. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param vault_setting_name: Vault setting name. Required. + :type vault_setting_name: str + :param input: Vault setting creation input. Required. + :type input: 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 VaultSetting. The VaultSetting is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.VaultSetting] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + resource_name: str, + vault_setting_name: str, + input: Union[_models.VaultSettingCreationInput, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.VaultSetting]: + """Updates vault setting. A vault setting object is a singleton per vault and it is always present + by default. + + The operation to configure vault setting. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param vault_setting_name: Vault setting name. Required. + :type vault_setting_name: str + :param input: Vault setting creation input. Is one of the following types: + VaultSettingCreationInput, JSON, IO[bytes] Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.VaultSettingCreationInput or JSON + or IO[bytes] + :return: An instance of AsyncLROPoller that returns VaultSetting. The VaultSetting is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.VaultSetting] + :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.VaultSetting] = 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, + resource_name=resource_name, + vault_setting_name=vault_setting_name, + input=input, + 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["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.VaultSetting, 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.VaultSetting].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.VaultSetting]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def list( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.VaultSetting"]: + """Gets the list of vault setting. + + Gets the list of vault setting. This includes the Migration Hub connection settings. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :return: An iterator like instance of VaultSetting + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.VaultSetting] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.VaultSetting]] = 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_replication_vault_setting_list_request( + resource_group_name=resource_group_name, + resource_name=resource_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), 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.VaultSetting], + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) class Operations: @@ -44,8 +26597,6 @@ class Operations: :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") @@ -56,21 +26607,142 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.OperationsDiscovery"]: + def list(self, resource_group_name: str, **kwargs: Any) -> AsyncItemPaged["_models.OperationsDiscovery"]: """Returns the list of available operations. Operation to return the list of available operations. - :return: An iterator like instance of either OperationsDiscovery or the result of cls(response) + :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 OperationsDiscovery :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.OperationsDiscovery] :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.OperationsDiscovery]] = 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( + 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), 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.OperationsDiscovery], + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class ReplicationAppliancesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.aio.SiteRecoveryManagementClient`'s + :attr:`replication_appliances` 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: SiteRecoveryManagementClientConfiguration = ( + 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, resource_group_name: str, resource_name: str, *, filter: Optional[str] = None, **kwargs: Any + ) -> AsyncItemPaged["_models.ReplicationAppliance"]: + """Gets the list of appliances. + + Gets the list of Azure Site Recovery appliances for the vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :keyword filter: OData filter options. Default value is None. + :paramtype filter: str + :return: An iterator like instance of ReplicationAppliance + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationAppliance] + :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.OperationsDiscoveryCollection] = kwargs.pop("cls", None) + cls: ClsType[List[_models.ReplicationAppliance]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -83,14 +26755,21 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.OperationsDiscovery"]: def prepare_request(next_link=None): if not next_link: - _request = build_list_request( - resource_group_name=self._config.resource_group_name, + _request = build_replication_appliances_list_request( + resource_group_name=resource_group_name, + resource_name=resource_name, subscription_id=self._config.subscription_id, - api_version=api_version, + filter=filter, + 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 @@ -105,16 +26784,24 @@ def prepare_request(next_link=None): _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" + 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("OperationsDiscoveryCollection", pipeline_response) - list_of_elem = deserialized.value + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.ReplicationAppliance], + 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) @@ -132,3 +26819,314 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) + + +class SupportedOperatingSystemsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.aio.SiteRecoveryManagementClient`'s + :attr:`supported_operating_systems` 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: SiteRecoveryManagementClientConfiguration = ( + 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, resource_name: str, *, instance_type: Optional[str] = None, **kwargs: Any + ) -> _models.SupportedOperatingSystems: + """Gets the data of supported operating systems by SRS. + + Gets the data of supported operating systems by SRS. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :keyword instance_type: The instance type. Default value is None. + :paramtype instance_type: str + :return: SupportedOperatingSystems. The SupportedOperatingSystems is compatible with + MutableMapping + :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.SupportedOperatingSystems + :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.SupportedOperatingSystems] = kwargs.pop("cls", None) + + _request = build_supported_operating_systems_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + instance_type=instance_type, + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.SupportedOperatingSystems, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class ReplicationVaultHealthOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.aio.SiteRecoveryManagementClient`'s + :attr:`replication_vault_health` 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: SiteRecoveryManagementClientConfiguration = ( + 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, resource_name: str, **kwargs: Any) -> _models.VaultHealthDetails: + """Gets the health summary for the vault. + + Gets the health details of the vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :return: VaultHealthDetails. The VaultHealthDetails is compatible with MutableMapping + :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.VaultHealthDetails + :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.VaultHealthDetails] = kwargs.pop("cls", None) + + _request = build_replication_vault_health_get_request( + resource_group_name=resource_group_name, + resource_name=resource_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.VaultHealthDetails, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _refresh_initial( + self, resource_group_name: str, resource_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_replication_vault_health_refresh_request( + resource_group_name=resource_group_name, + resource_name=resource_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) + raise HttpResponseError(response=response, 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")) + + 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_refresh( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.VaultHealthDetails]: + """Refreshes health summary of the vault. + + Refreshes health summary of the vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :return: An instance of AsyncLROPoller that returns VaultHealthDetails. The VaultHealthDetails + is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.VaultHealthDetails] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.VaultHealthDetails] = 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._refresh_initial( + resource_group_name=resource_group_name, + resource_name=resource_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): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.VaultHealthDetails, 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.VaultHealthDetails].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.VaultHealthDetails]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_patch.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_patch.py index f7dd32510333..87676c65a8f0 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_patch.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_patch.py @@ -1,14 +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/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_recovery_points_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_recovery_points_operations.py deleted file mode 100644 index 6bdc84f1ee00..000000000000 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_recovery_points_operations.py +++ /dev/null @@ -1,221 +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, AsyncIterable, Callable, Dict, 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 ..._serialization import Deserializer, Serializer -from ...operations._recovery_points_operations import ( - build_get_request, - build_list_by_replication_protected_items_request, -) -from .._configuration import SiteRecoveryManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class RecoveryPointsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicessiterecovery.aio.SiteRecoveryManagementClient`'s - :attr:`recovery_points` 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: SiteRecoveryManagementClientConfiguration = ( - 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_replication_protected_items( - self, fabric_name: str, protection_container_name: str, replicated_protected_item_name: str, **kwargs: Any - ) -> AsyncIterable["_models.RecoveryPoint"]: - """Gets the list of recovery points for a replication protected item. - - Lists the available recovery points for a replication protected item. - - :param fabric_name: The fabric name. Required. - :type fabric_name: str - :param protection_container_name: The protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: The replication protected item name. Required. - :type replicated_protected_item_name: str - :return: An iterator like instance of either RecoveryPoint or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPoint] - :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.RecoveryPointCollection] = 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_replication_protected_items_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replicated_protected_item_name=replicated_protected_item_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("RecoveryPointCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - recovery_point_name: str, - **kwargs: Any - ) -> _models.RecoveryPoint: - """Gets a recovery point. - - Get the details of specified recovery point. - - :param fabric_name: The fabric name. Required. - :type fabric_name: str - :param protection_container_name: The protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: The replication protected item name. Required. - :type replicated_protected_item_name: str - :param recovery_point_name: The recovery point name. Required. - :type recovery_point_name: str - :return: RecoveryPoint or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPoint - :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.RecoveryPoint] = kwargs.pop("cls", None) - - _request = build_get_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replicated_protected_item_name=replicated_protected_item_name, - recovery_point_name=recovery_point_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("RecoveryPoint", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_alert_settings_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_alert_settings_operations.py deleted file mode 100644 index ee4869a073eb..000000000000 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_alert_settings_operations.py +++ /dev/null @@ -1,314 +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, AsyncIterable, Callable, Dict, 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 ..._serialization import Deserializer, Serializer -from ...operations._replication_alert_settings_operations import ( - build_create_request, - build_get_request, - build_list_request, -) -from .._configuration import SiteRecoveryManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ReplicationAlertSettingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicessiterecovery.aio.SiteRecoveryManagementClient`'s - :attr:`replication_alert_settings` 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: SiteRecoveryManagementClientConfiguration = ( - 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) -> AsyncIterable["_models.Alert"]: - """Gets the list of configured email notification(alert) configurations. - - Gets the list of email notification(alert) configurations for the vault. - - :return: An iterator like instance of either Alert or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.Alert] - :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.AlertCollection] = 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_request( - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("AlertCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get(self, alert_setting_name: str, **kwargs: Any) -> _models.Alert: - """Gets an email notification(alert) configuration. - - Gets the details of the specified email notification(alert) configuration. - - :param alert_setting_name: The name of the email notification configuration. Required. - :type alert_setting_name: str - :return: Alert or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.Alert - :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.Alert] = kwargs.pop("cls", None) - - _request = build_get_request( - alert_setting_name=alert_setting_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("Alert", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def create( - self, - alert_setting_name: str, - request: _models.ConfigureAlertRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Alert: - """Configures email notifications for this vault. - - Create or update an email notification(alert) configuration. - - :param alert_setting_name: The name of the email notification(alert) configuration. Required. - :type alert_setting_name: str - :param request: The input to configure the email notification(alert). Required. - :type request: ~azure.mgmt.recoveryservicessiterecovery.models.ConfigureAlertRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Alert or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.Alert - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create( - self, alert_setting_name: str, request: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Alert: - """Configures email notifications for this vault. - - Create or update an email notification(alert) configuration. - - :param alert_setting_name: The name of the email notification(alert) configuration. Required. - :type alert_setting_name: str - :param request: The input to configure the email notification(alert). Required. - :type request: 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: Alert or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.Alert - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create( - self, alert_setting_name: str, request: Union[_models.ConfigureAlertRequest, IO[bytes]], **kwargs: Any - ) -> _models.Alert: - """Configures email notifications for this vault. - - Create or update an email notification(alert) configuration. - - :param alert_setting_name: The name of the email notification(alert) configuration. Required. - :type alert_setting_name: str - :param request: The input to configure the email notification(alert). Is either a - ConfigureAlertRequest type or a IO[bytes] type. Required. - :type request: ~azure.mgmt.recoveryservicessiterecovery.models.ConfigureAlertRequest or - IO[bytes] - :return: Alert or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.Alert - :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.Alert] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(request, (IOBase, bytes)): - _content = request - else: - _json = self._serialize.body(request, "ConfigureAlertRequest") - - _request = build_create_request( - alert_setting_name=alert_setting_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("Alert", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_appliances_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_appliances_operations.py deleted file mode 100644 index 1cd337de24f0..000000000000 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_appliances_operations.py +++ /dev/null @@ -1,139 +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, AsyncIterable, Callable, Dict, 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.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._serialization import Deserializer, Serializer -from ...operations._replication_appliances_operations import build_list_request -from .._configuration import SiteRecoveryManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ReplicationAppliancesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicessiterecovery.aio.SiteRecoveryManagementClient`'s - :attr:`replication_appliances` 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: SiteRecoveryManagementClientConfiguration = ( - 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, filter: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_models.ReplicationAppliance"]: - """Gets the list of appliances. - - Gets the list of Azure Site Recovery appliances for the vault. - - :param filter: OData filter options. Default value is None. - :type filter: str - :return: An iterator like instance of either ReplicationAppliance or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationAppliance] - :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.ApplianceCollection] = 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_request( - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_name, - subscription_id=self._config.subscription_id, - filter=filter, - 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("ApplianceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_eligibility_results_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_eligibility_results_operations.py deleted file mode 100644 index a607f1d3e4ef..000000000000 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_eligibility_results_operations.py +++ /dev/null @@ -1,162 +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, Dict, 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 ..._serialization import Deserializer, Serializer -from ...operations._replication_eligibility_results_operations import build_get_request, build_list_request -from .._configuration import SiteRecoveryManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ReplicationEligibilityResultsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicessiterecovery.aio.SiteRecoveryManagementClient`'s - :attr:`replication_eligibility_results` 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: SiteRecoveryManagementClientConfiguration = ( - 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(self, virtual_machine_name: str, **kwargs: Any) -> _models.ReplicationEligibilityResultsCollection: - """Gets the validation errors in case the VM is unsuitable for protection. - - Validates whether a given VM can be protected or not in which case returns list of errors. - - :param virtual_machine_name: Virtual Machine name. Required. - :type virtual_machine_name: str - :return: ReplicationEligibilityResultsCollection or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationEligibilityResultsCollection - :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.ReplicationEligibilityResultsCollection] = kwargs.pop("cls", None) - - _request = build_list_request( - virtual_machine_name=virtual_machine_name, - resource_group_name=self._config.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) - - _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("ReplicationEligibilityResultsCollection", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def get(self, virtual_machine_name: str, **kwargs: Any) -> _models.ReplicationEligibilityResults: - """Gets the validation errors in case the VM is unsuitable for protection. - - Validates whether a given VM can be protected or not in which case returns list of errors. - - :param virtual_machine_name: Virtual Machine name. Required. - :type virtual_machine_name: str - :return: ReplicationEligibilityResults or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationEligibilityResults - :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.ReplicationEligibilityResults] = kwargs.pop("cls", None) - - _request = build_get_request( - virtual_machine_name=virtual_machine_name, - resource_group_name=self._config.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) - - _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("ReplicationEligibilityResults", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_events_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_events_operations.py deleted file mode 100644 index bb8bd4cbbe22..000000000000 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_events_operations.py +++ /dev/null @@ -1,194 +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, AsyncIterable, Callable, Dict, 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 ..._serialization import Deserializer, Serializer -from ...operations._replication_events_operations import build_get_request, build_list_request -from .._configuration import SiteRecoveryManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ReplicationEventsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicessiterecovery.aio.SiteRecoveryManagementClient`'s - :attr:`replication_events` 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: SiteRecoveryManagementClientConfiguration = ( - 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, filter: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_models.Event"]: - """Gets the list of Azure Site Recovery events. - - Gets the list of Azure Site Recovery events for the vault. - - :param filter: OData filter options. Default value is None. - :type filter: str - :return: An iterator like instance of either Event or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.Event] - :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.EventCollection] = 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_request( - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_name, - subscription_id=self._config.subscription_id, - filter=filter, - 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("EventCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get(self, event_name: str, **kwargs: Any) -> _models.Event: - """Get the details of an Azure Site recovery event. - - The operation to get the details of an Azure Site recovery event. - - :param event_name: The name of the Azure Site Recovery event. Required. - :type event_name: str - :return: Event or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.Event - :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.Event] = kwargs.pop("cls", None) - - _request = build_get_request( - event_name=event_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("Event", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_fabrics_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_fabrics_operations.py deleted file mode 100644 index 0ccd2db23945..000000000000 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_fabrics_operations.py +++ /dev/null @@ -1,1271 +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, AsyncIterable, AsyncIterator, Callable, Dict, 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 ..._serialization import Deserializer, Serializer -from ...operations._replication_fabrics_operations import ( - build_check_consistency_request, - build_create_request, - build_delete_request, - build_get_request, - build_list_request, - build_migrate_to_aad_request, - build_purge_request, - build_reassociate_gateway_request, - build_remove_infra_request, - build_renew_certificate_request, -) -from .._configuration import SiteRecoveryManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ReplicationFabricsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicessiterecovery.aio.SiteRecoveryManagementClient`'s - :attr:`replication_fabrics` 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: SiteRecoveryManagementClientConfiguration = ( - 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) -> AsyncIterable["_models.Fabric"]: - """Gets the list of ASR fabrics. - - Gets a list of the Azure Site Recovery fabrics in the vault. - - :return: An iterator like instance of either Fabric or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.Fabric] - :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.FabricCollection] = 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_request( - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("FabricCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get(self, fabric_name: str, filter: Optional[str] = None, **kwargs: Any) -> _models.Fabric: - """Gets the details of an ASR fabric. - - Gets the details of an Azure Site Recovery fabric. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param filter: OData filter options. Default value is None. - :type filter: str - :return: Fabric or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.Fabric - :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.Fabric] = kwargs.pop("cls", None) - - _request = build_get_request( - fabric_name=fabric_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_name, - subscription_id=self._config.subscription_id, - filter=filter, - 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("Fabric", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_initial( - self, fabric_name: str, input: Union[_models.FabricCreationInput, 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(input, (IOBase, bytes)): - _content = input - else: - _json = self._serialize.body(input, "FabricCreationInput") - - _request = build_create_request( - fabric_name=fabric_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create( - self, - fabric_name: str, - input: _models.FabricCreationInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Fabric]: - """Creates an Azure Site Recovery fabric. - - The operation to create an Azure Site Recovery fabric (for e.g. Hyper-V site). - - :param fabric_name: Name of the ASR fabric. Required. - :type fabric_name: str - :param input: Fabric creation input. Required. - :type input: ~azure.mgmt.recoveryservicessiterecovery.models.FabricCreationInput - :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 Fabric or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Fabric] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create( - self, fabric_name: str, input: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.Fabric]: - """Creates an Azure Site Recovery fabric. - - The operation to create an Azure Site Recovery fabric (for e.g. Hyper-V site). - - :param fabric_name: Name of the ASR fabric. Required. - :type fabric_name: str - :param input: Fabric creation input. Required. - :type input: 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 Fabric or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Fabric] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create( - self, fabric_name: str, input: Union[_models.FabricCreationInput, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.Fabric]: - """Creates an Azure Site Recovery fabric. - - The operation to create an Azure Site Recovery fabric (for e.g. Hyper-V site). - - :param fabric_name: Name of the ASR fabric. Required. - :type fabric_name: str - :param input: Fabric creation input. Is either a FabricCreationInput type or a IO[bytes] type. - Required. - :type input: ~azure.mgmt.recoveryservicessiterecovery.models.FabricCreationInput or IO[bytes] - :return: An instance of AsyncLROPoller that returns either Fabric or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Fabric] - :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.Fabric] = 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( - fabric_name=fabric_name, - input=input, - 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("Fabric", 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.Fabric].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.Fabric]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _purge_initial(self, fabric_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_purge_request( - fabric_name=fabric_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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 [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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_purge(self, fabric_name: str, **kwargs: Any) -> AsyncLROPoller[None]: - """Purges the site. - - The operation to purge(force delete) an Azure Site Recovery fabric. - - :param fabric_name: ASR fabric to purge. Required. - :type fabric_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._purge_initial( - fabric_name=fabric_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 - - async def _check_consistency_initial(self, fabric_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_check_consistency_request( - fabric_name=fabric_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_check_consistency(self, fabric_name: str, **kwargs: Any) -> AsyncLROPoller[_models.Fabric]: - """Checks the consistency of the ASR fabric. - - The operation to perform a consistency check on the fabric. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :return: An instance of AsyncLROPoller that returns either Fabric or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Fabric] - :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.Fabric] = 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._check_consistency_initial( - fabric_name=fabric_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): - deserialized = self._deserialize("Fabric", 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.Fabric].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.Fabric]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _migrate_to_aad_initial(self, fabric_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_migrate_to_aad_request( - fabric_name=fabric_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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 [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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_migrate_to_aad(self, fabric_name: str, **kwargs: Any) -> AsyncLROPoller[None]: - """Migrates the site to AAD. - - The operation to migrate an Azure Site Recovery fabric to AAD. - - :param fabric_name: ASR fabric to migrate. Required. - :type fabric_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._migrate_to_aad_initial( - fabric_name=fabric_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 - - async def _reassociate_gateway_initial( - self, - fabric_name: str, - failover_process_server_request: Union[_models.FailoverProcessServerRequest, 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(failover_process_server_request, (IOBase, bytes)): - _content = failover_process_server_request - else: - _json = self._serialize.body(failover_process_server_request, "FailoverProcessServerRequest") - - _request = build_reassociate_gateway_request( - fabric_name=fabric_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_reassociate_gateway( - self, - fabric_name: str, - failover_process_server_request: _models.FailoverProcessServerRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Fabric]: - """Perform failover of the process server. - - The operation to move replications from a process server to another process server. - - :param fabric_name: The name of the fabric containing the process server. Required. - :type fabric_name: str - :param failover_process_server_request: The input to the failover process server operation. - Required. - :type failover_process_server_request: - ~azure.mgmt.recoveryservicessiterecovery.models.FailoverProcessServerRequest - :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 Fabric or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Fabric] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_reassociate_gateway( - self, - fabric_name: str, - failover_process_server_request: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Fabric]: - """Perform failover of the process server. - - The operation to move replications from a process server to another process server. - - :param fabric_name: The name of the fabric containing the process server. Required. - :type fabric_name: str - :param failover_process_server_request: The input to the failover process server operation. - Required. - :type failover_process_server_request: 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 Fabric or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Fabric] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_reassociate_gateway( - self, - fabric_name: str, - failover_process_server_request: Union[_models.FailoverProcessServerRequest, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.Fabric]: - """Perform failover of the process server. - - The operation to move replications from a process server to another process server. - - :param fabric_name: The name of the fabric containing the process server. Required. - :type fabric_name: str - :param failover_process_server_request: The input to the failover process server operation. Is - either a FailoverProcessServerRequest type or a IO[bytes] type. Required. - :type failover_process_server_request: - ~azure.mgmt.recoveryservicessiterecovery.models.FailoverProcessServerRequest or IO[bytes] - :return: An instance of AsyncLROPoller that returns either Fabric or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Fabric] - :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.Fabric] = 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._reassociate_gateway_initial( - fabric_name=fabric_name, - failover_process_server_request=failover_process_server_request, - 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("Fabric", 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.Fabric].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.Fabric]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial(self, fabric_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( - fabric_name=fabric_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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 [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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete(self, fabric_name: str, **kwargs: Any) -> AsyncLROPoller[None]: - """Deletes the site. - - The operation to delete or remove an Azure Site Recovery fabric. - - :param fabric_name: ASR fabric to delete. Required. - :type fabric_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( - fabric_name=fabric_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 - - async def _renew_certificate_initial( - self, fabric_name: str, renew_certificate: Union[_models.RenewCertificateInput, 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(renew_certificate, (IOBase, bytes)): - _content = renew_certificate - else: - _json = self._serialize.body(renew_certificate, "RenewCertificateInput") - - _request = build_renew_certificate_request( - fabric_name=fabric_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_renew_certificate( - self, - fabric_name: str, - renew_certificate: _models.RenewCertificateInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Fabric]: - """Renews certificate for the fabric. - - Renews the connection certificate for the ASR replication fabric. - - :param fabric_name: fabric name to renew certs for. Required. - :type fabric_name: str - :param renew_certificate: Renew certificate input. Required. - :type renew_certificate: ~azure.mgmt.recoveryservicessiterecovery.models.RenewCertificateInput - :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 Fabric or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Fabric] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_renew_certificate( - self, fabric_name: str, renew_certificate: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.Fabric]: - """Renews certificate for the fabric. - - Renews the connection certificate for the ASR replication fabric. - - :param fabric_name: fabric name to renew certs for. Required. - :type fabric_name: str - :param renew_certificate: Renew certificate input. Required. - :type renew_certificate: 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 Fabric or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Fabric] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_renew_certificate( - self, fabric_name: str, renew_certificate: Union[_models.RenewCertificateInput, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.Fabric]: - """Renews certificate for the fabric. - - Renews the connection certificate for the ASR replication fabric. - - :param fabric_name: fabric name to renew certs for. Required. - :type fabric_name: str - :param renew_certificate: Renew certificate input. Is either a RenewCertificateInput type or a - IO[bytes] type. Required. - :type renew_certificate: ~azure.mgmt.recoveryservicessiterecovery.models.RenewCertificateInput - or IO[bytes] - :return: An instance of AsyncLROPoller that returns either Fabric or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Fabric] - :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.Fabric] = 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._renew_certificate_initial( - fabric_name=fabric_name, - renew_certificate=renew_certificate, - 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("Fabric", 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.Fabric].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.Fabric]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _remove_infra_initial(self, resource_name: str, fabric_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_remove_infra_request( - resource_name=resource_name, - fabric_name=fabric_name, - resource_group_name=self._config.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) - - _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 [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.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - 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_remove_infra(self, resource_name: str, fabric_name: str, **kwargs: Any) -> AsyncLROPoller[None]: - """Removes the appliance's infrastructure under the fabric. - - Removes the appliance's infrastructure under the fabric. - - :param resource_name: Resource name. Required. - :type resource_name: str - :param fabric_name: Fabric name. Required. - :type fabric_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._remove_infra_initial( - resource_name=resource_name, - fabric_name=fabric_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 diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_jobs_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_jobs_operations.py deleted file mode 100644 index c99520442438..000000000000 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_jobs_operations.py +++ /dev/null @@ -1,745 +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, AsyncIterable, AsyncIterator, Callable, Dict, 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 ..._serialization import Deserializer, Serializer -from ...operations._replication_jobs_operations import ( - build_cancel_request, - build_export_request, - build_get_request, - build_list_request, - build_restart_request, - build_resume_request, -) -from .._configuration import SiteRecoveryManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ReplicationJobsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicessiterecovery.aio.SiteRecoveryManagementClient`'s - :attr:`replication_jobs` 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: SiteRecoveryManagementClientConfiguration = ( - 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, filter: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_models.Job"]: - """Gets the list of jobs. - - Gets the list of Azure Site Recovery Jobs for the vault. - - :param filter: OData filter options. Default value is None. - :type filter: str - :return: An iterator like instance of either Job or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.Job] - :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.JobCollection] = 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_request( - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_name, - subscription_id=self._config.subscription_id, - filter=filter, - 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("JobCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get(self, job_name: str, **kwargs: Any) -> _models.Job: - """Gets the job details. - - Get the details of an Azure Site Recovery job. - - :param job_name: Job identifier. Required. - :type job_name: str - :return: Job or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.Job - :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.Job] = kwargs.pop("cls", None) - - _request = build_get_request( - job_name=job_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("Job", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _cancel_initial(self, job_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_cancel_request( - job_name=job_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_cancel(self, job_name: str, **kwargs: Any) -> AsyncLROPoller[_models.Job]: - """Cancels the specified job. - - The operation to cancel an Azure Site Recovery job. - - :param job_name: Job identifier. Required. - :type job_name: str - :return: An instance of AsyncLROPoller that returns either Job or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Job] - :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.Job] = 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._cancel_initial( - job_name=job_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): - deserialized = self._deserialize("Job", 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.Job].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.Job]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _restart_initial(self, job_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_restart_request( - job_name=job_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_restart(self, job_name: str, **kwargs: Any) -> AsyncLROPoller[_models.Job]: - """Restarts the specified job. - - The operation to restart an Azure Site Recovery job. - - :param job_name: Job identifier. Required. - :type job_name: str - :return: An instance of AsyncLROPoller that returns either Job or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Job] - :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.Job] = 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._restart_initial( - job_name=job_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): - deserialized = self._deserialize("Job", 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.Job].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.Job]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _resume_initial( - self, job_name: str, resume_job_params: Union[_models.ResumeJobParams, 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(resume_job_params, (IOBase, bytes)): - _content = resume_job_params - else: - _json = self._serialize.body(resume_job_params, "ResumeJobParams") - - _request = build_resume_request( - job_name=job_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_resume( - self, - job_name: str, - resume_job_params: _models.ResumeJobParams, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Job]: - """Resumes the specified job. - - The operation to resume an Azure Site Recovery job. - - :param job_name: Job identifier. Required. - :type job_name: str - :param resume_job_params: Resume rob comments. Required. - :type resume_job_params: ~azure.mgmt.recoveryservicessiterecovery.models.ResumeJobParams - :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 Job or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Job] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_resume( - self, job_name: str, resume_job_params: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.Job]: - """Resumes the specified job. - - The operation to resume an Azure Site Recovery job. - - :param job_name: Job identifier. Required. - :type job_name: str - :param resume_job_params: Resume rob comments. Required. - :type resume_job_params: 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 Job or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Job] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_resume( - self, job_name: str, resume_job_params: Union[_models.ResumeJobParams, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.Job]: - """Resumes the specified job. - - The operation to resume an Azure Site Recovery job. - - :param job_name: Job identifier. Required. - :type job_name: str - :param resume_job_params: Resume rob comments. Is either a ResumeJobParams type or a IO[bytes] - type. Required. - :type resume_job_params: ~azure.mgmt.recoveryservicessiterecovery.models.ResumeJobParams or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either Job or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Job] - :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.Job] = 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._resume_initial( - job_name=job_name, - resume_job_params=resume_job_params, - 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("Job", 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.Job].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.Job]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _export_initial( - self, job_query_parameter: Union[_models.JobQueryParameter, 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(job_query_parameter, (IOBase, bytes)): - _content = job_query_parameter - else: - _json = self._serialize.body(job_query_parameter, "JobQueryParameter") - - _request = build_export_request( - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_export( - self, job_query_parameter: _models.JobQueryParameter, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.Job]: - """Exports the details of the Azure Site Recovery jobs of the vault. - - The operation to export the details of the Azure Site Recovery jobs of the vault. - - :param job_query_parameter: job query filter. Required. - :type job_query_parameter: ~azure.mgmt.recoveryservicessiterecovery.models.JobQueryParameter - :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 Job or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Job] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_export( - self, job_query_parameter: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.Job]: - """Exports the details of the Azure Site Recovery jobs of the vault. - - The operation to export the details of the Azure Site Recovery jobs of the vault. - - :param job_query_parameter: job query filter. Required. - :type job_query_parameter: 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 Job or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Job] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_export( - self, job_query_parameter: Union[_models.JobQueryParameter, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.Job]: - """Exports the details of the Azure Site Recovery jobs of the vault. - - The operation to export the details of the Azure Site Recovery jobs of the vault. - - :param job_query_parameter: job query filter. Is either a JobQueryParameter type or a IO[bytes] - type. Required. - :type job_query_parameter: ~azure.mgmt.recoveryservicessiterecovery.models.JobQueryParameter or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either Job or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Job] - :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.Job] = 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._export_initial( - job_query_parameter=job_query_parameter, - 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("Job", 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.Job].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.Job]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_logical_networks_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_logical_networks_operations.py deleted file mode 100644 index d1abec506bea..000000000000 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_logical_networks_operations.py +++ /dev/null @@ -1,200 +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, AsyncIterable, Callable, Dict, 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 ..._serialization import Deserializer, Serializer -from ...operations._replication_logical_networks_operations import ( - build_get_request, - build_list_by_replication_fabrics_request, -) -from .._configuration import SiteRecoveryManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ReplicationLogicalNetworksOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicessiterecovery.aio.SiteRecoveryManagementClient`'s - :attr:`replication_logical_networks` 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: SiteRecoveryManagementClientConfiguration = ( - 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_replication_fabrics(self, fabric_name: str, **kwargs: Any) -> AsyncIterable["_models.LogicalNetwork"]: - """Gets the list of logical networks under a fabric. - - Lists all the logical networks of the Azure Site Recovery fabric. - - :param fabric_name: Server Id. Required. - :type fabric_name: str - :return: An iterator like instance of either LogicalNetwork or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.LogicalNetwork] - :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.LogicalNetworkCollection] = 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_replication_fabrics_request( - fabric_name=fabric_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("LogicalNetworkCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get(self, fabric_name: str, logical_network_name: str, **kwargs: Any) -> _models.LogicalNetwork: - """Gets a logical network with specified server id and logical network name. - - Gets the details of a logical network. - - :param fabric_name: Server Id. Required. - :type fabric_name: str - :param logical_network_name: Logical network name. Required. - :type logical_network_name: str - :return: LogicalNetwork or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.LogicalNetwork - :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.LogicalNetwork] = kwargs.pop("cls", None) - - _request = build_get_request( - fabric_name=fabric_name, - logical_network_name=logical_network_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("LogicalNetwork", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_migration_items_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_migration_items_operations.py deleted file mode 100644 index 833dde53f19c..000000000000 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_migration_items_operations.py +++ /dev/null @@ -1,2164 +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, AsyncIterable, AsyncIterator, Callable, Dict, 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 ..._serialization import Deserializer, Serializer -from ...operations._replication_migration_items_operations import ( - build_create_request, - build_delete_request, - build_get_request, - build_list_by_replication_protection_containers_request, - build_list_request, - build_migrate_request, - build_pause_replication_request, - build_resume_replication_request, - build_resync_request, - build_test_migrate_cleanup_request, - build_test_migrate_request, - build_update_request, -) -from .._configuration import SiteRecoveryManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ReplicationMigrationItemsOperations: # pylint: disable=too-many-public-methods - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicessiterecovery.aio.SiteRecoveryManagementClient`'s - :attr:`replication_migration_items` 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: SiteRecoveryManagementClientConfiguration = ( - 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_replication_protection_containers( # pylint: disable=name-too-long - self, - fabric_name: str, - protection_container_name: str, - skip_token: Optional[str] = None, - take_token: Optional[str] = None, - filter: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterable["_models.MigrationItem"]: - """Gets the list of migration items in the protection container. - - Gets the list of ASR migration items in the protection container. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param skip_token: The pagination token. Default value is None. - :type skip_token: str - :param take_token: The page size. Default value is None. - :type take_token: str - :param filter: OData filter options. Default value is None. - :type filter: str - :return: An iterator like instance of either MigrationItem or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] - :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.MigrationItemCollection] = 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_replication_protection_containers_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_name, - subscription_id=self._config.subscription_id, - skip_token=skip_token, - take_token=take_token, - filter=filter, - 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("MigrationItemCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, fabric_name: str, protection_container_name: str, migration_item_name: str, **kwargs: Any - ) -> _models.MigrationItem: - """Gets the details of a migration item. - - Gets the details of a migration item. - - :param fabric_name: Fabric unique name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param migration_item_name: Migration item name. Required. - :type migration_item_name: str - :return: MigrationItem or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem - :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.MigrationItem] = kwargs.pop("cls", None) - - _request = build_get_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - migration_item_name=migration_item_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("MigrationItem", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_initial( - self, - fabric_name: str, - protection_container_name: str, - migration_item_name: str, - input: Union[_models.EnableMigrationInput, 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(input, (IOBase, bytes)): - _content = input - else: - _json = self._serialize.body(input, "EnableMigrationInput") - - _request = build_create_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - migration_item_name=migration_item_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create( - self, - fabric_name: str, - protection_container_name: str, - migration_item_name: str, - input: _models.EnableMigrationInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.MigrationItem]: - """Enables migration. - - The operation to create an ASR migration item (enable migration). - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param migration_item_name: Migration item name. Required. - :type migration_item_name: str - :param input: Enable migration input. Required. - :type input: ~azure.mgmt.recoveryservicessiterecovery.models.EnableMigrationInput - :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 MigrationItem or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create( - self, - fabric_name: str, - protection_container_name: str, - migration_item_name: str, - input: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.MigrationItem]: - """Enables migration. - - The operation to create an ASR migration item (enable migration). - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param migration_item_name: Migration item name. Required. - :type migration_item_name: str - :param input: Enable migration input. Required. - :type input: 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 MigrationItem or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create( - self, - fabric_name: str, - protection_container_name: str, - migration_item_name: str, - input: Union[_models.EnableMigrationInput, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.MigrationItem]: - """Enables migration. - - The operation to create an ASR migration item (enable migration). - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param migration_item_name: Migration item name. Required. - :type migration_item_name: str - :param input: Enable migration input. Is either a EnableMigrationInput type or a IO[bytes] - type. Required. - :type input: ~azure.mgmt.recoveryservicessiterecovery.models.EnableMigrationInput or IO[bytes] - :return: An instance of AsyncLROPoller that returns either MigrationItem or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] - :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.MigrationItem] = 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( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - migration_item_name=migration_item_name, - input=input, - 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("MigrationItem", 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.MigrationItem].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.MigrationItem]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, - fabric_name: str, - protection_container_name: str, - migration_item_name: str, - delete_option: Optional[str] = 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 = 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( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - migration_item_name=migration_item_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_name, - subscription_id=self._config.subscription_id, - delete_option=delete_option, - 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 [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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, - fabric_name: str, - protection_container_name: str, - migration_item_name: str, - delete_option: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete the migration item. - - The operation to delete an ASR migration item. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param migration_item_name: Migration item name. Required. - :type migration_item_name: str - :param delete_option: The delete option. Default value is None. - :type delete_option: 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( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - migration_item_name=migration_item_name, - delete_option=delete_option, - 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 _update_initial( - self, - fabric_name: str, - protection_container_name: str, - migration_item_name: str, - input: Union[_models.UpdateMigrationItemInput, 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(input, (IOBase, bytes)): - _content = input - else: - _json = self._serialize.body(input, "UpdateMigrationItemInput") - - _request = build_update_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - migration_item_name=migration_item_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - fabric_name: str, - protection_container_name: str, - migration_item_name: str, - input: _models.UpdateMigrationItemInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.MigrationItem]: - """Updates migration item. - - The operation to update the recovery settings of an ASR migration item. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param migration_item_name: Migration item name. Required. - :type migration_item_name: str - :param input: Update migration item input. Required. - :type input: ~azure.mgmt.recoveryservicessiterecovery.models.UpdateMigrationItemInput - :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 MigrationItem or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - fabric_name: str, - protection_container_name: str, - migration_item_name: str, - input: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.MigrationItem]: - """Updates migration item. - - The operation to update the recovery settings of an ASR migration item. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param migration_item_name: Migration item name. Required. - :type migration_item_name: str - :param input: Update migration item input. Required. - :type input: 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 MigrationItem or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - fabric_name: str, - protection_container_name: str, - migration_item_name: str, - input: Union[_models.UpdateMigrationItemInput, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.MigrationItem]: - """Updates migration item. - - The operation to update the recovery settings of an ASR migration item. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param migration_item_name: Migration item name. Required. - :type migration_item_name: str - :param input: Update migration item input. Is either a UpdateMigrationItemInput type or a - IO[bytes] type. Required. - :type input: ~azure.mgmt.recoveryservicessiterecovery.models.UpdateMigrationItemInput or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either MigrationItem or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] - :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.MigrationItem] = 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( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - migration_item_name=migration_item_name, - input=input, - 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("MigrationItem", 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.MigrationItem].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.MigrationItem]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _migrate_initial( - self, - fabric_name: str, - protection_container_name: str, - migration_item_name: str, - migrate_input: Union[_models.MigrateInput, 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(migrate_input, (IOBase, bytes)): - _content = migrate_input - else: - _json = self._serialize.body(migrate_input, "MigrateInput") - - _request = build_migrate_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - migration_item_name=migration_item_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_migrate( - self, - fabric_name: str, - protection_container_name: str, - migration_item_name: str, - migrate_input: _models.MigrateInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.MigrationItem]: - """Migrate item. - - The operation to initiate migration of the item. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param migration_item_name: Migration item name. Required. - :type migration_item_name: str - :param migrate_input: Migrate input. Required. - :type migrate_input: ~azure.mgmt.recoveryservicessiterecovery.models.MigrateInput - :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 MigrationItem or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_migrate( - self, - fabric_name: str, - protection_container_name: str, - migration_item_name: str, - migrate_input: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.MigrationItem]: - """Migrate item. - - The operation to initiate migration of the item. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param migration_item_name: Migration item name. Required. - :type migration_item_name: str - :param migrate_input: Migrate input. Required. - :type migrate_input: 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 MigrationItem or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_migrate( - self, - fabric_name: str, - protection_container_name: str, - migration_item_name: str, - migrate_input: Union[_models.MigrateInput, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.MigrationItem]: - """Migrate item. - - The operation to initiate migration of the item. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param migration_item_name: Migration item name. Required. - :type migration_item_name: str - :param migrate_input: Migrate input. Is either a MigrateInput type or a IO[bytes] type. - Required. - :type migrate_input: ~azure.mgmt.recoveryservicessiterecovery.models.MigrateInput or IO[bytes] - :return: An instance of AsyncLROPoller that returns either MigrationItem or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] - :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.MigrationItem] = 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._migrate_initial( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - migration_item_name=migration_item_name, - migrate_input=migrate_input, - 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("MigrationItem", 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.MigrationItem].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.MigrationItem]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _pause_replication_initial( - self, - fabric_name: str, - protection_container_name: str, - migration_item_name: str, - pause_replication_input: Union[_models.PauseReplicationInput, 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(pause_replication_input, (IOBase, bytes)): - _content = pause_replication_input - else: - _json = self._serialize.body(pause_replication_input, "PauseReplicationInput") - - _request = build_pause_replication_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - migration_item_name=migration_item_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_pause_replication( - self, - fabric_name: str, - protection_container_name: str, - migration_item_name: str, - pause_replication_input: _models.PauseReplicationInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.MigrationItem]: - """Pause replication. - - The operation to initiate pause replication of the item. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param migration_item_name: Migration item name. Required. - :type migration_item_name: str - :param pause_replication_input: Pause replication input. Required. - :type pause_replication_input: - ~azure.mgmt.recoveryservicessiterecovery.models.PauseReplicationInput - :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 MigrationItem or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_pause_replication( - self, - fabric_name: str, - protection_container_name: str, - migration_item_name: str, - pause_replication_input: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.MigrationItem]: - """Pause replication. - - The operation to initiate pause replication of the item. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param migration_item_name: Migration item name. Required. - :type migration_item_name: str - :param pause_replication_input: Pause replication input. Required. - :type pause_replication_input: 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 MigrationItem or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_pause_replication( - self, - fabric_name: str, - protection_container_name: str, - migration_item_name: str, - pause_replication_input: Union[_models.PauseReplicationInput, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.MigrationItem]: - """Pause replication. - - The operation to initiate pause replication of the item. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param migration_item_name: Migration item name. Required. - :type migration_item_name: str - :param pause_replication_input: Pause replication input. Is either a PauseReplicationInput type - or a IO[bytes] type. Required. - :type pause_replication_input: - ~azure.mgmt.recoveryservicessiterecovery.models.PauseReplicationInput or IO[bytes] - :return: An instance of AsyncLROPoller that returns either MigrationItem or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] - :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.MigrationItem] = 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._pause_replication_initial( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - migration_item_name=migration_item_name, - pause_replication_input=pause_replication_input, - 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("MigrationItem", 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.MigrationItem].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.MigrationItem]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _resume_replication_initial( - self, - fabric_name: str, - protection_container_name: str, - migration_item_name: str, - resume_replication_input: Union[_models.ResumeReplicationInput, 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(resume_replication_input, (IOBase, bytes)): - _content = resume_replication_input - else: - _json = self._serialize.body(resume_replication_input, "ResumeReplicationInput") - - _request = build_resume_replication_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - migration_item_name=migration_item_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_resume_replication( - self, - fabric_name: str, - protection_container_name: str, - migration_item_name: str, - resume_replication_input: _models.ResumeReplicationInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.MigrationItem]: - """Resume replication. - - The operation to initiate resume replication of the item. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param migration_item_name: Migration item name. Required. - :type migration_item_name: str - :param resume_replication_input: Resume replication input. Required. - :type resume_replication_input: - ~azure.mgmt.recoveryservicessiterecovery.models.ResumeReplicationInput - :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 MigrationItem or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_resume_replication( - self, - fabric_name: str, - protection_container_name: str, - migration_item_name: str, - resume_replication_input: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.MigrationItem]: - """Resume replication. - - The operation to initiate resume replication of the item. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param migration_item_name: Migration item name. Required. - :type migration_item_name: str - :param resume_replication_input: Resume replication input. Required. - :type resume_replication_input: 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 MigrationItem or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_resume_replication( - self, - fabric_name: str, - protection_container_name: str, - migration_item_name: str, - resume_replication_input: Union[_models.ResumeReplicationInput, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.MigrationItem]: - """Resume replication. - - The operation to initiate resume replication of the item. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param migration_item_name: Migration item name. Required. - :type migration_item_name: str - :param resume_replication_input: Resume replication input. Is either a ResumeReplicationInput - type or a IO[bytes] type. Required. - :type resume_replication_input: - ~azure.mgmt.recoveryservicessiterecovery.models.ResumeReplicationInput or IO[bytes] - :return: An instance of AsyncLROPoller that returns either MigrationItem or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] - :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.MigrationItem] = 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._resume_replication_initial( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - migration_item_name=migration_item_name, - resume_replication_input=resume_replication_input, - 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("MigrationItem", 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.MigrationItem].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.MigrationItem]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _resync_initial( - self, - fabric_name: str, - protection_container_name: str, - migration_item_name: str, - input: Union[_models.ResyncInput, 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(input, (IOBase, bytes)): - _content = input - else: - _json = self._serialize.body(input, "ResyncInput") - - _request = build_resync_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - migration_item_name=migration_item_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_resync( - self, - fabric_name: str, - protection_container_name: str, - migration_item_name: str, - input: _models.ResyncInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.MigrationItem]: - """Resynchronizes replication. - - The operation to resynchronize replication of an ASR migration item. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param migration_item_name: Migration item name. Required. - :type migration_item_name: str - :param input: Resync input. Required. - :type input: ~azure.mgmt.recoveryservicessiterecovery.models.ResyncInput - :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 MigrationItem or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_resync( - self, - fabric_name: str, - protection_container_name: str, - migration_item_name: str, - input: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.MigrationItem]: - """Resynchronizes replication. - - The operation to resynchronize replication of an ASR migration item. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param migration_item_name: Migration item name. Required. - :type migration_item_name: str - :param input: Resync input. Required. - :type input: 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 MigrationItem or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_resync( - self, - fabric_name: str, - protection_container_name: str, - migration_item_name: str, - input: Union[_models.ResyncInput, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.MigrationItem]: - """Resynchronizes replication. - - The operation to resynchronize replication of an ASR migration item. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param migration_item_name: Migration item name. Required. - :type migration_item_name: str - :param input: Resync input. Is either a ResyncInput type or a IO[bytes] type. Required. - :type input: ~azure.mgmt.recoveryservicessiterecovery.models.ResyncInput or IO[bytes] - :return: An instance of AsyncLROPoller that returns either MigrationItem or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] - :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.MigrationItem] = 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._resync_initial( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - migration_item_name=migration_item_name, - input=input, - 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("MigrationItem", 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.MigrationItem].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.MigrationItem]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _test_migrate_initial( - self, - fabric_name: str, - protection_container_name: str, - migration_item_name: str, - test_migrate_input: Union[_models.TestMigrateInput, 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(test_migrate_input, (IOBase, bytes)): - _content = test_migrate_input - else: - _json = self._serialize.body(test_migrate_input, "TestMigrateInput") - - _request = build_test_migrate_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - migration_item_name=migration_item_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_test_migrate( - self, - fabric_name: str, - protection_container_name: str, - migration_item_name: str, - test_migrate_input: _models.TestMigrateInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.MigrationItem]: - """Test migrate item. - - The operation to initiate test migration of the item. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param migration_item_name: Migration item name. Required. - :type migration_item_name: str - :param test_migrate_input: Test migrate input. Required. - :type test_migrate_input: ~azure.mgmt.recoveryservicessiterecovery.models.TestMigrateInput - :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 MigrationItem or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_test_migrate( - self, - fabric_name: str, - protection_container_name: str, - migration_item_name: str, - test_migrate_input: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.MigrationItem]: - """Test migrate item. - - The operation to initiate test migration of the item. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param migration_item_name: Migration item name. Required. - :type migration_item_name: str - :param test_migrate_input: Test migrate input. Required. - :type test_migrate_input: 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 MigrationItem or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_test_migrate( - self, - fabric_name: str, - protection_container_name: str, - migration_item_name: str, - test_migrate_input: Union[_models.TestMigrateInput, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.MigrationItem]: - """Test migrate item. - - The operation to initiate test migration of the item. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param migration_item_name: Migration item name. Required. - :type migration_item_name: str - :param test_migrate_input: Test migrate input. Is either a TestMigrateInput type or a IO[bytes] - type. Required. - :type test_migrate_input: ~azure.mgmt.recoveryservicessiterecovery.models.TestMigrateInput or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either MigrationItem or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] - :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.MigrationItem] = 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._test_migrate_initial( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - migration_item_name=migration_item_name, - test_migrate_input=test_migrate_input, - 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("MigrationItem", 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.MigrationItem].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.MigrationItem]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _test_migrate_cleanup_initial( - self, - fabric_name: str, - protection_container_name: str, - migration_item_name: str, - test_migrate_cleanup_input: Union[_models.TestMigrateCleanupInput, 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(test_migrate_cleanup_input, (IOBase, bytes)): - _content = test_migrate_cleanup_input - else: - _json = self._serialize.body(test_migrate_cleanup_input, "TestMigrateCleanupInput") - - _request = build_test_migrate_cleanup_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - migration_item_name=migration_item_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_test_migrate_cleanup( - self, - fabric_name: str, - protection_container_name: str, - migration_item_name: str, - test_migrate_cleanup_input: _models.TestMigrateCleanupInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.MigrationItem]: - """Test migrate cleanup. - - The operation to initiate test migrate cleanup. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param migration_item_name: Migration item name. Required. - :type migration_item_name: str - :param test_migrate_cleanup_input: Test migrate cleanup input. Required. - :type test_migrate_cleanup_input: - ~azure.mgmt.recoveryservicessiterecovery.models.TestMigrateCleanupInput - :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 MigrationItem or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_test_migrate_cleanup( - self, - fabric_name: str, - protection_container_name: str, - migration_item_name: str, - test_migrate_cleanup_input: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.MigrationItem]: - """Test migrate cleanup. - - The operation to initiate test migrate cleanup. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param migration_item_name: Migration item name. Required. - :type migration_item_name: str - :param test_migrate_cleanup_input: Test migrate cleanup input. Required. - :type test_migrate_cleanup_input: 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 MigrationItem or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_test_migrate_cleanup( - self, - fabric_name: str, - protection_container_name: str, - migration_item_name: str, - test_migrate_cleanup_input: Union[_models.TestMigrateCleanupInput, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.MigrationItem]: - """Test migrate cleanup. - - The operation to initiate test migrate cleanup. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param migration_item_name: Migration item name. Required. - :type migration_item_name: str - :param test_migrate_cleanup_input: Test migrate cleanup input. Is either a - TestMigrateCleanupInput type or a IO[bytes] type. Required. - :type test_migrate_cleanup_input: - ~azure.mgmt.recoveryservicessiterecovery.models.TestMigrateCleanupInput or IO[bytes] - :return: An instance of AsyncLROPoller that returns either MigrationItem or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] - :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.MigrationItem] = 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._test_migrate_cleanup_initial( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - migration_item_name=migration_item_name, - test_migrate_cleanup_input=test_migrate_cleanup_input, - 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("MigrationItem", 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.MigrationItem].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.MigrationItem]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, - skip_token: Optional[str] = None, - take_token: Optional[str] = None, - filter: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterable["_models.MigrationItem"]: - """Gets the list of migration items in the vault. - - Gets the list of migration items in the vault. - - :param skip_token: The pagination token. Default value is None. - :type skip_token: str - :param take_token: The page size. Default value is None. - :type take_token: str - :param filter: OData filter options. Default value is None. - :type filter: str - :return: An iterator like instance of either MigrationItem or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] - :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.MigrationItemCollection] = 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_request( - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_name, - subscription_id=self._config.subscription_id, - skip_token=skip_token, - take_token=take_token, - filter=filter, - 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("MigrationItemCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_network_mappings_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_network_mappings_operations.py deleted file mode 100644 index 9a68bbf6c349..000000000000 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_network_mappings_operations.py +++ /dev/null @@ -1,836 +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, AsyncIterable, AsyncIterator, Callable, Dict, 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 ..._serialization import Deserializer, Serializer -from ...operations._replication_network_mappings_operations import ( - build_create_request, - build_delete_request, - build_get_request, - build_list_by_replication_networks_request, - build_list_request, - build_update_request, -) -from .._configuration import SiteRecoveryManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ReplicationNetworkMappingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicessiterecovery.aio.SiteRecoveryManagementClient`'s - :attr:`replication_network_mappings` 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: SiteRecoveryManagementClientConfiguration = ( - 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_replication_networks( - self, fabric_name: str, network_name: str, **kwargs: Any - ) -> AsyncIterable["_models.NetworkMapping"]: - """Gets all the network mappings under a network. - - Lists all ASR network mappings for the specified network. - - :param fabric_name: Primary fabric name. Required. - :type fabric_name: str - :param network_name: Primary network name. Required. - :type network_name: str - :return: An iterator like instance of either NetworkMapping or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.NetworkMapping] - :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.NetworkMappingCollection] = 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_replication_networks_request( - fabric_name=fabric_name, - network_name=network_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("NetworkMappingCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, fabric_name: str, network_name: str, network_mapping_name: str, **kwargs: Any - ) -> _models.NetworkMapping: - """Gets network mapping by name. - - Gets the details of an ASR network mapping. - - :param fabric_name: Primary fabric name. Required. - :type fabric_name: str - :param network_name: Primary network name. Required. - :type network_name: str - :param network_mapping_name: Network mapping name. Required. - :type network_mapping_name: str - :return: NetworkMapping or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.NetworkMapping - :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.NetworkMapping] = kwargs.pop("cls", None) - - _request = build_get_request( - fabric_name=fabric_name, - network_name=network_name, - network_mapping_name=network_mapping_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("NetworkMapping", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_initial( - self, - fabric_name: str, - network_name: str, - network_mapping_name: str, - input: Union[_models.CreateNetworkMappingInput, 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(input, (IOBase, bytes)): - _content = input - else: - _json = self._serialize.body(input, "CreateNetworkMappingInput") - - _request = build_create_request( - fabric_name=fabric_name, - network_name=network_name, - network_mapping_name=network_mapping_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create( - self, - fabric_name: str, - network_name: str, - network_mapping_name: str, - input: _models.CreateNetworkMappingInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.NetworkMapping]: - """Creates network mapping. - - The operation to create an ASR network mapping. - - :param fabric_name: Primary fabric name. Required. - :type fabric_name: str - :param network_name: Primary network name. Required. - :type network_name: str - :param network_mapping_name: Network mapping name. Required. - :type network_mapping_name: str - :param input: Create network mapping input. Required. - :type input: ~azure.mgmt.recoveryservicessiterecovery.models.CreateNetworkMappingInput - :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 NetworkMapping or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.NetworkMapping] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create( - self, - fabric_name: str, - network_name: str, - network_mapping_name: str, - input: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.NetworkMapping]: - """Creates network mapping. - - The operation to create an ASR network mapping. - - :param fabric_name: Primary fabric name. Required. - :type fabric_name: str - :param network_name: Primary network name. Required. - :type network_name: str - :param network_mapping_name: Network mapping name. Required. - :type network_mapping_name: str - :param input: Create network mapping input. Required. - :type input: 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 NetworkMapping or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.NetworkMapping] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create( - self, - fabric_name: str, - network_name: str, - network_mapping_name: str, - input: Union[_models.CreateNetworkMappingInput, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.NetworkMapping]: - """Creates network mapping. - - The operation to create an ASR network mapping. - - :param fabric_name: Primary fabric name. Required. - :type fabric_name: str - :param network_name: Primary network name. Required. - :type network_name: str - :param network_mapping_name: Network mapping name. Required. - :type network_mapping_name: str - :param input: Create network mapping input. Is either a CreateNetworkMappingInput type or a - IO[bytes] type. Required. - :type input: ~azure.mgmt.recoveryservicessiterecovery.models.CreateNetworkMappingInput or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either NetworkMapping or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.NetworkMapping] - :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.NetworkMapping] = 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( - fabric_name=fabric_name, - network_name=network_name, - network_mapping_name=network_mapping_name, - input=input, - 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("NetworkMapping", 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.NetworkMapping].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.NetworkMapping]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, fabric_name: str, network_name: str, network_mapping_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( - fabric_name=fabric_name, - network_name=network_name, - network_mapping_name=network_mapping_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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 [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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, fabric_name: str, network_name: str, network_mapping_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete network mapping. - - The operation to delete a network mapping. - - :param fabric_name: Primary fabric name. Required. - :type fabric_name: str - :param network_name: Primary network name. Required. - :type network_name: str - :param network_mapping_name: ARM Resource Name for network mapping. Required. - :type network_mapping_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( - fabric_name=fabric_name, - network_name=network_name, - network_mapping_name=network_mapping_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 - - async def _update_initial( - self, - fabric_name: str, - network_name: str, - network_mapping_name: str, - input: Union[_models.UpdateNetworkMappingInput, 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(input, (IOBase, bytes)): - _content = input - else: - _json = self._serialize.body(input, "UpdateNetworkMappingInput") - - _request = build_update_request( - fabric_name=fabric_name, - network_name=network_name, - network_mapping_name=network_mapping_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - fabric_name: str, - network_name: str, - network_mapping_name: str, - input: _models.UpdateNetworkMappingInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.NetworkMapping]: - """Updates network mapping. - - The operation to update an ASR network mapping. - - :param fabric_name: Primary fabric name. Required. - :type fabric_name: str - :param network_name: Primary network name. Required. - :type network_name: str - :param network_mapping_name: Network mapping name. Required. - :type network_mapping_name: str - :param input: Update network mapping input. Required. - :type input: ~azure.mgmt.recoveryservicessiterecovery.models.UpdateNetworkMappingInput - :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 NetworkMapping or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.NetworkMapping] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - fabric_name: str, - network_name: str, - network_mapping_name: str, - input: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.NetworkMapping]: - """Updates network mapping. - - The operation to update an ASR network mapping. - - :param fabric_name: Primary fabric name. Required. - :type fabric_name: str - :param network_name: Primary network name. Required. - :type network_name: str - :param network_mapping_name: Network mapping name. Required. - :type network_mapping_name: str - :param input: Update network mapping input. Required. - :type input: 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 NetworkMapping or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.NetworkMapping] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - fabric_name: str, - network_name: str, - network_mapping_name: str, - input: Union[_models.UpdateNetworkMappingInput, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.NetworkMapping]: - """Updates network mapping. - - The operation to update an ASR network mapping. - - :param fabric_name: Primary fabric name. Required. - :type fabric_name: str - :param network_name: Primary network name. Required. - :type network_name: str - :param network_mapping_name: Network mapping name. Required. - :type network_mapping_name: str - :param input: Update network mapping input. Is either a UpdateNetworkMappingInput type or a - IO[bytes] type. Required. - :type input: ~azure.mgmt.recoveryservicessiterecovery.models.UpdateNetworkMappingInput or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either NetworkMapping or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.NetworkMapping] - :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.NetworkMapping] = 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( - fabric_name=fabric_name, - network_name=network_name, - network_mapping_name=network_mapping_name, - input=input, - 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("NetworkMapping", 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.NetworkMapping].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.NetworkMapping]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.NetworkMapping"]: - """Gets all the network mappings under a vault. - - Lists all ASR network mappings in the vault. - - :return: An iterator like instance of either NetworkMapping or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.NetworkMapping] - :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.NetworkMappingCollection] = 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_request( - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("NetworkMappingCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_networks_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_networks_operations.py deleted file mode 100644 index e2219887b33a..000000000000 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_networks_operations.py +++ /dev/null @@ -1,280 +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, AsyncIterable, Callable, Dict, 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 ..._serialization import Deserializer, Serializer -from ...operations._replication_networks_operations import ( - build_get_request, - build_list_by_replication_fabrics_request, - build_list_request, -) -from .._configuration import SiteRecoveryManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ReplicationNetworksOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicessiterecovery.aio.SiteRecoveryManagementClient`'s - :attr:`replication_networks` 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: SiteRecoveryManagementClientConfiguration = ( - 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_replication_fabrics(self, fabric_name: str, **kwargs: Any) -> AsyncIterable["_models.Network"]: - """Gets the list of networks under a fabric. - - Lists the networks available for a fabric. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :return: An iterator like instance of either Network or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.Network] - :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.NetworkCollection] = 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_replication_fabrics_request( - fabric_name=fabric_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("NetworkCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get(self, fabric_name: str, network_name: str, **kwargs: Any) -> _models.Network: - """Gets a network with specified server id and network name. - - Gets the details of a network. - - :param fabric_name: Server Id. Required. - :type fabric_name: str - :param network_name: Primary network name. Required. - :type network_name: str - :return: Network or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.Network - :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.Network] = kwargs.pop("cls", None) - - _request = build_get_request( - fabric_name=fabric_name, - network_name=network_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("Network", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.Network"]: - """Gets the list of networks. View-only API. - - Lists the networks available in a vault. - - :return: An iterator like instance of either Network or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.Network] - :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.NetworkCollection] = 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_request( - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("NetworkCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_policies_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_policies_operations.py deleted file mode 100644 index b55e57d4be2b..000000000000 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_policies_operations.py +++ /dev/null @@ -1,656 +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, AsyncIterable, AsyncIterator, Callable, Dict, 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 ..._serialization import Deserializer, Serializer -from ...operations._replication_policies_operations import ( - build_create_request, - build_delete_request, - build_get_request, - build_list_request, - build_update_request, -) -from .._configuration import SiteRecoveryManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ReplicationPoliciesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicessiterecovery.aio.SiteRecoveryManagementClient`'s - :attr:`replication_policies` 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: SiteRecoveryManagementClientConfiguration = ( - 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) -> AsyncIterable["_models.Policy"]: - """Gets the list of replication policies. - - Lists the replication policies for a vault. - - :return: An iterator like instance of either Policy or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.Policy] - :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.PolicyCollection] = 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_request( - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("PolicyCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get(self, policy_name: str, **kwargs: Any) -> _models.Policy: - """Gets the requested policy. - - Gets the details of a replication policy. - - :param policy_name: Replication policy name. Required. - :type policy_name: str - :return: Policy or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.Policy - :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.Policy] = kwargs.pop("cls", None) - - _request = build_get_request( - policy_name=policy_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("Policy", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_initial( - self, policy_name: str, input: Union[_models.CreatePolicyInput, 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(input, (IOBase, bytes)): - _content = input - else: - _json = self._serialize.body(input, "CreatePolicyInput") - - _request = build_create_request( - policy_name=policy_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create( - self, - policy_name: str, - input: _models.CreatePolicyInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Policy]: - """Creates the policy. - - The operation to create a replication policy. - - :param policy_name: Replication policy name. Required. - :type policy_name: str - :param input: Create policy input. Required. - :type input: ~azure.mgmt.recoveryservicessiterecovery.models.CreatePolicyInput - :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 Policy or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Policy] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create( - self, policy_name: str, input: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.Policy]: - """Creates the policy. - - The operation to create a replication policy. - - :param policy_name: Replication policy name. Required. - :type policy_name: str - :param input: Create policy input. Required. - :type input: 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 Policy or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Policy] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create( - self, policy_name: str, input: Union[_models.CreatePolicyInput, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.Policy]: - """Creates the policy. - - The operation to create a replication policy. - - :param policy_name: Replication policy name. Required. - :type policy_name: str - :param input: Create policy input. Is either a CreatePolicyInput type or a IO[bytes] type. - Required. - :type input: ~azure.mgmt.recoveryservicessiterecovery.models.CreatePolicyInput or IO[bytes] - :return: An instance of AsyncLROPoller that returns either Policy or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Policy] - :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.Policy] = 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( - policy_name=policy_name, - input=input, - 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("Policy", 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.Policy].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.Policy]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial(self, policy_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( - policy_name=policy_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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 [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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete(self, policy_name: str, **kwargs: Any) -> AsyncLROPoller[None]: - """Delete the policy. - - The operation to delete a replication policy. - - :param policy_name: Replication policy name. Required. - :type policy_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( - policy_name=policy_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 - - async def _update_initial( - self, policy_name: str, input: Union[_models.UpdatePolicyInput, 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(input, (IOBase, bytes)): - _content = input - else: - _json = self._serialize.body(input, "UpdatePolicyInput") - - _request = build_update_request( - policy_name=policy_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - policy_name: str, - input: _models.UpdatePolicyInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Policy]: - """Updates the policy. - - The operation to update a replication policy. - - :param policy_name: Policy Id. Required. - :type policy_name: str - :param input: Update Policy Input. Required. - :type input: ~azure.mgmt.recoveryservicessiterecovery.models.UpdatePolicyInput - :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 Policy or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Policy] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, policy_name: str, input: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.Policy]: - """Updates the policy. - - The operation to update a replication policy. - - :param policy_name: Policy Id. Required. - :type policy_name: str - :param input: Update Policy Input. Required. - :type input: 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 Policy or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Policy] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, policy_name: str, input: Union[_models.UpdatePolicyInput, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.Policy]: - """Updates the policy. - - The operation to update a replication policy. - - :param policy_name: Policy Id. Required. - :type policy_name: str - :param input: Update Policy Input. Is either a UpdatePolicyInput type or a IO[bytes] type. - Required. - :type input: ~azure.mgmt.recoveryservicessiterecovery.models.UpdatePolicyInput or IO[bytes] - :return: An instance of AsyncLROPoller that returns either Policy or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Policy] - :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.Policy] = 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( - policy_name=policy_name, - input=input, - 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("Policy", 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.Policy].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.Policy]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_protectable_items_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_protectable_items_operations.py deleted file mode 100644 index da501dadb01d..000000000000 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_protectable_items_operations.py +++ /dev/null @@ -1,225 +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, AsyncIterable, Callable, Dict, 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 ..._serialization import Deserializer, Serializer -from ...operations._replication_protectable_items_operations import ( - build_get_request, - build_list_by_replication_protection_containers_request, -) -from .._configuration import SiteRecoveryManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ReplicationProtectableItemsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicessiterecovery.aio.SiteRecoveryManagementClient`'s - :attr:`replication_protectable_items` 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: SiteRecoveryManagementClientConfiguration = ( - 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_replication_protection_containers( # pylint: disable=name-too-long - self, - fabric_name: str, - protection_container_name: str, - filter: Optional[str] = None, - take: Optional[str] = None, - skip_token: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterable["_models.ProtectableItem"]: - """Gets the list of protectable items. - - Lists the protectable items in a protection container. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param filter: OData filter options. Default value is None. - :type filter: str - :param take: take OData query parameter. Default value is None. - :type take: str - :param skip_token: skipToken OData query parameter. Default value is None. - :type skip_token: str - :return: An iterator like instance of either ProtectableItem or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.ProtectableItem] - :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.ProtectableItemCollection] = 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_replication_protection_containers_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_name, - subscription_id=self._config.subscription_id, - filter=filter, - take=take, - skip_token=skip_token, - 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("ProtectableItemCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, fabric_name: str, protection_container_name: str, protectable_item_name: str, **kwargs: Any - ) -> _models.ProtectableItem: - """Gets the details of a protectable item. - - The operation to get the details of a protectable item. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param protectable_item_name: Protectable item name. Required. - :type protectable_item_name: str - :return: ProtectableItem or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.ProtectableItem - :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.ProtectableItem] = kwargs.pop("cls", None) - - _request = build_get_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - protectable_item_name=protectable_item_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("ProtectableItem", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_protected_items_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_protected_items_operations.py deleted file mode 100644 index be7196cd52c6..000000000000 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_protected_items_operations.py +++ /dev/null @@ -1,4010 +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, AsyncIterable, AsyncIterator, Callable, Dict, 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 ..._serialization import Deserializer, Serializer -from ...operations._replication_protected_items_operations import ( - build_add_disks_request, - build_apply_recovery_point_request, - build_create_request, - build_delete_request, - build_failover_cancel_request, - build_failover_commit_request, - build_get_request, - build_list_by_replication_protection_containers_request, - build_list_request, - build_planned_failover_request, - build_purge_request, - build_remove_disks_request, - build_repair_replication_request, - build_reprotect_request, - build_resolve_health_errors_request, - build_switch_provider_request, - build_test_failover_cleanup_request, - build_test_failover_request, - build_unplanned_failover_request, - build_update_appliance_request, - build_update_mobility_service_request, - build_update_request, -) -from .._configuration import SiteRecoveryManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ReplicationProtectedItemsOperations: # pylint: disable=too-many-public-methods - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicessiterecovery.aio.SiteRecoveryManagementClient`'s - :attr:`replication_protected_items` 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: SiteRecoveryManagementClientConfiguration = ( - 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_replication_protection_containers( # pylint: disable=name-too-long - self, fabric_name: str, protection_container_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ReplicationProtectedItem"]: - """Gets the list of Replication protected items. - - Gets the list of ASR replication protected items in the protection container. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :return: An iterator like instance of either ReplicationProtectedItem or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :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.ReplicationProtectedItemCollection] = 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_replication_protection_containers_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("ReplicationProtectedItemCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, fabric_name: str, protection_container_name: str, replicated_protected_item_name: str, **kwargs: Any - ) -> _models.ReplicationProtectedItem: - """Gets the details of a Replication protected item. - - Gets the details of an ASR replication protected item. - - :param fabric_name: Fabric unique name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. Required. - :type replicated_protected_item_name: str - :return: ReplicationProtectedItem or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem - :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.ReplicationProtectedItem] = kwargs.pop("cls", None) - - _request = build_get_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replicated_protected_item_name=replicated_protected_item_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("ReplicationProtectedItem", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_initial( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - input: Union[_models.EnableProtectionInput, 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(input, (IOBase, bytes)): - _content = input - else: - _json = self._serialize.body(input, "EnableProtectionInput") - - _request = build_create_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replicated_protected_item_name=replicated_protected_item_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - input: _models.EnableProtectionInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: - """Enables protection. - - The operation to create an ASR replication protected item (Enable replication). - - :param fabric_name: Name of the fabric. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: A name for the replication protected item. Required. - :type replicated_protected_item_name: str - :param input: Enable Protection Input. Required. - :type input: ~azure.mgmt.recoveryservicessiterecovery.models.EnableProtectionInput - :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 ReplicationProtectedItem or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - input: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: - """Enables protection. - - The operation to create an ASR replication protected item (Enable replication). - - :param fabric_name: Name of the fabric. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: A name for the replication protected item. Required. - :type replicated_protected_item_name: str - :param input: Enable Protection Input. Required. - :type input: 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 ReplicationProtectedItem or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - input: Union[_models.EnableProtectionInput, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: - """Enables protection. - - The operation to create an ASR replication protected item (Enable replication). - - :param fabric_name: Name of the fabric. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: A name for the replication protected item. Required. - :type replicated_protected_item_name: str - :param input: Enable Protection Input. Is either a EnableProtectionInput type or a IO[bytes] - type. Required. - :type input: ~azure.mgmt.recoveryservicessiterecovery.models.EnableProtectionInput or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ReplicationProtectedItem or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :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.ReplicationProtectedItem] = 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( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replicated_protected_item_name=replicated_protected_item_name, - input=input, - 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("ReplicationProtectedItem", 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.ReplicationProtectedItem].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ReplicationProtectedItem]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _purge_initial( - self, fabric_name: str, protection_container_name: str, replicated_protected_item_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_purge_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replicated_protected_item_name=replicated_protected_item_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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 [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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_purge( - self, fabric_name: str, protection_container_name: str, replicated_protected_item_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Purges protection. - - The operation to delete or purge a replication protected item. This operation will force delete - the replication protected item. Use the remove operation on replication protected item to - perform a clean disable replication for the item. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. Required. - :type replicated_protected_item_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._purge_initial( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replicated_protected_item_name=replicated_protected_item_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 - - async def _update_initial( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - update_protection_input: Union[_models.UpdateReplicationProtectedItemInput, 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(update_protection_input, (IOBase, bytes)): - _content = update_protection_input - else: - _json = self._serialize.body(update_protection_input, "UpdateReplicationProtectedItemInput") - - _request = build_update_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replicated_protected_item_name=replicated_protected_item_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - update_protection_input: _models.UpdateReplicationProtectedItemInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: - """Updates the replication protected item settings. - - The operation to update the recovery settings of an ASR replication protected item. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. Required. - :type replicated_protected_item_name: str - :param update_protection_input: Update protection input. Required. - :type update_protection_input: - ~azure.mgmt.recoveryservicessiterecovery.models.UpdateReplicationProtectedItemInput - :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 ReplicationProtectedItem or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - update_protection_input: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: - """Updates the replication protected item settings. - - The operation to update the recovery settings of an ASR replication protected item. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. Required. - :type replicated_protected_item_name: str - :param update_protection_input: Update protection input. Required. - :type update_protection_input: 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 ReplicationProtectedItem or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - update_protection_input: Union[_models.UpdateReplicationProtectedItemInput, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: - """Updates the replication protected item settings. - - The operation to update the recovery settings of an ASR replication protected item. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. Required. - :type replicated_protected_item_name: str - :param update_protection_input: Update protection input. Is either a - UpdateReplicationProtectedItemInput type or a IO[bytes] type. Required. - :type update_protection_input: - ~azure.mgmt.recoveryservicessiterecovery.models.UpdateReplicationProtectedItemInput or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either ReplicationProtectedItem or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :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.ReplicationProtectedItem] = 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( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replicated_protected_item_name=replicated_protected_item_name, - update_protection_input=update_protection_input, - 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("ReplicationProtectedItem", 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.ReplicationProtectedItem].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ReplicationProtectedItem]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _add_disks_initial( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - add_disks_input: Union[_models.AddDisksInput, 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(add_disks_input, (IOBase, bytes)): - _content = add_disks_input - else: - _json = self._serialize.body(add_disks_input, "AddDisksInput") - - _request = build_add_disks_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replicated_protected_item_name=replicated_protected_item_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_add_disks( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - add_disks_input: _models.AddDisksInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: - """Add disk(s) for protection. - - Operation to add disks(s) to the replication protected item. - - :param fabric_name: Unique fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. Required. - :type replicated_protected_item_name: str - :param add_disks_input: Add disks input. Required. - :type add_disks_input: ~azure.mgmt.recoveryservicessiterecovery.models.AddDisksInput - :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 ReplicationProtectedItem or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_add_disks( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - add_disks_input: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: - """Add disk(s) for protection. - - Operation to add disks(s) to the replication protected item. - - :param fabric_name: Unique fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. Required. - :type replicated_protected_item_name: str - :param add_disks_input: Add disks input. Required. - :type add_disks_input: 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 ReplicationProtectedItem or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_add_disks( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - add_disks_input: Union[_models.AddDisksInput, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: - """Add disk(s) for protection. - - Operation to add disks(s) to the replication protected item. - - :param fabric_name: Unique fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. Required. - :type replicated_protected_item_name: str - :param add_disks_input: Add disks input. Is either a AddDisksInput type or a IO[bytes] type. - Required. - :type add_disks_input: ~azure.mgmt.recoveryservicessiterecovery.models.AddDisksInput or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either ReplicationProtectedItem or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :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.ReplicationProtectedItem] = 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._add_disks_initial( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replicated_protected_item_name=replicated_protected_item_name, - add_disks_input=add_disks_input, - 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("ReplicationProtectedItem", 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.ReplicationProtectedItem].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ReplicationProtectedItem]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _apply_recovery_point_initial( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - apply_recovery_point_input: Union[_models.ApplyRecoveryPointInput, 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(apply_recovery_point_input, (IOBase, bytes)): - _content = apply_recovery_point_input - else: - _json = self._serialize.body(apply_recovery_point_input, "ApplyRecoveryPointInput") - - _request = build_apply_recovery_point_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replicated_protected_item_name=replicated_protected_item_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_apply_recovery_point( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - apply_recovery_point_input: _models.ApplyRecoveryPointInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: - """Change or apply recovery point. - - The operation to change the recovery point of a failed over replication protected item. - - :param fabric_name: The ARM fabric name. Required. - :type fabric_name: str - :param protection_container_name: The protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: The replicated protected item name. Required. - :type replicated_protected_item_name: str - :param apply_recovery_point_input: The ApplyRecoveryPointInput. Required. - :type apply_recovery_point_input: - ~azure.mgmt.recoveryservicessiterecovery.models.ApplyRecoveryPointInput - :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 ReplicationProtectedItem or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_apply_recovery_point( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - apply_recovery_point_input: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: - """Change or apply recovery point. - - The operation to change the recovery point of a failed over replication protected item. - - :param fabric_name: The ARM fabric name. Required. - :type fabric_name: str - :param protection_container_name: The protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: The replicated protected item name. Required. - :type replicated_protected_item_name: str - :param apply_recovery_point_input: The ApplyRecoveryPointInput. Required. - :type apply_recovery_point_input: 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 ReplicationProtectedItem or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_apply_recovery_point( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - apply_recovery_point_input: Union[_models.ApplyRecoveryPointInput, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: - """Change or apply recovery point. - - The operation to change the recovery point of a failed over replication protected item. - - :param fabric_name: The ARM fabric name. Required. - :type fabric_name: str - :param protection_container_name: The protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: The replicated protected item name. Required. - :type replicated_protected_item_name: str - :param apply_recovery_point_input: The ApplyRecoveryPointInput. Is either a - ApplyRecoveryPointInput type or a IO[bytes] type. Required. - :type apply_recovery_point_input: - ~azure.mgmt.recoveryservicessiterecovery.models.ApplyRecoveryPointInput or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ReplicationProtectedItem or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :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.ReplicationProtectedItem] = 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._apply_recovery_point_initial( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replicated_protected_item_name=replicated_protected_item_name, - apply_recovery_point_input=apply_recovery_point_input, - 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("ReplicationProtectedItem", 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.ReplicationProtectedItem].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ReplicationProtectedItem]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _failover_cancel_initial( - self, fabric_name: str, protection_container_name: str, replicated_protected_item_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_failover_cancel_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replicated_protected_item_name=replicated_protected_item_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_failover_cancel( - self, fabric_name: str, protection_container_name: str, replicated_protected_item_name: str, **kwargs: Any - ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: - """Execute cancel failover. - - Operation to cancel the failover of the replication protected item. - - :param fabric_name: Unique fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. Required. - :type replicated_protected_item_name: str - :return: An instance of AsyncLROPoller that returns either ReplicationProtectedItem or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :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.ReplicationProtectedItem] = 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._failover_cancel_initial( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replicated_protected_item_name=replicated_protected_item_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): - deserialized = self._deserialize("ReplicationProtectedItem", 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.ReplicationProtectedItem].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ReplicationProtectedItem]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _failover_commit_initial( - self, fabric_name: str, protection_container_name: str, replicated_protected_item_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_failover_commit_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replicated_protected_item_name=replicated_protected_item_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_failover_commit( - self, fabric_name: str, protection_container_name: str, replicated_protected_item_name: str, **kwargs: Any - ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: - """Execute commit failover. - - Operation to commit the failover of the replication protected item. - - :param fabric_name: Unique fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. Required. - :type replicated_protected_item_name: str - :return: An instance of AsyncLROPoller that returns either ReplicationProtectedItem or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :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.ReplicationProtectedItem] = 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._failover_commit_initial( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replicated_protected_item_name=replicated_protected_item_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): - deserialized = self._deserialize("ReplicationProtectedItem", 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.ReplicationProtectedItem].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ReplicationProtectedItem]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _planned_failover_initial( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - failover_input: Union[_models.PlannedFailoverInput, 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(failover_input, (IOBase, bytes)): - _content = failover_input - else: - _json = self._serialize.body(failover_input, "PlannedFailoverInput") - - _request = build_planned_failover_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replicated_protected_item_name=replicated_protected_item_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_planned_failover( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - failover_input: _models.PlannedFailoverInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: - """Execute planned failover. - - Operation to initiate a planned failover of the replication protected item. - - :param fabric_name: Unique fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. Required. - :type replicated_protected_item_name: str - :param failover_input: Planned failover input. Required. - :type failover_input: ~azure.mgmt.recoveryservicessiterecovery.models.PlannedFailoverInput - :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 ReplicationProtectedItem or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_planned_failover( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - failover_input: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: - """Execute planned failover. - - Operation to initiate a planned failover of the replication protected item. - - :param fabric_name: Unique fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. Required. - :type replicated_protected_item_name: str - :param failover_input: Planned failover input. Required. - :type failover_input: 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 ReplicationProtectedItem or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_planned_failover( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - failover_input: Union[_models.PlannedFailoverInput, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: - """Execute planned failover. - - Operation to initiate a planned failover of the replication protected item. - - :param fabric_name: Unique fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. Required. - :type replicated_protected_item_name: str - :param failover_input: Planned failover input. Is either a PlannedFailoverInput type or a - IO[bytes] type. Required. - :type failover_input: ~azure.mgmt.recoveryservicessiterecovery.models.PlannedFailoverInput or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either ReplicationProtectedItem or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :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.ReplicationProtectedItem] = 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._planned_failover_initial( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replicated_protected_item_name=replicated_protected_item_name, - failover_input=failover_input, - 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("ReplicationProtectedItem", 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.ReplicationProtectedItem].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ReplicationProtectedItem]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - disable_protection_input: Union[_models.DisableProtectionInput, 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(disable_protection_input, (IOBase, bytes)): - _content = disable_protection_input - else: - _json = self._serialize.body(disable_protection_input, "DisableProtectionInput") - - _request = build_delete_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replicated_protected_item_name=replicated_protected_item_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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 [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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_delete( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - disable_protection_input: _models.DisableProtectionInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Disables protection. - - The operation to disable replication on a replication protected item. This will also remove the - item. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. Required. - :type replicated_protected_item_name: str - :param disable_protection_input: Disable protection input. Required. - :type disable_protection_input: - ~azure.mgmt.recoveryservicessiterecovery.models.DisableProtectionInput - :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_delete( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - disable_protection_input: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Disables protection. - - The operation to disable replication on a replication protected item. This will also remove the - item. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. Required. - :type replicated_protected_item_name: str - :param disable_protection_input: Disable protection input. Required. - :type disable_protection_input: 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_delete( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - disable_protection_input: Union[_models.DisableProtectionInput, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Disables protection. - - The operation to disable replication on a replication protected item. This will also remove the - item. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. Required. - :type replicated_protected_item_name: str - :param disable_protection_input: Disable protection input. Is either a DisableProtectionInput - type or a IO[bytes] type. Required. - :type disable_protection_input: - ~azure.mgmt.recoveryservicessiterecovery.models.DisableProtectionInput 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._delete_initial( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replicated_protected_item_name=replicated_protected_item_name, - disable_protection_input=disable_protection_input, - 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 _remove_disks_initial( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - remove_disks_input: Union[_models.RemoveDisksInput, 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(remove_disks_input, (IOBase, bytes)): - _content = remove_disks_input - else: - _json = self._serialize.body(remove_disks_input, "RemoveDisksInput") - - _request = build_remove_disks_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replicated_protected_item_name=replicated_protected_item_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_remove_disks( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - remove_disks_input: _models.RemoveDisksInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: - """Removes disk(s). - - Operation to remove disk(s) from the replication protected item. - - :param fabric_name: Unique fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. Required. - :type replicated_protected_item_name: str - :param remove_disks_input: Remove disks input. Required. - :type remove_disks_input: ~azure.mgmt.recoveryservicessiterecovery.models.RemoveDisksInput - :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 ReplicationProtectedItem or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_remove_disks( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - remove_disks_input: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: - """Removes disk(s). - - Operation to remove disk(s) from the replication protected item. - - :param fabric_name: Unique fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. Required. - :type replicated_protected_item_name: str - :param remove_disks_input: Remove disks input. Required. - :type remove_disks_input: 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 ReplicationProtectedItem or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_remove_disks( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - remove_disks_input: Union[_models.RemoveDisksInput, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: - """Removes disk(s). - - Operation to remove disk(s) from the replication protected item. - - :param fabric_name: Unique fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. Required. - :type replicated_protected_item_name: str - :param remove_disks_input: Remove disks input. Is either a RemoveDisksInput type or a IO[bytes] - type. Required. - :type remove_disks_input: ~azure.mgmt.recoveryservicessiterecovery.models.RemoveDisksInput or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either ReplicationProtectedItem or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :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.ReplicationProtectedItem] = 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._remove_disks_initial( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replicated_protected_item_name=replicated_protected_item_name, - remove_disks_input=remove_disks_input, - 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("ReplicationProtectedItem", 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.ReplicationProtectedItem].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ReplicationProtectedItem]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _repair_replication_initial( - self, fabric_name: str, protection_container_name: str, replicated_protected_item_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_repair_replication_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replicated_protected_item_name=replicated_protected_item_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_repair_replication( - self, fabric_name: str, protection_container_name: str, replicated_protected_item_name: str, **kwargs: Any - ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: - """Resynchronize or repair replication. - - The operation to start resynchronize/repair replication for a replication protected item - requiring resynchronization. - - :param fabric_name: The name of the fabric. Required. - :type fabric_name: str - :param protection_container_name: The name of the container. Required. - :type protection_container_name: str - :param replicated_protected_item_name: The name of the replication protected item. Required. - :type replicated_protected_item_name: str - :return: An instance of AsyncLROPoller that returns either ReplicationProtectedItem or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :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.ReplicationProtectedItem] = 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._repair_replication_initial( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replicated_protected_item_name=replicated_protected_item_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): - deserialized = self._deserialize("ReplicationProtectedItem", 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.ReplicationProtectedItem].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ReplicationProtectedItem]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _reprotect_initial( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - reprotect_input: Union[_models.ReverseReplicationInput, 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(reprotect_input, (IOBase, bytes)): - _content = reprotect_input - else: - _json = self._serialize.body(reprotect_input, "ReverseReplicationInput") - - _request = build_reprotect_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replicated_protected_item_name=replicated_protected_item_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_reprotect( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - reprotect_input: _models.ReverseReplicationInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: - """Execute Reverse Replication\\Reprotect. - - Operation to reprotect or reverse replicate a failed over replication protected item. - - :param fabric_name: Unique fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. Required. - :type replicated_protected_item_name: str - :param reprotect_input: Reverse replication input. Required. - :type reprotect_input: ~azure.mgmt.recoveryservicessiterecovery.models.ReverseReplicationInput - :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 ReplicationProtectedItem or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_reprotect( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - reprotect_input: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: - """Execute Reverse Replication\\Reprotect. - - Operation to reprotect or reverse replicate a failed over replication protected item. - - :param fabric_name: Unique fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. Required. - :type replicated_protected_item_name: str - :param reprotect_input: Reverse replication input. Required. - :type reprotect_input: 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 ReplicationProtectedItem or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_reprotect( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - reprotect_input: Union[_models.ReverseReplicationInput, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: - """Execute Reverse Replication\\Reprotect. - - Operation to reprotect or reverse replicate a failed over replication protected item. - - :param fabric_name: Unique fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. Required. - :type replicated_protected_item_name: str - :param reprotect_input: Reverse replication input. Is either a ReverseReplicationInput type or - a IO[bytes] type. Required. - :type reprotect_input: ~azure.mgmt.recoveryservicessiterecovery.models.ReverseReplicationInput - or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ReplicationProtectedItem or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :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.ReplicationProtectedItem] = 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._reprotect_initial( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replicated_protected_item_name=replicated_protected_item_name, - reprotect_input=reprotect_input, - 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("ReplicationProtectedItem", 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.ReplicationProtectedItem].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ReplicationProtectedItem]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _resolve_health_errors_initial( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - resolve_health_input: Union[_models.ResolveHealthInput, 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(resolve_health_input, (IOBase, bytes)): - _content = resolve_health_input - else: - _json = self._serialize.body(resolve_health_input, "ResolveHealthInput") - - _request = build_resolve_health_errors_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replicated_protected_item_name=replicated_protected_item_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_resolve_health_errors( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - resolve_health_input: _models.ResolveHealthInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: - """Resolve health errors. - - Operation to resolve health issues of the replication protected item. - - :param fabric_name: Unique fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. Required. - :type replicated_protected_item_name: str - :param resolve_health_input: Health issue input object. Required. - :type resolve_health_input: ~azure.mgmt.recoveryservicessiterecovery.models.ResolveHealthInput - :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 ReplicationProtectedItem or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_resolve_health_errors( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - resolve_health_input: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: - """Resolve health errors. - - Operation to resolve health issues of the replication protected item. - - :param fabric_name: Unique fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. Required. - :type replicated_protected_item_name: str - :param resolve_health_input: Health issue input object. Required. - :type resolve_health_input: 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 ReplicationProtectedItem or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_resolve_health_errors( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - resolve_health_input: Union[_models.ResolveHealthInput, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: - """Resolve health errors. - - Operation to resolve health issues of the replication protected item. - - :param fabric_name: Unique fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. Required. - :type replicated_protected_item_name: str - :param resolve_health_input: Health issue input object. Is either a ResolveHealthInput type or - a IO[bytes] type. Required. - :type resolve_health_input: ~azure.mgmt.recoveryservicessiterecovery.models.ResolveHealthInput - or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ReplicationProtectedItem or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :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.ReplicationProtectedItem] = 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._resolve_health_errors_initial( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replicated_protected_item_name=replicated_protected_item_name, - resolve_health_input=resolve_health_input, - 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("ReplicationProtectedItem", 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.ReplicationProtectedItem].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ReplicationProtectedItem]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _switch_provider_initial( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - switch_provider_input: Union[_models.SwitchProviderInput, 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(switch_provider_input, (IOBase, bytes)): - _content = switch_provider_input - else: - _json = self._serialize.body(switch_provider_input, "SwitchProviderInput") - - _request = build_switch_provider_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replicated_protected_item_name=replicated_protected_item_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_switch_provider( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - switch_provider_input: _models.SwitchProviderInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: - """Execute switch provider. - - Operation to initiate a switch provider of the replication protected item. - - :param fabric_name: Unique fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. Required. - :type replicated_protected_item_name: str - :param switch_provider_input: Switch provider input. Required. - :type switch_provider_input: - ~azure.mgmt.recoveryservicessiterecovery.models.SwitchProviderInput - :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 ReplicationProtectedItem or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_switch_provider( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - switch_provider_input: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: - """Execute switch provider. - - Operation to initiate a switch provider of the replication protected item. - - :param fabric_name: Unique fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. Required. - :type replicated_protected_item_name: str - :param switch_provider_input: Switch provider input. Required. - :type switch_provider_input: 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 ReplicationProtectedItem or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_switch_provider( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - switch_provider_input: Union[_models.SwitchProviderInput, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: - """Execute switch provider. - - Operation to initiate a switch provider of the replication protected item. - - :param fabric_name: Unique fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. Required. - :type replicated_protected_item_name: str - :param switch_provider_input: Switch provider input. Is either a SwitchProviderInput type or a - IO[bytes] type. Required. - :type switch_provider_input: - ~azure.mgmt.recoveryservicessiterecovery.models.SwitchProviderInput or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ReplicationProtectedItem or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :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.ReplicationProtectedItem] = 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._switch_provider_initial( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replicated_protected_item_name=replicated_protected_item_name, - switch_provider_input=switch_provider_input, - 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("ReplicationProtectedItem", 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, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ReplicationProtectedItem].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ReplicationProtectedItem]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _test_failover_initial( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - testfailover_input: Union[_models.TestFailoverInput, 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(testfailover_input, (IOBase, bytes)): - _content = testfailover_input - else: - _json = self._serialize.body(testfailover_input, "TestFailoverInput") - - _request = build_test_failover_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replicated_protected_item_name=replicated_protected_item_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_test_failover( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - testfailover_input: _models.TestFailoverInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: - """Execute test failover. - - Operation to perform a test failover of the replication protected item. - - :param fabric_name: Unique fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. Required. - :type replicated_protected_item_name: str - :param testfailover_input: Test failover input. Required. - :type testfailover_input: ~azure.mgmt.recoveryservicessiterecovery.models.TestFailoverInput - :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 ReplicationProtectedItem or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_test_failover( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - testfailover_input: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: - """Execute test failover. - - Operation to perform a test failover of the replication protected item. - - :param fabric_name: Unique fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. Required. - :type replicated_protected_item_name: str - :param testfailover_input: Test failover input. Required. - :type testfailover_input: 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 ReplicationProtectedItem or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_test_failover( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - testfailover_input: Union[_models.TestFailoverInput, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: - """Execute test failover. - - Operation to perform a test failover of the replication protected item. - - :param fabric_name: Unique fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. Required. - :type replicated_protected_item_name: str - :param testfailover_input: Test failover input. Is either a TestFailoverInput type or a - IO[bytes] type. Required. - :type testfailover_input: ~azure.mgmt.recoveryservicessiterecovery.models.TestFailoverInput or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either ReplicationProtectedItem or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :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.ReplicationProtectedItem] = 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._test_failover_initial( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replicated_protected_item_name=replicated_protected_item_name, - testfailover_input=testfailover_input, - 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("ReplicationProtectedItem", 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.ReplicationProtectedItem].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ReplicationProtectedItem]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _test_failover_cleanup_initial( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - cleanup_input: Union[_models.TestFailoverCleanupInput, 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(cleanup_input, (IOBase, bytes)): - _content = cleanup_input - else: - _json = self._serialize.body(cleanup_input, "TestFailoverCleanupInput") - - _request = build_test_failover_cleanup_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replicated_protected_item_name=replicated_protected_item_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_test_failover_cleanup( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - cleanup_input: _models.TestFailoverCleanupInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: - """Execute test failover cleanup. - - Operation to clean up the test failover of a replication protected item. - - :param fabric_name: Unique fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. Required. - :type replicated_protected_item_name: str - :param cleanup_input: Test failover cleanup input. Required. - :type cleanup_input: ~azure.mgmt.recoveryservicessiterecovery.models.TestFailoverCleanupInput - :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 ReplicationProtectedItem or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_test_failover_cleanup( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - cleanup_input: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: - """Execute test failover cleanup. - - Operation to clean up the test failover of a replication protected item. - - :param fabric_name: Unique fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. Required. - :type replicated_protected_item_name: str - :param cleanup_input: Test failover cleanup input. Required. - :type cleanup_input: 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 ReplicationProtectedItem or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_test_failover_cleanup( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - cleanup_input: Union[_models.TestFailoverCleanupInput, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: - """Execute test failover cleanup. - - Operation to clean up the test failover of a replication protected item. - - :param fabric_name: Unique fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. Required. - :type replicated_protected_item_name: str - :param cleanup_input: Test failover cleanup input. Is either a TestFailoverCleanupInput type or - a IO[bytes] type. Required. - :type cleanup_input: ~azure.mgmt.recoveryservicessiterecovery.models.TestFailoverCleanupInput - or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ReplicationProtectedItem or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :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.ReplicationProtectedItem] = 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._test_failover_cleanup_initial( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replicated_protected_item_name=replicated_protected_item_name, - cleanup_input=cleanup_input, - 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("ReplicationProtectedItem", 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.ReplicationProtectedItem].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ReplicationProtectedItem]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _unplanned_failover_initial( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - failover_input: Union[_models.UnplannedFailoverInput, 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(failover_input, (IOBase, bytes)): - _content = failover_input - else: - _json = self._serialize.body(failover_input, "UnplannedFailoverInput") - - _request = build_unplanned_failover_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replicated_protected_item_name=replicated_protected_item_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_unplanned_failover( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - failover_input: _models.UnplannedFailoverInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: - """Execute unplanned failover. - - Operation to initiate a failover of the replication protected item. - - :param fabric_name: Unique fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. Required. - :type replicated_protected_item_name: str - :param failover_input: Failover input. Required. - :type failover_input: ~azure.mgmt.recoveryservicessiterecovery.models.UnplannedFailoverInput - :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 ReplicationProtectedItem or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_unplanned_failover( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - failover_input: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: - """Execute unplanned failover. - - Operation to initiate a failover of the replication protected item. - - :param fabric_name: Unique fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. Required. - :type replicated_protected_item_name: str - :param failover_input: Failover input. Required. - :type failover_input: 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 ReplicationProtectedItem or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_unplanned_failover( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - failover_input: Union[_models.UnplannedFailoverInput, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: - """Execute unplanned failover. - - Operation to initiate a failover of the replication protected item. - - :param fabric_name: Unique fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. Required. - :type replicated_protected_item_name: str - :param failover_input: Failover input. Is either a UnplannedFailoverInput type or a IO[bytes] - type. Required. - :type failover_input: ~azure.mgmt.recoveryservicessiterecovery.models.UnplannedFailoverInput or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either ReplicationProtectedItem or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :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.ReplicationProtectedItem] = 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._unplanned_failover_initial( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replicated_protected_item_name=replicated_protected_item_name, - failover_input=failover_input, - 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("ReplicationProtectedItem", 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.ReplicationProtectedItem].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ReplicationProtectedItem]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_appliance_initial( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - appliance_update_input: Union[_models.UpdateApplianceForReplicationProtectedItemInput, 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(appliance_update_input, (IOBase, bytes)): - _content = appliance_update_input - else: - _json = self._serialize.body(appliance_update_input, "UpdateApplianceForReplicationProtectedItemInput") - - _request = build_update_appliance_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replicated_protected_item_name=replicated_protected_item_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update_appliance( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - appliance_update_input: _models.UpdateApplianceForReplicationProtectedItemInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: - """Updates appliance for replication protected Item. - - The operation to update appliance of an ASR replication protected item. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. Required. - :type replicated_protected_item_name: str - :param appliance_update_input: Appliance update protection input. Required. - :type appliance_update_input: - ~azure.mgmt.recoveryservicessiterecovery.models.UpdateApplianceForReplicationProtectedItemInput - :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 ReplicationProtectedItem or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_appliance( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - appliance_update_input: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: - """Updates appliance for replication protected Item. - - The operation to update appliance of an ASR replication protected item. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. Required. - :type replicated_protected_item_name: str - :param appliance_update_input: Appliance update protection input. Required. - :type appliance_update_input: 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 ReplicationProtectedItem or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_appliance( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - appliance_update_input: Union[_models.UpdateApplianceForReplicationProtectedItemInput, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: - """Updates appliance for replication protected Item. - - The operation to update appliance of an ASR replication protected item. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. Required. - :type replicated_protected_item_name: str - :param appliance_update_input: Appliance update protection input. Is either a - UpdateApplianceForReplicationProtectedItemInput type or a IO[bytes] type. Required. - :type appliance_update_input: - ~azure.mgmt.recoveryservicessiterecovery.models.UpdateApplianceForReplicationProtectedItemInput - or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ReplicationProtectedItem or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :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.ReplicationProtectedItem] = 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_appliance_initial( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replicated_protected_item_name=replicated_protected_item_name, - appliance_update_input=appliance_update_input, - 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("ReplicationProtectedItem", 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.ReplicationProtectedItem].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ReplicationProtectedItem]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_mobility_service_initial( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - update_mobility_service_request: Union[_models.UpdateMobilityServiceRequest, 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(update_mobility_service_request, (IOBase, bytes)): - _content = update_mobility_service_request - else: - _json = self._serialize.body(update_mobility_service_request, "UpdateMobilityServiceRequest") - - _request = build_update_mobility_service_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replicated_protected_item_name=replicated_protected_item_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - 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_mobility_service( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - update_mobility_service_request: _models.UpdateMobilityServiceRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: - """Update the mobility service on a protected item. - - The operation to update(push update) the installed mobility service software on a replication - protected item to the latest available version. - - :param fabric_name: The name of the fabric containing the protected item. Required. - :type fabric_name: str - :param protection_container_name: The name of the container containing the protected item. - Required. - :type protection_container_name: str - :param replicated_protected_item_name: The name of the protected item on which the agent is to - be updated. Required. - :type replicated_protected_item_name: str - :param update_mobility_service_request: Request to update the mobility service on the protected - item. Required. - :type update_mobility_service_request: - ~azure.mgmt.recoveryservicessiterecovery.models.UpdateMobilityServiceRequest - :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 ReplicationProtectedItem or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_mobility_service( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - update_mobility_service_request: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: - """Update the mobility service on a protected item. - - The operation to update(push update) the installed mobility service software on a replication - protected item to the latest available version. - - :param fabric_name: The name of the fabric containing the protected item. Required. - :type fabric_name: str - :param protection_container_name: The name of the container containing the protected item. - Required. - :type protection_container_name: str - :param replicated_protected_item_name: The name of the protected item on which the agent is to - be updated. Required. - :type replicated_protected_item_name: str - :param update_mobility_service_request: Request to update the mobility service on the protected - item. Required. - :type update_mobility_service_request: 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 ReplicationProtectedItem or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_mobility_service( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - update_mobility_service_request: Union[_models.UpdateMobilityServiceRequest, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.ReplicationProtectedItem]: - """Update the mobility service on a protected item. - - The operation to update(push update) the installed mobility service software on a replication - protected item to the latest available version. - - :param fabric_name: The name of the fabric containing the protected item. Required. - :type fabric_name: str - :param protection_container_name: The name of the container containing the protected item. - Required. - :type protection_container_name: str - :param replicated_protected_item_name: The name of the protected item on which the agent is to - be updated. Required. - :type replicated_protected_item_name: str - :param update_mobility_service_request: Request to update the mobility service on the protected - item. Is either a UpdateMobilityServiceRequest type or a IO[bytes] type. Required. - :type update_mobility_service_request: - ~azure.mgmt.recoveryservicessiterecovery.models.UpdateMobilityServiceRequest or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ReplicationProtectedItem or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :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.ReplicationProtectedItem] = 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_mobility_service_initial( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replicated_protected_item_name=replicated_protected_item_name, - update_mobility_service_request=update_mobility_service_request, - 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("ReplicationProtectedItem", 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, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ReplicationProtectedItem].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ReplicationProtectedItem]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, skip_token: Optional[str] = None, filter: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.ReplicationProtectedItem"]: - """Gets the list of replication protected items. - - Gets the list of ASR replication protected items in the vault. - - :param skip_token: The pagination token. Possible values: "FabricId" or "FabricId_CloudId" or - null. Default value is None. - :type skip_token: str - :param filter: OData filter options. Default value is None. - :type filter: str - :return: An iterator like instance of either ReplicationProtectedItem or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :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.ReplicationProtectedItemCollection] = 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_request( - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_name, - subscription_id=self._config.subscription_id, - skip_token=skip_token, - filter=filter, - 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("ReplicationProtectedItemCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_protection_clusters_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_protection_clusters_operations.py deleted file mode 100644 index 9a17a4728795..000000000000 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_protection_clusters_operations.py +++ /dev/null @@ -1,1980 +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, AsyncIterable, AsyncIterator, Callable, Dict, 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 ..._serialization import Deserializer, Serializer -from ...operations._replication_protection_clusters_operations import ( - build_apply_recovery_point_request, - build_create_request, - build_failover_commit_request, - build_get_operation_results_request, - build_get_request, - build_list_by_replication_protection_containers_request, - build_list_request, - build_purge_request, - build_repair_replication_request, - build_test_failover_cleanup_request, - build_test_failover_request, - build_unplanned_failover_request, -) -from .._configuration import SiteRecoveryManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ReplicationProtectionClustersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicessiterecovery.aio.SiteRecoveryManagementClient`'s - :attr:`replication_protection_clusters` 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: SiteRecoveryManagementClientConfiguration = ( - 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_replication_protection_containers( # pylint: disable=name-too-long - self, resource_name: str, fabric_name: str, protection_container_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ReplicationProtectionCluster"]: - """Gets the list of Replication protection clusters in fabric, container. - - Gets the list of ASR replication protected clusters in the protection container. - - :param resource_name: The name of the recovery services vault. Required. - :type resource_name: str - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :return: An iterator like instance of either ReplicationProtectionCluster or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster] - :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.ReplicationProtectionClusterCollection] = 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_replication_protection_containers_request( - resource_name=resource_name, - fabric_name=fabric_name, - protection_container_name=protection_container_name, - resource_group_name=self._config.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("ReplicationProtectionClusterCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link 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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, 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_name: str, - fabric_name: str, - protection_container_name: str, - replication_protection_cluster_name: str, - **kwargs: Any - ) -> _models.ReplicationProtectionCluster: - """Gets the details of a Replication protection cluster. - - Gets the details of an ASR replication protection cluster. - - :param resource_name: The name of the recovery services vault. Required. - :type resource_name: str - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replication_protection_cluster_name: Replication protection cluster name. Required. - :type replication_protection_cluster_name: str - :return: ReplicationProtectionCluster or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster - :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.ReplicationProtectionCluster] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_name=resource_name, - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replication_protection_cluster_name=replication_protection_cluster_name, - resource_group_name=self._config.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) - - _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.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ReplicationProtectionCluster", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_initial( - self, - fabric_name: str, - protection_container_name: str, - replication_protection_cluster_name: str, - replication_protection_cluster: Union[_models.ReplicationProtectionCluster, 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(replication_protection_cluster, (IOBase, bytes)): - _content = replication_protection_cluster - else: - _json = self._serialize.body(replication_protection_cluster, "ReplicationProtectionCluster") - - _request = build_create_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replication_protection_cluster_name=replication_protection_cluster_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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.ErrorResponse, 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["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("str", response.headers.get("Retry-After")) - - 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, - fabric_name: str, - protection_container_name: str, - replication_protection_cluster_name: str, - replication_protection_cluster: _models.ReplicationProtectionCluster, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ReplicationProtectionCluster]: - """Create Replication protection Cluster. - - The operation to create an ASR replication protection cluster item. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replication_protection_cluster_name: Replication protection cluster name. Required. - :type replication_protection_cluster_name: str - :param replication_protection_cluster: Create replication protection cluster Input. Required. - :type replication_protection_cluster: - ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster - :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 ReplicationProtectionCluster or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create( - self, - fabric_name: str, - protection_container_name: str, - replication_protection_cluster_name: str, - replication_protection_cluster: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ReplicationProtectionCluster]: - """Create Replication protection Cluster. - - The operation to create an ASR replication protection cluster item. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replication_protection_cluster_name: Replication protection cluster name. Required. - :type replication_protection_cluster_name: str - :param replication_protection_cluster: Create replication protection cluster Input. Required. - :type replication_protection_cluster: 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 ReplicationProtectionCluster or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create( - self, - fabric_name: str, - protection_container_name: str, - replication_protection_cluster_name: str, - replication_protection_cluster: Union[_models.ReplicationProtectionCluster, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.ReplicationProtectionCluster]: - """Create Replication protection Cluster. - - The operation to create an ASR replication protection cluster item. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replication_protection_cluster_name: Replication protection cluster name. Required. - :type replication_protection_cluster_name: str - :param replication_protection_cluster: Create replication protection cluster Input. Is either a - ReplicationProtectionCluster type or a IO[bytes] type. Required. - :type replication_protection_cluster: - ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ReplicationProtectionCluster or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster] - :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.ReplicationProtectionCluster] = 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( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replication_protection_cluster_name=replication_protection_cluster_name, - replication_protection_cluster=replication_protection_cluster, - 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("ReplicationProtectionCluster", 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.ReplicationProtectionCluster].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ReplicationProtectionCluster]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _purge_initial( - self, fabric_name: str, protection_container_name: str, replication_protection_cluster_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_purge_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replication_protection_cluster_name=replication_protection_cluster_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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 [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.ErrorResponse, 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["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("str", response.headers.get("Retry-After")) - - 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_purge( - self, fabric_name: str, protection_container_name: str, replication_protection_cluster_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Purge the replication protection cluster. - - The operation to purge the replication protection cluster. This operation will force delete the - replication protection cluster. Use the remove operation on replication protection cluster to - perform a clean disable replication protection cluster. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replication_protection_cluster_name: Replication protection cluster name. Required. - :type replication_protection_cluster_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._purge_initial( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replication_protection_cluster_name=replication_protection_cluster_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, lro_options={"final-state-via": "location"}, **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 _apply_recovery_point_initial( - self, - resource_name: str, - fabric_name: str, - protection_container_name: str, - replication_protection_cluster_name: str, - apply_cluster_recovery_point_input: Union[_models.ApplyClusterRecoveryPointInput, 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(apply_cluster_recovery_point_input, (IOBase, bytes)): - _content = apply_cluster_recovery_point_input - else: - _json = self._serialize.body(apply_cluster_recovery_point_input, "ApplyClusterRecoveryPointInput") - - _request = build_apply_recovery_point_request( - resource_name=resource_name, - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replication_protection_cluster_name=replication_protection_cluster_name, - resource_group_name=self._config.resource_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) - - _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.ErrorResponse, 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["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("str", response.headers.get("Retry-After")) - - 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_apply_recovery_point( - self, - resource_name: str, - fabric_name: str, - protection_container_name: str, - replication_protection_cluster_name: str, - apply_cluster_recovery_point_input: _models.ApplyClusterRecoveryPointInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ReplicationProtectionCluster]: - """Execute the change recovery point operation for cluster. - - Operation to apply a new cluster recovery point on the Protection cluster. - - :param resource_name: The name of the recovery services vault. Required. - :type resource_name: str - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replication_protection_cluster_name: Replication protection cluster name. Required. - :type replication_protection_cluster_name: str - :param apply_cluster_recovery_point_input: Apply recovery point input. Required. - :type apply_cluster_recovery_point_input: - ~azure.mgmt.recoveryservicessiterecovery.models.ApplyClusterRecoveryPointInput - :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 ReplicationProtectionCluster or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_apply_recovery_point( - self, - resource_name: str, - fabric_name: str, - protection_container_name: str, - replication_protection_cluster_name: str, - apply_cluster_recovery_point_input: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ReplicationProtectionCluster]: - """Execute the change recovery point operation for cluster. - - Operation to apply a new cluster recovery point on the Protection cluster. - - :param resource_name: The name of the recovery services vault. Required. - :type resource_name: str - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replication_protection_cluster_name: Replication protection cluster name. Required. - :type replication_protection_cluster_name: str - :param apply_cluster_recovery_point_input: Apply recovery point input. Required. - :type apply_cluster_recovery_point_input: 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 ReplicationProtectionCluster or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_apply_recovery_point( - self, - resource_name: str, - fabric_name: str, - protection_container_name: str, - replication_protection_cluster_name: str, - apply_cluster_recovery_point_input: Union[_models.ApplyClusterRecoveryPointInput, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.ReplicationProtectionCluster]: - """Execute the change recovery point operation for cluster. - - Operation to apply a new cluster recovery point on the Protection cluster. - - :param resource_name: The name of the recovery services vault. Required. - :type resource_name: str - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replication_protection_cluster_name: Replication protection cluster name. Required. - :type replication_protection_cluster_name: str - :param apply_cluster_recovery_point_input: Apply recovery point input. Is either a - ApplyClusterRecoveryPointInput type or a IO[bytes] type. Required. - :type apply_cluster_recovery_point_input: - ~azure.mgmt.recoveryservicessiterecovery.models.ApplyClusterRecoveryPointInput or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ReplicationProtectionCluster or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster] - :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.ReplicationProtectionCluster] = 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._apply_recovery_point_initial( - resource_name=resource_name, - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replication_protection_cluster_name=replication_protection_cluster_name, - apply_cluster_recovery_point_input=apply_cluster_recovery_point_input, - 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("ReplicationProtectionCluster", 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, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ReplicationProtectionCluster].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ReplicationProtectionCluster]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _failover_commit_initial( - self, - resource_name: str, - fabric_name: str, - protection_container_name: str, - replication_protection_cluster_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_failover_commit_request( - resource_name=resource_name, - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replication_protection_cluster_name=replication_protection_cluster_name, - resource_group_name=self._config.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) - - _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.ErrorResponse, 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["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("str", response.headers.get("Retry-After")) - - 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_failover_commit( - self, - resource_name: str, - fabric_name: str, - protection_container_name: str, - replication_protection_cluster_name: str, - **kwargs: Any - ) -> AsyncLROPoller[_models.ReplicationProtectionCluster]: - """Execute commit failover for cluster. - - Operation to initiate commit failover of the replication protection cluster. - - :param resource_name: The name of the recovery services vault. Required. - :type resource_name: str - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replication_protection_cluster_name: Replication protection cluster name. Required. - :type replication_protection_cluster_name: str - :return: An instance of AsyncLROPoller that returns either ReplicationProtectionCluster or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster] - :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.ReplicationProtectionCluster] = 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._failover_commit_initial( - resource_name=resource_name, - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replication_protection_cluster_name=replication_protection_cluster_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): - deserialized = self._deserialize("ReplicationProtectionCluster", 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, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ReplicationProtectionCluster].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ReplicationProtectionCluster]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace_async - async def get_operation_results( - self, - resource_name: str, - fabric_name: str, - protection_container_name: str, - replication_protection_cluster_name: str, - job_id: str, - **kwargs: Any - ) -> _models.ReplicationProtectionCluster: - """Tracks the Replication protection cluster async operation. - - Track the results of an asynchronous operation on the replication protection cluster. - - :param resource_name: The name of the recovery services vault. Required. - :type resource_name: str - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replication_protection_cluster_name: Replication protection cluster name. Required. - :type replication_protection_cluster_name: str - :param job_id: job id to track. Required. - :type job_id: str - :return: ReplicationProtectionCluster or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster - :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.ReplicationProtectionCluster] = kwargs.pop("cls", None) - - _request = build_get_operation_results_request( - resource_name=resource_name, - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replication_protection_cluster_name=replication_protection_cluster_name, - job_id=job_id, - resource_group_name=self._config.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) - - _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.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ReplicationProtectionCluster", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _repair_replication_initial( - self, - resource_name: str, - fabric_name: str, - protection_container_name: str, - replication_protection_cluster_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_repair_replication_request( - resource_name=resource_name, - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replication_protection_cluster_name=replication_protection_cluster_name, - resource_group_name=self._config.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) - - _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.ErrorResponse, 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["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("str", response.headers.get("Retry-After")) - - 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_repair_replication( - self, - resource_name: str, - fabric_name: str, - protection_container_name: str, - replication_protection_cluster_name: str, - **kwargs: Any - ) -> AsyncLROPoller[_models.ReplicationProtectionCluster]: - """Resynchronize or repair replication of protection cluster. - - The operation to repair replication protection cluster. - - :param resource_name: The name of the recovery services vault. Required. - :type resource_name: str - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replication_protection_cluster_name: Replication protection cluster name. Required. - :type replication_protection_cluster_name: str - :return: An instance of AsyncLROPoller that returns either ReplicationProtectionCluster or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster] - :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.ReplicationProtectionCluster] = 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._repair_replication_initial( - resource_name=resource_name, - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replication_protection_cluster_name=replication_protection_cluster_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): - deserialized = self._deserialize("ReplicationProtectionCluster", 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, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ReplicationProtectionCluster].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ReplicationProtectionCluster]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _test_failover_initial( - self, - resource_name: str, - fabric_name: str, - protection_container_name: str, - replication_protection_cluster_name: str, - failover_input: Union[_models.ClusterTestFailoverInput, 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(failover_input, (IOBase, bytes)): - _content = failover_input - else: - _json = self._serialize.body(failover_input, "ClusterTestFailoverInput") - - _request = build_test_failover_request( - resource_name=resource_name, - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replication_protection_cluster_name=replication_protection_cluster_name, - resource_group_name=self._config.resource_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) - - _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.ErrorResponse, 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["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("str", response.headers.get("Retry-After")) - - 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_test_failover( - self, - resource_name: str, - fabric_name: str, - protection_container_name: str, - replication_protection_cluster_name: str, - failover_input: _models.ClusterTestFailoverInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ReplicationProtectionCluster]: - """Execute test failover for cluster. - - Operation to initiate a failover of the replication protection cluster. - - :param resource_name: The name of the recovery services vault. Required. - :type resource_name: str - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replication_protection_cluster_name: Replication protection cluster name. Required. - :type replication_protection_cluster_name: str - :param failover_input: Cluster test failover input body. Required. - :type failover_input: ~azure.mgmt.recoveryservicessiterecovery.models.ClusterTestFailoverInput - :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 ReplicationProtectionCluster or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_test_failover( - self, - resource_name: str, - fabric_name: str, - protection_container_name: str, - replication_protection_cluster_name: str, - failover_input: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ReplicationProtectionCluster]: - """Execute test failover for cluster. - - Operation to initiate a failover of the replication protection cluster. - - :param resource_name: The name of the recovery services vault. Required. - :type resource_name: str - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replication_protection_cluster_name: Replication protection cluster name. Required. - :type replication_protection_cluster_name: str - :param failover_input: Cluster test failover input body. Required. - :type failover_input: 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 ReplicationProtectionCluster or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_test_failover( - self, - resource_name: str, - fabric_name: str, - protection_container_name: str, - replication_protection_cluster_name: str, - failover_input: Union[_models.ClusterTestFailoverInput, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.ReplicationProtectionCluster]: - """Execute test failover for cluster. - - Operation to initiate a failover of the replication protection cluster. - - :param resource_name: The name of the recovery services vault. Required. - :type resource_name: str - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replication_protection_cluster_name: Replication protection cluster name. Required. - :type replication_protection_cluster_name: str - :param failover_input: Cluster test failover input body. Is either a ClusterTestFailoverInput - type or a IO[bytes] type. Required. - :type failover_input: ~azure.mgmt.recoveryservicessiterecovery.models.ClusterTestFailoverInput - or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ReplicationProtectionCluster or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster] - :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.ReplicationProtectionCluster] = 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._test_failover_initial( - resource_name=resource_name, - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replication_protection_cluster_name=replication_protection_cluster_name, - failover_input=failover_input, - 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("ReplicationProtectionCluster", 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, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ReplicationProtectionCluster].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ReplicationProtectionCluster]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _test_failover_cleanup_initial( - self, - resource_name: str, - fabric_name: str, - protection_container_name: str, - replication_protection_cluster_name: str, - cleanup_input: Union[_models.ClusterTestFailoverCleanupInput, 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(cleanup_input, (IOBase, bytes)): - _content = cleanup_input - else: - _json = self._serialize.body(cleanup_input, "ClusterTestFailoverCleanupInput") - - _request = build_test_failover_cleanup_request( - resource_name=resource_name, - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replication_protection_cluster_name=replication_protection_cluster_name, - resource_group_name=self._config.resource_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) - - _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.ErrorResponse, 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["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("str", response.headers.get("Retry-After")) - - 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_test_failover_cleanup( - self, - resource_name: str, - fabric_name: str, - protection_container_name: str, - replication_protection_cluster_name: str, - cleanup_input: _models.ClusterTestFailoverCleanupInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ReplicationProtectionCluster]: - """Execute test failover cleanup for cluster. - - Operation to clean up the test failover of a replication protected cluster. - - :param resource_name: The name of the recovery services vault. Required. - :type resource_name: str - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replication_protection_cluster_name: Replication protection cluster name. Required. - :type replication_protection_cluster_name: str - :param cleanup_input: Test failover cleanup input. Required. - :type cleanup_input: - ~azure.mgmt.recoveryservicessiterecovery.models.ClusterTestFailoverCleanupInput - :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 ReplicationProtectionCluster or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_test_failover_cleanup( - self, - resource_name: str, - fabric_name: str, - protection_container_name: str, - replication_protection_cluster_name: str, - cleanup_input: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ReplicationProtectionCluster]: - """Execute test failover cleanup for cluster. - - Operation to clean up the test failover of a replication protected cluster. - - :param resource_name: The name of the recovery services vault. Required. - :type resource_name: str - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replication_protection_cluster_name: Replication protection cluster name. Required. - :type replication_protection_cluster_name: str - :param cleanup_input: Test failover cleanup input. Required. - :type cleanup_input: 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 ReplicationProtectionCluster or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_test_failover_cleanup( - self, - resource_name: str, - fabric_name: str, - protection_container_name: str, - replication_protection_cluster_name: str, - cleanup_input: Union[_models.ClusterTestFailoverCleanupInput, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.ReplicationProtectionCluster]: - """Execute test failover cleanup for cluster. - - Operation to clean up the test failover of a replication protected cluster. - - :param resource_name: The name of the recovery services vault. Required. - :type resource_name: str - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replication_protection_cluster_name: Replication protection cluster name. Required. - :type replication_protection_cluster_name: str - :param cleanup_input: Test failover cleanup input. Is either a ClusterTestFailoverCleanupInput - type or a IO[bytes] type. Required. - :type cleanup_input: - ~azure.mgmt.recoveryservicessiterecovery.models.ClusterTestFailoverCleanupInput or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ReplicationProtectionCluster or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster] - :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.ReplicationProtectionCluster] = 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._test_failover_cleanup_initial( - resource_name=resource_name, - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replication_protection_cluster_name=replication_protection_cluster_name, - cleanup_input=cleanup_input, - 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("ReplicationProtectionCluster", 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, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ReplicationProtectionCluster].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ReplicationProtectionCluster]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _unplanned_failover_initial( - self, - resource_name: str, - fabric_name: str, - protection_container_name: str, - replication_protection_cluster_name: str, - failover_input: Union[_models.ClusterUnplannedFailoverInput, 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(failover_input, (IOBase, bytes)): - _content = failover_input - else: - _json = self._serialize.body(failover_input, "ClusterUnplannedFailoverInput") - - _request = build_unplanned_failover_request( - resource_name=resource_name, - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replication_protection_cluster_name=replication_protection_cluster_name, - resource_group_name=self._config.resource_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) - - _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.ErrorResponse, 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["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("str", response.headers.get("Retry-After")) - - 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_unplanned_failover( - self, - resource_name: str, - fabric_name: str, - protection_container_name: str, - replication_protection_cluster_name: str, - failover_input: _models.ClusterUnplannedFailoverInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ReplicationProtectionCluster]: - """Execute unplanned cluster failover. - - Operation to initiate a failover of the replication protection cluster. - - :param resource_name: The name of the recovery services vault. Required. - :type resource_name: str - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replication_protection_cluster_name: Replication protection cluster name. Required. - :type replication_protection_cluster_name: str - :param failover_input: Failover input. Required. - :type failover_input: - ~azure.mgmt.recoveryservicessiterecovery.models.ClusterUnplannedFailoverInput - :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 ReplicationProtectionCluster or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_unplanned_failover( - self, - resource_name: str, - fabric_name: str, - protection_container_name: str, - replication_protection_cluster_name: str, - failover_input: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ReplicationProtectionCluster]: - """Execute unplanned cluster failover. - - Operation to initiate a failover of the replication protection cluster. - - :param resource_name: The name of the recovery services vault. Required. - :type resource_name: str - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replication_protection_cluster_name: Replication protection cluster name. Required. - :type replication_protection_cluster_name: str - :param failover_input: Failover input. Required. - :type failover_input: 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 ReplicationProtectionCluster or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_unplanned_failover( - self, - resource_name: str, - fabric_name: str, - protection_container_name: str, - replication_protection_cluster_name: str, - failover_input: Union[_models.ClusterUnplannedFailoverInput, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.ReplicationProtectionCluster]: - """Execute unplanned cluster failover. - - Operation to initiate a failover of the replication protection cluster. - - :param resource_name: The name of the recovery services vault. Required. - :type resource_name: str - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replication_protection_cluster_name: Replication protection cluster name. Required. - :type replication_protection_cluster_name: str - :param failover_input: Failover input. Is either a ClusterUnplannedFailoverInput type or a - IO[bytes] type. Required. - :type failover_input: - ~azure.mgmt.recoveryservicessiterecovery.models.ClusterUnplannedFailoverInput or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ReplicationProtectionCluster or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster] - :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.ReplicationProtectionCluster] = 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._unplanned_failover_initial( - resource_name=resource_name, - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replication_protection_cluster_name=replication_protection_cluster_name, - failover_input=failover_input, - 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("ReplicationProtectionCluster", 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, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ReplicationProtectionCluster].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ReplicationProtectionCluster]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, resource_name: str, skip_token: Optional[str] = None, filter: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.ReplicationProtectionCluster"]: - """Gets the list of Replication protection clusters in vault. - - Gets the list of ASR replication protected clusters in the vault. - - :param resource_name: The name of the recovery services vault. Required. - :type resource_name: str - :param skip_token: The pagination token. Possible values: "FabricId" or "FabricId_CloudId" or - null. Default value is None. - :type skip_token: str - :param filter: OData filter options. Default value is None. - :type filter: str - :return: An iterator like instance of either ReplicationProtectionCluster or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster] - :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.ReplicationProtectionClusterCollection] = 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_request( - resource_name=resource_name, - resource_group_name=self._config.resource_group_name, - subscription_id=self._config.subscription_id, - skip_token=skip_token, - filter=filter, - 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("ReplicationProtectionClusterCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link 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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_protection_container_mappings_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_protection_container_mappings_operations.py deleted file mode 100644 index 9fc4f515f08a..000000000000 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_protection_container_mappings_operations.py +++ /dev/null @@ -1,1049 +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, AsyncIterable, AsyncIterator, Callable, Dict, 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 ..._serialization import Deserializer, Serializer -from ...operations._replication_protection_container_mappings_operations import ( - build_create_request, - build_delete_request, - build_get_request, - build_list_by_replication_protection_containers_request, - build_list_request, - build_purge_request, - build_update_request, -) -from .._configuration import SiteRecoveryManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ReplicationProtectionContainerMappingsOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicessiterecovery.aio.SiteRecoveryManagementClient`'s - :attr:`replication_protection_container_mappings` 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: SiteRecoveryManagementClientConfiguration = ( - 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_replication_protection_containers( # pylint: disable=name-too-long - self, fabric_name: str, protection_container_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ProtectionContainerMapping"]: - """Gets the list of protection container mappings for a protection container. - - Lists the protection container mappings for a protection container. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :return: An iterator like instance of either ProtectionContainerMapping or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerMapping] - :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.ProtectionContainerMappingCollection] = 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_replication_protection_containers_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("ProtectionContainerMappingCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, fabric_name: str, protection_container_name: str, mapping_name: str, **kwargs: Any - ) -> _models.ProtectionContainerMapping: - """Gets a protection container mapping. - - Gets the details of a protection container mapping. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param mapping_name: Protection Container mapping name. Required. - :type mapping_name: str - :return: ProtectionContainerMapping or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerMapping - :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.ProtectionContainerMapping] = kwargs.pop("cls", None) - - _request = build_get_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - mapping_name=mapping_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("ProtectionContainerMapping", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_initial( - self, - fabric_name: str, - protection_container_name: str, - mapping_name: str, - creation_input: Union[_models.CreateProtectionContainerMappingInput, 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(creation_input, (IOBase, bytes)): - _content = creation_input - else: - _json = self._serialize.body(creation_input, "CreateProtectionContainerMappingInput") - - _request = build_create_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - mapping_name=mapping_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create( - self, - fabric_name: str, - protection_container_name: str, - mapping_name: str, - creation_input: _models.CreateProtectionContainerMappingInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ProtectionContainerMapping]: - """Create protection container mapping. - - The operation to create a protection container mapping. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param mapping_name: Protection container mapping name. Required. - :type mapping_name: str - :param creation_input: Mapping creation input. Required. - :type creation_input: - ~azure.mgmt.recoveryservicessiterecovery.models.CreateProtectionContainerMappingInput - :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 ProtectionContainerMapping or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerMapping] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create( - self, - fabric_name: str, - protection_container_name: str, - mapping_name: str, - creation_input: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ProtectionContainerMapping]: - """Create protection container mapping. - - The operation to create a protection container mapping. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param mapping_name: Protection container mapping name. Required. - :type mapping_name: str - :param creation_input: Mapping creation input. Required. - :type creation_input: 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 ProtectionContainerMapping or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerMapping] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create( - self, - fabric_name: str, - protection_container_name: str, - mapping_name: str, - creation_input: Union[_models.CreateProtectionContainerMappingInput, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.ProtectionContainerMapping]: - """Create protection container mapping. - - The operation to create a protection container mapping. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param mapping_name: Protection container mapping name. Required. - :type mapping_name: str - :param creation_input: Mapping creation input. Is either a - CreateProtectionContainerMappingInput type or a IO[bytes] type. Required. - :type creation_input: - ~azure.mgmt.recoveryservicessiterecovery.models.CreateProtectionContainerMappingInput or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either ProtectionContainerMapping or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerMapping] - :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.ProtectionContainerMapping] = 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( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - mapping_name=mapping_name, - creation_input=creation_input, - 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("ProtectionContainerMapping", 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.ProtectionContainerMapping].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ProtectionContainerMapping]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _purge_initial( - self, fabric_name: str, protection_container_name: str, mapping_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_purge_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - mapping_name=mapping_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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 [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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_purge( - self, fabric_name: str, protection_container_name: str, mapping_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Purge protection container mapping. - - The operation to purge(force delete) a protection container mapping. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param mapping_name: Protection container mapping name. Required. - :type mapping_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._purge_initial( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - mapping_name=mapping_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 - - async def _update_initial( - self, - fabric_name: str, - protection_container_name: str, - mapping_name: str, - update_input: Union[_models.UpdateProtectionContainerMappingInput, 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(update_input, (IOBase, bytes)): - _content = update_input - else: - _json = self._serialize.body(update_input, "UpdateProtectionContainerMappingInput") - - _request = build_update_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - mapping_name=mapping_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - fabric_name: str, - protection_container_name: str, - mapping_name: str, - update_input: _models.UpdateProtectionContainerMappingInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ProtectionContainerMapping]: - """Update protection container mapping. - - The operation to update protection container mapping. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param mapping_name: Protection container mapping name. Required. - :type mapping_name: str - :param update_input: Mapping update input. Required. - :type update_input: - ~azure.mgmt.recoveryservicessiterecovery.models.UpdateProtectionContainerMappingInput - :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 ProtectionContainerMapping or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerMapping] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - fabric_name: str, - protection_container_name: str, - mapping_name: str, - update_input: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ProtectionContainerMapping]: - """Update protection container mapping. - - The operation to update protection container mapping. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param mapping_name: Protection container mapping name. Required. - :type mapping_name: str - :param update_input: Mapping update input. Required. - :type update_input: 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 ProtectionContainerMapping or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerMapping] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - fabric_name: str, - protection_container_name: str, - mapping_name: str, - update_input: Union[_models.UpdateProtectionContainerMappingInput, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.ProtectionContainerMapping]: - """Update protection container mapping. - - The operation to update protection container mapping. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param mapping_name: Protection container mapping name. Required. - :type mapping_name: str - :param update_input: Mapping update input. Is either a UpdateProtectionContainerMappingInput - type or a IO[bytes] type. Required. - :type update_input: - ~azure.mgmt.recoveryservicessiterecovery.models.UpdateProtectionContainerMappingInput or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either ProtectionContainerMapping or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerMapping] - :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.ProtectionContainerMapping] = 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( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - mapping_name=mapping_name, - update_input=update_input, - 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("ProtectionContainerMapping", 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.ProtectionContainerMapping].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ProtectionContainerMapping]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, - fabric_name: str, - protection_container_name: str, - mapping_name: str, - removal_input: Union[_models.RemoveProtectionContainerMappingInput, 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(removal_input, (IOBase, bytes)): - _content = removal_input - else: - _json = self._serialize.body(removal_input, "RemoveProtectionContainerMappingInput") - - _request = build_delete_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - mapping_name=mapping_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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 [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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_delete( - self, - fabric_name: str, - protection_container_name: str, - mapping_name: str, - removal_input: _models.RemoveProtectionContainerMappingInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Remove protection container mapping. - - The operation to delete or remove a protection container mapping. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param mapping_name: Protection container mapping name. Required. - :type mapping_name: str - :param removal_input: Removal input. Required. - :type removal_input: - ~azure.mgmt.recoveryservicessiterecovery.models.RemoveProtectionContainerMappingInput - :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_delete( - self, - fabric_name: str, - protection_container_name: str, - mapping_name: str, - removal_input: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Remove protection container mapping. - - The operation to delete or remove a protection container mapping. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param mapping_name: Protection container mapping name. Required. - :type mapping_name: str - :param removal_input: Removal input. Required. - :type removal_input: 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_delete( - self, - fabric_name: str, - protection_container_name: str, - mapping_name: str, - removal_input: Union[_models.RemoveProtectionContainerMappingInput, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Remove protection container mapping. - - The operation to delete or remove a protection container mapping. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param mapping_name: Protection container mapping name. Required. - :type mapping_name: str - :param removal_input: Removal input. Is either a RemoveProtectionContainerMappingInput type or - a IO[bytes] type. Required. - :type removal_input: - ~azure.mgmt.recoveryservicessiterecovery.models.RemoveProtectionContainerMappingInput 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._delete_initial( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - mapping_name=mapping_name, - removal_input=removal_input, - 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 - def list(self, **kwargs: Any) -> AsyncIterable["_models.ProtectionContainerMapping"]: - """Gets the list of all protection container mappings in a vault. - - Lists the protection container mappings in the vault. - - :return: An iterator like instance of either ProtectionContainerMapping or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerMapping] - :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.ProtectionContainerMappingCollection] = 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_request( - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("ProtectionContainerMappingCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_protection_containers_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_protection_containers_operations.py deleted file mode 100644 index 63aa0bd90615..000000000000 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_protection_containers_operations.py +++ /dev/null @@ -1,1243 +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, AsyncIterable, AsyncIterator, Callable, Dict, 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 ..._serialization import Deserializer, Serializer -from ...operations._replication_protection_containers_operations import ( - build_create_request, - build_delete_request, - build_discover_protectable_item_request, - build_get_request, - build_list_by_replication_fabrics_request, - build_list_request, - build_switch_cluster_protection_request, - build_switch_protection_request, -) -from .._configuration import SiteRecoveryManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ReplicationProtectionContainersOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicessiterecovery.aio.SiteRecoveryManagementClient`'s - :attr:`replication_protection_containers` 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: SiteRecoveryManagementClientConfiguration = ( - 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_replication_fabrics( - self, fabric_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ProtectionContainer"]: - """Gets the list of protection container for a fabric. - - Lists the protection containers in the specified fabric. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :return: An iterator like instance of either ProtectionContainer or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] - :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.ProtectionContainerCollection] = 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_replication_fabrics_request( - fabric_name=fabric_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("ProtectionContainerCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get(self, fabric_name: str, protection_container_name: str, **kwargs: Any) -> _models.ProtectionContainer: - """Gets the protection container details. - - Gets the details of a protection container. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :return: ProtectionContainer or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer - :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.ProtectionContainer] = kwargs.pop("cls", None) - - _request = build_get_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("ProtectionContainer", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_initial( - self, - fabric_name: str, - protection_container_name: str, - creation_input: Union[_models.CreateProtectionContainerInput, 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(creation_input, (IOBase, bytes)): - _content = creation_input - else: - _json = self._serialize.body(creation_input, "CreateProtectionContainerInput") - - _request = build_create_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create( - self, - fabric_name: str, - protection_container_name: str, - creation_input: _models.CreateProtectionContainerInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ProtectionContainer]: - """Create a protection container. - - Operation to create a protection container. - - :param fabric_name: Unique fabric ARM name. Required. - :type fabric_name: str - :param protection_container_name: Unique protection container ARM name. Required. - :type protection_container_name: str - :param creation_input: Creation input. Required. - :type creation_input: - ~azure.mgmt.recoveryservicessiterecovery.models.CreateProtectionContainerInput - :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 ProtectionContainer or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create( - self, - fabric_name: str, - protection_container_name: str, - creation_input: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ProtectionContainer]: - """Create a protection container. - - Operation to create a protection container. - - :param fabric_name: Unique fabric ARM name. Required. - :type fabric_name: str - :param protection_container_name: Unique protection container ARM name. Required. - :type protection_container_name: str - :param creation_input: Creation input. Required. - :type creation_input: 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 ProtectionContainer or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create( - self, - fabric_name: str, - protection_container_name: str, - creation_input: Union[_models.CreateProtectionContainerInput, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.ProtectionContainer]: - """Create a protection container. - - Operation to create a protection container. - - :param fabric_name: Unique fabric ARM name. Required. - :type fabric_name: str - :param protection_container_name: Unique protection container ARM name. Required. - :type protection_container_name: str - :param creation_input: Creation input. Is either a CreateProtectionContainerInput type or a - IO[bytes] type. Required. - :type creation_input: - ~azure.mgmt.recoveryservicessiterecovery.models.CreateProtectionContainerInput or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ProtectionContainer or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] - :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.ProtectionContainer] = 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( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - creation_input=creation_input, - 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("ProtectionContainer", 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.ProtectionContainer].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ProtectionContainer]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _discover_protectable_item_initial( - self, - fabric_name: str, - protection_container_name: str, - discover_protectable_item_request: Union[_models.DiscoverProtectableItemRequest, 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(discover_protectable_item_request, (IOBase, bytes)): - _content = discover_protectable_item_request - else: - _json = self._serialize.body(discover_protectable_item_request, "DiscoverProtectableItemRequest") - - _request = build_discover_protectable_item_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_discover_protectable_item( - self, - fabric_name: str, - protection_container_name: str, - discover_protectable_item_request: _models.DiscoverProtectableItemRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ProtectionContainer]: - """Adds a protectable item to the replication protection container. - - The operation to a add a protectable item to a protection container(Add physical server). - - :param fabric_name: The name of the fabric. Required. - :type fabric_name: str - :param protection_container_name: The name of the protection container. Required. - :type protection_container_name: str - :param discover_protectable_item_request: The request object to add a protectable item. - Required. - :type discover_protectable_item_request: - ~azure.mgmt.recoveryservicessiterecovery.models.DiscoverProtectableItemRequest - :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 ProtectionContainer or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_discover_protectable_item( - self, - fabric_name: str, - protection_container_name: str, - discover_protectable_item_request: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ProtectionContainer]: - """Adds a protectable item to the replication protection container. - - The operation to a add a protectable item to a protection container(Add physical server). - - :param fabric_name: The name of the fabric. Required. - :type fabric_name: str - :param protection_container_name: The name of the protection container. Required. - :type protection_container_name: str - :param discover_protectable_item_request: The request object to add a protectable item. - Required. - :type discover_protectable_item_request: 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 ProtectionContainer or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_discover_protectable_item( - self, - fabric_name: str, - protection_container_name: str, - discover_protectable_item_request: Union[_models.DiscoverProtectableItemRequest, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.ProtectionContainer]: - """Adds a protectable item to the replication protection container. - - The operation to a add a protectable item to a protection container(Add physical server). - - :param fabric_name: The name of the fabric. Required. - :type fabric_name: str - :param protection_container_name: The name of the protection container. Required. - :type protection_container_name: str - :param discover_protectable_item_request: The request object to add a protectable item. Is - either a DiscoverProtectableItemRequest type or a IO[bytes] type. Required. - :type discover_protectable_item_request: - ~azure.mgmt.recoveryservicessiterecovery.models.DiscoverProtectableItemRequest or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ProtectionContainer or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] - :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.ProtectionContainer] = 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._discover_protectable_item_initial( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - discover_protectable_item_request=discover_protectable_item_request, - 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("ProtectionContainer", 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.ProtectionContainer].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ProtectionContainer]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, fabric_name: str, protection_container_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( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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 [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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, fabric_name: str, protection_container_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Removes a protection container. - - Operation to remove a protection container. - - :param fabric_name: Unique fabric ARM name. Required. - :type fabric_name: str - :param protection_container_name: Unique protection container ARM name. Required. - :type protection_container_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( - fabric_name=fabric_name, - protection_container_name=protection_container_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 - - async def _switch_cluster_protection_initial( - self, - resource_name: str, - fabric_name: str, - protection_container_name: str, - switch_input: Union[_models.SwitchClusterProtectionInput, 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(switch_input, (IOBase, bytes)): - _content = switch_input - else: - _json = self._serialize.body(switch_input, "SwitchClusterProtectionInput") - - _request = build_switch_cluster_protection_request( - resource_name=resource_name, - fabric_name=fabric_name, - protection_container_name=protection_container_name, - resource_group_name=self._config.resource_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) - - _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.ErrorResponse, 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["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("str", response.headers.get("Retry-After")) - - 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_switch_cluster_protection( - self, - resource_name: str, - fabric_name: str, - protection_container_name: str, - switch_input: _models.SwitchClusterProtectionInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ProtectionContainer]: - """Switches protection from one container to another. - - Operation to switch protection from one container to another. - - :param resource_name: The name of the recovery services vault. Required. - :type resource_name: str - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param switch_input: Switch protection input. Required. - :type switch_input: - ~azure.mgmt.recoveryservicessiterecovery.models.SwitchClusterProtectionInput - :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 ProtectionContainer or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_switch_cluster_protection( - self, - resource_name: str, - fabric_name: str, - protection_container_name: str, - switch_input: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ProtectionContainer]: - """Switches protection from one container to another. - - Operation to switch protection from one container to another. - - :param resource_name: The name of the recovery services vault. Required. - :type resource_name: str - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param switch_input: Switch protection input. Required. - :type switch_input: 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 ProtectionContainer or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_switch_cluster_protection( - self, - resource_name: str, - fabric_name: str, - protection_container_name: str, - switch_input: Union[_models.SwitchClusterProtectionInput, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.ProtectionContainer]: - """Switches protection from one container to another. - - Operation to switch protection from one container to another. - - :param resource_name: The name of the recovery services vault. Required. - :type resource_name: str - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param switch_input: Switch protection input. Is either a SwitchClusterProtectionInput type or - a IO[bytes] type. Required. - :type switch_input: - ~azure.mgmt.recoveryservicessiterecovery.models.SwitchClusterProtectionInput or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ProtectionContainer or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] - :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.ProtectionContainer] = 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._switch_cluster_protection_initial( - resource_name=resource_name, - fabric_name=fabric_name, - protection_container_name=protection_container_name, - switch_input=switch_input, - 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("ProtectionContainer", 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, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ProtectionContainer].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ProtectionContainer]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _switch_protection_initial( - self, - fabric_name: str, - protection_container_name: str, - switch_input: Union[_models.SwitchProtectionInput, 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(switch_input, (IOBase, bytes)): - _content = switch_input - else: - _json = self._serialize.body(switch_input, "SwitchProtectionInput") - - _request = build_switch_protection_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("str", response.headers.get("Retry-After")) - - 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_switch_protection( - self, - fabric_name: str, - protection_container_name: str, - switch_input: _models.SwitchProtectionInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ProtectionContainer]: - """Switches protection from one container to another or one replication provider to another. - - Operation to switch protection from one container to another or one replication provider to - another. - - :param fabric_name: Unique fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param switch_input: Switch protection input. Required. - :type switch_input: ~azure.mgmt.recoveryservicessiterecovery.models.SwitchProtectionInput - :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 ProtectionContainer or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_switch_protection( - self, - fabric_name: str, - protection_container_name: str, - switch_input: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ProtectionContainer]: - """Switches protection from one container to another or one replication provider to another. - - Operation to switch protection from one container to another or one replication provider to - another. - - :param fabric_name: Unique fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param switch_input: Switch protection input. Required. - :type switch_input: 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 ProtectionContainer or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_switch_protection( - self, - fabric_name: str, - protection_container_name: str, - switch_input: Union[_models.SwitchProtectionInput, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.ProtectionContainer]: - """Switches protection from one container to another or one replication provider to another. - - Operation to switch protection from one container to another or one replication provider to - another. - - :param fabric_name: Unique fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param switch_input: Switch protection input. Is either a SwitchProtectionInput type or a - IO[bytes] type. Required. - :type switch_input: ~azure.mgmt.recoveryservicessiterecovery.models.SwitchProtectionInput or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either ProtectionContainer or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] - :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.ProtectionContainer] = 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._switch_protection_initial( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - switch_input=switch_input, - 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("ProtectionContainer", 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.ProtectionContainer].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ProtectionContainer]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.ProtectionContainer"]: - """Gets the list of all protection containers in a vault. - - Lists the protection containers in a vault. - - :return: An iterator like instance of either ProtectionContainer or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] - :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.ProtectionContainerCollection] = 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_request( - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("ProtectionContainerCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_protection_intents_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_protection_intents_operations.py deleted file mode 100644 index e6f09eefeaa0..000000000000 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_protection_intents_operations.py +++ /dev/null @@ -1,324 +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, AsyncIterable, Callable, Dict, 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 ..._serialization import Deserializer, Serializer -from ...operations._replication_protection_intents_operations import ( - build_create_request, - build_get_request, - build_list_request, -) -from .._configuration import SiteRecoveryManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ReplicationProtectionIntentsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicessiterecovery.aio.SiteRecoveryManagementClient`'s - :attr:`replication_protection_intents` 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: SiteRecoveryManagementClientConfiguration = ( - 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, skip_token: Optional[str] = None, take_token: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.ReplicationProtectionIntent"]: - """Gets the list of replication protection intent objects. - - Gets the list of ASR replication protection intent objects in the vault. - - :param skip_token: The pagination token. Default value is None. - :type skip_token: str - :param take_token: The page size. Default value is None. - :type take_token: str - :return: An iterator like instance of either ReplicationProtectionIntent or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionIntent] - :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.ReplicationProtectionIntentCollection] = 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_request( - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_name, - subscription_id=self._config.subscription_id, - skip_token=skip_token, - take_token=take_token, - 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("ReplicationProtectionIntentCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get(self, intent_object_name: str, **kwargs: Any) -> _models.ReplicationProtectionIntent: - """Gets the details of a Replication protection intent item. - - Gets the details of an ASR replication protection intent. - - :param intent_object_name: Replication protection intent name. Required. - :type intent_object_name: str - :return: ReplicationProtectionIntent or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionIntent - :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.ReplicationProtectionIntent] = kwargs.pop("cls", None) - - _request = build_get_request( - intent_object_name=intent_object_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("ReplicationProtectionIntent", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def create( - self, - intent_object_name: str, - input: _models.CreateProtectionIntentInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ReplicationProtectionIntent: - """Create protection intent Resource. - - The operation to create an ASR replication protection intent item. - - :param intent_object_name: A name for the replication protection item. Required. - :type intent_object_name: str - :param input: Create Protection Intent Input. Required. - :type input: ~azure.mgmt.recoveryservicessiterecovery.models.CreateProtectionIntentInput - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ReplicationProtectionIntent or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionIntent - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create( - self, intent_object_name: str, input: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.ReplicationProtectionIntent: - """Create protection intent Resource. - - The operation to create an ASR replication protection intent item. - - :param intent_object_name: A name for the replication protection item. Required. - :type intent_object_name: str - :param input: Create Protection Intent Input. Required. - :type input: 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: ReplicationProtectionIntent or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionIntent - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create( - self, intent_object_name: str, input: Union[_models.CreateProtectionIntentInput, IO[bytes]], **kwargs: Any - ) -> _models.ReplicationProtectionIntent: - """Create protection intent Resource. - - The operation to create an ASR replication protection intent item. - - :param intent_object_name: A name for the replication protection item. Required. - :type intent_object_name: str - :param input: Create Protection Intent Input. Is either a CreateProtectionIntentInput type or a - IO[bytes] type. Required. - :type input: ~azure.mgmt.recoveryservicessiterecovery.models.CreateProtectionIntentInput or - IO[bytes] - :return: ReplicationProtectionIntent or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionIntent - :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.ReplicationProtectionIntent] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(input, (IOBase, bytes)): - _content = input - else: - _json = self._serialize.body(input, "CreateProtectionIntentInput") - - _request = build_create_request( - intent_object_name=intent_object_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("ReplicationProtectionIntent", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_recovery_plans_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_recovery_plans_operations.py deleted file mode 100644 index bf4f6b2b21e1..000000000000 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_recovery_plans_operations.py +++ /dev/null @@ -1,1715 +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, AsyncIterable, AsyncIterator, Callable, Dict, 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 ..._serialization import Deserializer, Serializer -from ...operations._replication_recovery_plans_operations import ( - build_create_request, - build_delete_request, - build_failover_cancel_request, - build_failover_commit_request, - build_get_request, - build_list_request, - build_planned_failover_request, - build_reprotect_request, - build_test_failover_cleanup_request, - build_test_failover_request, - build_unplanned_failover_request, - build_update_request, -) -from .._configuration import SiteRecoveryManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ReplicationRecoveryPlansOperations: # pylint: disable=too-many-public-methods - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicessiterecovery.aio.SiteRecoveryManagementClient`'s - :attr:`replication_recovery_plans` 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: SiteRecoveryManagementClientConfiguration = ( - 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) -> AsyncIterable["_models.RecoveryPlan"]: - """Gets the list of recovery plans. - - Lists the recovery plans in the vault. - - :return: An iterator like instance of either RecoveryPlan or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] - :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.RecoveryPlanCollection] = 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_request( - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("RecoveryPlanCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get(self, recovery_plan_name: str, **kwargs: Any) -> _models.RecoveryPlan: - """Gets the requested recovery plan. - - Gets the details of the recovery plan. - - :param recovery_plan_name: Name of the recovery plan. Required. - :type recovery_plan_name: str - :return: RecoveryPlan or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan - :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.RecoveryPlan] = kwargs.pop("cls", None) - - _request = build_get_request( - recovery_plan_name=recovery_plan_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("RecoveryPlan", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_initial( - self, recovery_plan_name: str, input: Union[_models.CreateRecoveryPlanInput, 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(input, (IOBase, bytes)): - _content = input - else: - _json = self._serialize.body(input, "CreateRecoveryPlanInput") - - _request = build_create_request( - recovery_plan_name=recovery_plan_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create( - self, - recovery_plan_name: str, - input: _models.CreateRecoveryPlanInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.RecoveryPlan]: - """Creates a recovery plan with the given details. - - The operation to create a recovery plan. - - :param recovery_plan_name: Recovery plan name. Required. - :type recovery_plan_name: str - :param input: Recovery Plan creation input. Required. - :type input: ~azure.mgmt.recoveryservicessiterecovery.models.CreateRecoveryPlanInput - :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 RecoveryPlan or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create( - self, recovery_plan_name: str, input: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.RecoveryPlan]: - """Creates a recovery plan with the given details. - - The operation to create a recovery plan. - - :param recovery_plan_name: Recovery plan name. Required. - :type recovery_plan_name: str - :param input: Recovery Plan creation input. Required. - :type input: 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 RecoveryPlan or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create( - self, recovery_plan_name: str, input: Union[_models.CreateRecoveryPlanInput, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.RecoveryPlan]: - """Creates a recovery plan with the given details. - - The operation to create a recovery plan. - - :param recovery_plan_name: Recovery plan name. Required. - :type recovery_plan_name: str - :param input: Recovery Plan creation input. Is either a CreateRecoveryPlanInput type or a - IO[bytes] type. Required. - :type input: ~azure.mgmt.recoveryservicessiterecovery.models.CreateRecoveryPlanInput or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either RecoveryPlan or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] - :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.RecoveryPlan] = 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( - recovery_plan_name=recovery_plan_name, - input=input, - 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("RecoveryPlan", 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.RecoveryPlan].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.RecoveryPlan]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial(self, recovery_plan_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( - recovery_plan_name=recovery_plan_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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 [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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete(self, recovery_plan_name: str, **kwargs: Any) -> AsyncLROPoller[None]: - """Deletes the specified recovery plan. - - Delete a recovery plan. - - :param recovery_plan_name: Recovery plan name. Required. - :type recovery_plan_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( - recovery_plan_name=recovery_plan_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 - - async def _update_initial( - self, recovery_plan_name: str, input: Union[_models.UpdateRecoveryPlanInput, 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(input, (IOBase, bytes)): - _content = input - else: - _json = self._serialize.body(input, "UpdateRecoveryPlanInput") - - _request = build_update_request( - recovery_plan_name=recovery_plan_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - recovery_plan_name: str, - input: _models.UpdateRecoveryPlanInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.RecoveryPlan]: - """Updates the given recovery plan. - - The operation to update a recovery plan. - - :param recovery_plan_name: Recovery plan name. Required. - :type recovery_plan_name: str - :param input: Update recovery plan input. Required. - :type input: ~azure.mgmt.recoveryservicessiterecovery.models.UpdateRecoveryPlanInput - :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 RecoveryPlan or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, recovery_plan_name: str, input: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.RecoveryPlan]: - """Updates the given recovery plan. - - The operation to update a recovery plan. - - :param recovery_plan_name: Recovery plan name. Required. - :type recovery_plan_name: str - :param input: Update recovery plan input. Required. - :type input: 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 RecoveryPlan or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, recovery_plan_name: str, input: Union[_models.UpdateRecoveryPlanInput, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.RecoveryPlan]: - """Updates the given recovery plan. - - The operation to update a recovery plan. - - :param recovery_plan_name: Recovery plan name. Required. - :type recovery_plan_name: str - :param input: Update recovery plan input. Is either a UpdateRecoveryPlanInput type or a - IO[bytes] type. Required. - :type input: ~azure.mgmt.recoveryservicessiterecovery.models.UpdateRecoveryPlanInput or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either RecoveryPlan or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] - :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.RecoveryPlan] = 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( - recovery_plan_name=recovery_plan_name, - input=input, - 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("RecoveryPlan", 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.RecoveryPlan].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.RecoveryPlan]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _failover_cancel_initial(self, recovery_plan_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_failover_cancel_request( - recovery_plan_name=recovery_plan_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_failover_cancel( - self, recovery_plan_name: str, **kwargs: Any - ) -> AsyncLROPoller[_models.RecoveryPlan]: - """Execute cancel failover of the recovery plan. - - The operation to cancel the failover of a recovery plan. - - :param recovery_plan_name: Recovery plan name. Required. - :type recovery_plan_name: str - :return: An instance of AsyncLROPoller that returns either RecoveryPlan or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] - :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.RecoveryPlan] = 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._failover_cancel_initial( - recovery_plan_name=recovery_plan_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): - deserialized = self._deserialize("RecoveryPlan", 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.RecoveryPlan].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.RecoveryPlan]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _failover_commit_initial(self, recovery_plan_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_failover_commit_request( - recovery_plan_name=recovery_plan_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_failover_commit( - self, recovery_plan_name: str, **kwargs: Any - ) -> AsyncLROPoller[_models.RecoveryPlan]: - """Execute commit failover of the recovery plan. - - The operation to commit the failover of a recovery plan. - - :param recovery_plan_name: Recovery plan name. Required. - :type recovery_plan_name: str - :return: An instance of AsyncLROPoller that returns either RecoveryPlan or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] - :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.RecoveryPlan] = 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._failover_commit_initial( - recovery_plan_name=recovery_plan_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): - deserialized = self._deserialize("RecoveryPlan", 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.RecoveryPlan].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.RecoveryPlan]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _planned_failover_initial( - self, recovery_plan_name: str, input: Union[_models.RecoveryPlanPlannedFailoverInput, 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(input, (IOBase, bytes)): - _content = input - else: - _json = self._serialize.body(input, "RecoveryPlanPlannedFailoverInput") - - _request = build_planned_failover_request( - recovery_plan_name=recovery_plan_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_planned_failover( - self, - recovery_plan_name: str, - input: _models.RecoveryPlanPlannedFailoverInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.RecoveryPlan]: - """Execute planned failover of the recovery plan. - - The operation to start the planned failover of a recovery plan. - - :param recovery_plan_name: Recovery plan name. Required. - :type recovery_plan_name: str - :param input: Failover input. Required. - :type input: ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanPlannedFailoverInput - :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 RecoveryPlan or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_planned_failover( - self, recovery_plan_name: str, input: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.RecoveryPlan]: - """Execute planned failover of the recovery plan. - - The operation to start the planned failover of a recovery plan. - - :param recovery_plan_name: Recovery plan name. Required. - :type recovery_plan_name: str - :param input: Failover input. Required. - :type input: 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 RecoveryPlan or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_planned_failover( - self, recovery_plan_name: str, input: Union[_models.RecoveryPlanPlannedFailoverInput, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.RecoveryPlan]: - """Execute planned failover of the recovery plan. - - The operation to start the planned failover of a recovery plan. - - :param recovery_plan_name: Recovery plan name. Required. - :type recovery_plan_name: str - :param input: Failover input. Is either a RecoveryPlanPlannedFailoverInput type or a IO[bytes] - type. Required. - :type input: ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanPlannedFailoverInput - or IO[bytes] - :return: An instance of AsyncLROPoller that returns either RecoveryPlan or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] - :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.RecoveryPlan] = 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._planned_failover_initial( - recovery_plan_name=recovery_plan_name, - input=input, - 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("RecoveryPlan", 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.RecoveryPlan].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.RecoveryPlan]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _reprotect_initial(self, recovery_plan_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_reprotect_request( - recovery_plan_name=recovery_plan_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_reprotect(self, recovery_plan_name: str, **kwargs: Any) -> AsyncLROPoller[_models.RecoveryPlan]: - """Execute reprotect of the recovery plan. - - The operation to reprotect(reverse replicate) a recovery plan. This api is for deprecated - scenarios and no longer works. - - :param recovery_plan_name: Recovery plan name. Required. - :type recovery_plan_name: str - :return: An instance of AsyncLROPoller that returns either RecoveryPlan or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] - :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.RecoveryPlan] = 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._reprotect_initial( - recovery_plan_name=recovery_plan_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): - deserialized = self._deserialize("RecoveryPlan", 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.RecoveryPlan].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.RecoveryPlan]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _test_failover_initial( - self, recovery_plan_name: str, input: Union[_models.RecoveryPlanTestFailoverInput, 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(input, (IOBase, bytes)): - _content = input - else: - _json = self._serialize.body(input, "RecoveryPlanTestFailoverInput") - - _request = build_test_failover_request( - recovery_plan_name=recovery_plan_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_test_failover( - self, - recovery_plan_name: str, - input: _models.RecoveryPlanTestFailoverInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.RecoveryPlan]: - """Execute test failover of the recovery plan. - - The operation to start the test failover of a recovery plan. - - :param recovery_plan_name: Recovery plan name. Required. - :type recovery_plan_name: str - :param input: Recovery plan test failover input. Required. - :type input: ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanTestFailoverInput - :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 RecoveryPlan or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_test_failover( - self, recovery_plan_name: str, input: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.RecoveryPlan]: - """Execute test failover of the recovery plan. - - The operation to start the test failover of a recovery plan. - - :param recovery_plan_name: Recovery plan name. Required. - :type recovery_plan_name: str - :param input: Recovery plan test failover input. Required. - :type input: 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 RecoveryPlan or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_test_failover( - self, recovery_plan_name: str, input: Union[_models.RecoveryPlanTestFailoverInput, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.RecoveryPlan]: - """Execute test failover of the recovery plan. - - The operation to start the test failover of a recovery plan. - - :param recovery_plan_name: Recovery plan name. Required. - :type recovery_plan_name: str - :param input: Recovery plan test failover input. Is either a RecoveryPlanTestFailoverInput type - or a IO[bytes] type. Required. - :type input: ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanTestFailoverInput or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either RecoveryPlan or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] - :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.RecoveryPlan] = 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._test_failover_initial( - recovery_plan_name=recovery_plan_name, - input=input, - 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("RecoveryPlan", 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.RecoveryPlan].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.RecoveryPlan]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _test_failover_cleanup_initial( - self, - recovery_plan_name: str, - input: Union[_models.RecoveryPlanTestFailoverCleanupInput, 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(input, (IOBase, bytes)): - _content = input - else: - _json = self._serialize.body(input, "RecoveryPlanTestFailoverCleanupInput") - - _request = build_test_failover_cleanup_request( - recovery_plan_name=recovery_plan_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_test_failover_cleanup( - self, - recovery_plan_name: str, - input: _models.RecoveryPlanTestFailoverCleanupInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.RecoveryPlan]: - """Execute test failover cleanup of the recovery plan. - - The operation to cleanup test failover of a recovery plan. - - :param recovery_plan_name: Recovery plan name. Required. - :type recovery_plan_name: str - :param input: Recovery plan test failover cleanup input. Required. - :type input: - ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanTestFailoverCleanupInput - :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 RecoveryPlan or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_test_failover_cleanup( - self, recovery_plan_name: str, input: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.RecoveryPlan]: - """Execute test failover cleanup of the recovery plan. - - The operation to cleanup test failover of a recovery plan. - - :param recovery_plan_name: Recovery plan name. Required. - :type recovery_plan_name: str - :param input: Recovery plan test failover cleanup input. Required. - :type input: 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 RecoveryPlan or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_test_failover_cleanup( - self, - recovery_plan_name: str, - input: Union[_models.RecoveryPlanTestFailoverCleanupInput, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.RecoveryPlan]: - """Execute test failover cleanup of the recovery plan. - - The operation to cleanup test failover of a recovery plan. - - :param recovery_plan_name: Recovery plan name. Required. - :type recovery_plan_name: str - :param input: Recovery plan test failover cleanup input. Is either a - RecoveryPlanTestFailoverCleanupInput type or a IO[bytes] type. Required. - :type input: - ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanTestFailoverCleanupInput or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either RecoveryPlan or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] - :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.RecoveryPlan] = 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._test_failover_cleanup_initial( - recovery_plan_name=recovery_plan_name, - input=input, - 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("RecoveryPlan", 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.RecoveryPlan].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.RecoveryPlan]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _unplanned_failover_initial( - self, - recovery_plan_name: str, - input: Union[_models.RecoveryPlanUnplannedFailoverInput, 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(input, (IOBase, bytes)): - _content = input - else: - _json = self._serialize.body(input, "RecoveryPlanUnplannedFailoverInput") - - _request = build_unplanned_failover_request( - recovery_plan_name=recovery_plan_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_unplanned_failover( - self, - recovery_plan_name: str, - input: _models.RecoveryPlanUnplannedFailoverInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.RecoveryPlan]: - """Execute unplanned failover of the recovery plan. - - The operation to start the unplanned failover of a recovery plan. - - :param recovery_plan_name: Recovery plan name. Required. - :type recovery_plan_name: str - :param input: Recovery plan unplanned failover input. Required. - :type input: ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanUnplannedFailoverInput - :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 RecoveryPlan or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_unplanned_failover( - self, recovery_plan_name: str, input: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.RecoveryPlan]: - """Execute unplanned failover of the recovery plan. - - The operation to start the unplanned failover of a recovery plan. - - :param recovery_plan_name: Recovery plan name. Required. - :type recovery_plan_name: str - :param input: Recovery plan unplanned failover input. Required. - :type input: 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 RecoveryPlan or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_unplanned_failover( - self, - recovery_plan_name: str, - input: Union[_models.RecoveryPlanUnplannedFailoverInput, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.RecoveryPlan]: - """Execute unplanned failover of the recovery plan. - - The operation to start the unplanned failover of a recovery plan. - - :param recovery_plan_name: Recovery plan name. Required. - :type recovery_plan_name: str - :param input: Recovery plan unplanned failover input. Is either a - RecoveryPlanUnplannedFailoverInput type or a IO[bytes] type. Required. - :type input: ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanUnplannedFailoverInput - or IO[bytes] - :return: An instance of AsyncLROPoller that returns either RecoveryPlan or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] - :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.RecoveryPlan] = 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._unplanned_failover_initial( - recovery_plan_name=recovery_plan_name, - input=input, - 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("RecoveryPlan", 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.RecoveryPlan].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.RecoveryPlan]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_recovery_services_providers_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_recovery_services_providers_operations.py deleted file mode 100644 index 77d42b2bde4b..000000000000 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_recovery_services_providers_operations.py +++ /dev/null @@ -1,821 +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, AsyncIterable, AsyncIterator, Callable, Dict, 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 ..._serialization import Deserializer, Serializer -from ...operations._replication_recovery_services_providers_operations import ( - build_create_request, - build_delete_request, - build_get_request, - build_list_by_replication_fabrics_request, - build_list_request, - build_purge_request, - build_refresh_provider_request, -) -from .._configuration import SiteRecoveryManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ReplicationRecoveryServicesProvidersOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicessiterecovery.aio.SiteRecoveryManagementClient`'s - :attr:`replication_recovery_services_providers` 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: SiteRecoveryManagementClientConfiguration = ( - 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_replication_fabrics( - self, fabric_name: str, **kwargs: Any - ) -> AsyncIterable["_models.RecoveryServicesProvider"]: - """Gets the list of registered recovery services providers for the fabric. - - Lists the registered recovery services providers for the specified fabric. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :return: An iterator like instance of either RecoveryServicesProvider or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryServicesProvider] - :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.RecoveryServicesProviderCollection] = 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_replication_fabrics_request( - fabric_name=fabric_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("RecoveryServicesProviderCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get(self, fabric_name: str, provider_name: str, **kwargs: Any) -> _models.RecoveryServicesProvider: - """Gets the details of a recovery services provider. - - Gets the details of registered recovery services provider. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param provider_name: Recovery services provider name. Required. - :type provider_name: str - :return: RecoveryServicesProvider or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryServicesProvider - :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.RecoveryServicesProvider] = kwargs.pop("cls", None) - - _request = build_get_request( - fabric_name=fabric_name, - provider_name=provider_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("RecoveryServicesProvider", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_initial( - self, - fabric_name: str, - provider_name: str, - add_provider_input: Union[_models.AddRecoveryServicesProviderInput, 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(add_provider_input, (IOBase, bytes)): - _content = add_provider_input - else: - _json = self._serialize.body(add_provider_input, "AddRecoveryServicesProviderInput") - - _request = build_create_request( - fabric_name=fabric_name, - provider_name=provider_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create( - self, - fabric_name: str, - provider_name: str, - add_provider_input: _models.AddRecoveryServicesProviderInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.RecoveryServicesProvider]: - """Adds a recovery services provider. - - The operation to add a recovery services provider. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param provider_name: Recovery services provider name. Required. - :type provider_name: str - :param add_provider_input: Add provider input. Required. - :type add_provider_input: - ~azure.mgmt.recoveryservicessiterecovery.models.AddRecoveryServicesProviderInput - :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 RecoveryServicesProvider or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryServicesProvider] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create( - self, - fabric_name: str, - provider_name: str, - add_provider_input: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.RecoveryServicesProvider]: - """Adds a recovery services provider. - - The operation to add a recovery services provider. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param provider_name: Recovery services provider name. Required. - :type provider_name: str - :param add_provider_input: Add provider input. Required. - :type add_provider_input: 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 RecoveryServicesProvider or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryServicesProvider] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create( - self, - fabric_name: str, - provider_name: str, - add_provider_input: Union[_models.AddRecoveryServicesProviderInput, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.RecoveryServicesProvider]: - """Adds a recovery services provider. - - The operation to add a recovery services provider. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param provider_name: Recovery services provider name. Required. - :type provider_name: str - :param add_provider_input: Add provider input. Is either a AddRecoveryServicesProviderInput - type or a IO[bytes] type. Required. - :type add_provider_input: - ~azure.mgmt.recoveryservicessiterecovery.models.AddRecoveryServicesProviderInput or IO[bytes] - :return: An instance of AsyncLROPoller that returns either RecoveryServicesProvider or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryServicesProvider] - :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.RecoveryServicesProvider] = 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( - fabric_name=fabric_name, - provider_name=provider_name, - add_provider_input=add_provider_input, - 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("RecoveryServicesProvider", 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.RecoveryServicesProvider].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.RecoveryServicesProvider]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _purge_initial(self, fabric_name: str, provider_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_purge_request( - fabric_name=fabric_name, - provider_name=provider_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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 [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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_purge(self, fabric_name: str, provider_name: str, **kwargs: Any) -> AsyncLROPoller[None]: - """Purges recovery service provider from fabric. - - The operation to purge(force delete) a recovery services provider from the vault. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param provider_name: Recovery services provider name. Required. - :type provider_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._purge_initial( - fabric_name=fabric_name, - provider_name=provider_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 - - async def _refresh_provider_initial( - self, fabric_name: str, provider_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_refresh_provider_request( - fabric_name=fabric_name, - provider_name=provider_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_refresh_provider( - self, fabric_name: str, provider_name: str, **kwargs: Any - ) -> AsyncLROPoller[_models.RecoveryServicesProvider]: - """Refresh details from the recovery services provider. - - The operation to refresh the information from the recovery services provider. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param provider_name: Recovery services provider name. Required. - :type provider_name: str - :return: An instance of AsyncLROPoller that returns either RecoveryServicesProvider or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryServicesProvider] - :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.RecoveryServicesProvider] = 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._refresh_provider_initial( - fabric_name=fabric_name, - provider_name=provider_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): - deserialized = self._deserialize("RecoveryServicesProvider", 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.RecoveryServicesProvider].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.RecoveryServicesProvider]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial(self, fabric_name: str, provider_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( - fabric_name=fabric_name, - provider_name=provider_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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 [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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete(self, fabric_name: str, provider_name: str, **kwargs: Any) -> AsyncLROPoller[None]: - """Deletes provider from fabric. Note: Deleting provider for any fabric other than SingleHost is - unsupported. To maintain backward compatibility for released clients the object - "deleteRspInput" is used (if the object is empty we assume that it is old client and continue - the old behavior). - - The operation to removes/delete(unregister) a recovery services provider from the vault. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param provider_name: Recovery services provider name. Required. - :type provider_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( - fabric_name=fabric_name, - provider_name=provider_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(self, **kwargs: Any) -> AsyncIterable["_models.RecoveryServicesProvider"]: - """Gets the list of registered recovery services providers in the vault. This is a view only api. - - Lists the registered recovery services providers in the vault. - - :return: An iterator like instance of either RecoveryServicesProvider or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryServicesProvider] - :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.RecoveryServicesProviderCollection] = 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_request( - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("RecoveryServicesProviderCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_storage_classification_mappings_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_storage_classification_mappings_operations.py deleted file mode 100644 index 4df12c094ede..000000000000 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_storage_classification_mappings_operations.py +++ /dev/null @@ -1,638 +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, AsyncIterable, AsyncIterator, Callable, Dict, 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 ..._serialization import Deserializer, Serializer -from ...operations._replication_storage_classification_mappings_operations import ( - build_create_request, - build_delete_request, - build_get_request, - build_list_by_replication_storage_classifications_request, - build_list_request, -) -from .._configuration import SiteRecoveryManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ReplicationStorageClassificationMappingsOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicessiterecovery.aio.SiteRecoveryManagementClient`'s - :attr:`replication_storage_classification_mappings` 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: SiteRecoveryManagementClientConfiguration = ( - 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_replication_storage_classifications( # pylint: disable=name-too-long - self, fabric_name: str, storage_classification_name: str, **kwargs: Any - ) -> AsyncIterable["_models.StorageClassificationMapping"]: - """Gets the list of storage classification mappings objects under a storage. - - Lists the storage classification mappings for the fabric. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param storage_classification_name: Storage classification name. Required. - :type storage_classification_name: str - :return: An iterator like instance of either StorageClassificationMapping or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.StorageClassificationMapping] - :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.StorageClassificationMappingCollection] = 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_replication_storage_classifications_request( - fabric_name=fabric_name, - storage_classification_name=storage_classification_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("StorageClassificationMappingCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, - fabric_name: str, - storage_classification_name: str, - storage_classification_mapping_name: str, - **kwargs: Any - ) -> _models.StorageClassificationMapping: - """Gets the details of a storage classification mapping. - - Gets the details of the specified storage classification mapping. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param storage_classification_name: Storage classification name. Required. - :type storage_classification_name: str - :param storage_classification_mapping_name: Storage classification mapping name. Required. - :type storage_classification_mapping_name: str - :return: StorageClassificationMapping or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.StorageClassificationMapping - :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.StorageClassificationMapping] = kwargs.pop("cls", None) - - _request = build_get_request( - fabric_name=fabric_name, - storage_classification_name=storage_classification_name, - storage_classification_mapping_name=storage_classification_mapping_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("StorageClassificationMapping", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_initial( - self, - fabric_name: str, - storage_classification_name: str, - storage_classification_mapping_name: str, - pairing_input: Union[_models.StorageClassificationMappingInput, 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(pairing_input, (IOBase, bytes)): - _content = pairing_input - else: - _json = self._serialize.body(pairing_input, "StorageClassificationMappingInput") - - _request = build_create_request( - fabric_name=fabric_name, - storage_classification_name=storage_classification_name, - storage_classification_mapping_name=storage_classification_mapping_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create( - self, - fabric_name: str, - storage_classification_name: str, - storage_classification_mapping_name: str, - pairing_input: _models.StorageClassificationMappingInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.StorageClassificationMapping]: - """Create storage classification mapping. - - The operation to create a storage classification mapping. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param storage_classification_name: Storage classification name. Required. - :type storage_classification_name: str - :param storage_classification_mapping_name: Storage classification mapping name. Required. - :type storage_classification_mapping_name: str - :param pairing_input: Pairing input. Required. - :type pairing_input: - ~azure.mgmt.recoveryservicessiterecovery.models.StorageClassificationMappingInput - :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 StorageClassificationMapping or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.StorageClassificationMapping] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create( - self, - fabric_name: str, - storage_classification_name: str, - storage_classification_mapping_name: str, - pairing_input: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.StorageClassificationMapping]: - """Create storage classification mapping. - - The operation to create a storage classification mapping. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param storage_classification_name: Storage classification name. Required. - :type storage_classification_name: str - :param storage_classification_mapping_name: Storage classification mapping name. Required. - :type storage_classification_mapping_name: str - :param pairing_input: Pairing input. Required. - :type pairing_input: 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 StorageClassificationMapping or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.StorageClassificationMapping] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create( - self, - fabric_name: str, - storage_classification_name: str, - storage_classification_mapping_name: str, - pairing_input: Union[_models.StorageClassificationMappingInput, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.StorageClassificationMapping]: - """Create storage classification mapping. - - The operation to create a storage classification mapping. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param storage_classification_name: Storage classification name. Required. - :type storage_classification_name: str - :param storage_classification_mapping_name: Storage classification mapping name. Required. - :type storage_classification_mapping_name: str - :param pairing_input: Pairing input. Is either a StorageClassificationMappingInput type or a - IO[bytes] type. Required. - :type pairing_input: - ~azure.mgmt.recoveryservicessiterecovery.models.StorageClassificationMappingInput or IO[bytes] - :return: An instance of AsyncLROPoller that returns either StorageClassificationMapping or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.StorageClassificationMapping] - :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.StorageClassificationMapping] = 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( - fabric_name=fabric_name, - storage_classification_name=storage_classification_name, - storage_classification_mapping_name=storage_classification_mapping_name, - pairing_input=pairing_input, - 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("StorageClassificationMapping", 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.StorageClassificationMapping].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.StorageClassificationMapping]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, - fabric_name: str, - storage_classification_name: str, - storage_classification_mapping_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( - fabric_name=fabric_name, - storage_classification_name=storage_classification_name, - storage_classification_mapping_name=storage_classification_mapping_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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 [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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, - fabric_name: str, - storage_classification_name: str, - storage_classification_mapping_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete a storage classification mapping. - - The operation to delete a storage classification mapping. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param storage_classification_name: Storage classification name. Required. - :type storage_classification_name: str - :param storage_classification_mapping_name: Storage classification mapping name. Required. - :type storage_classification_mapping_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( - fabric_name=fabric_name, - storage_classification_name=storage_classification_name, - storage_classification_mapping_name=storage_classification_mapping_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(self, **kwargs: Any) -> AsyncIterable["_models.StorageClassificationMapping"]: - """Gets the list of storage classification mappings objects under a vault. - - Lists the storage classification mappings in the vault. - - :return: An iterator like instance of either StorageClassificationMapping or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.StorageClassificationMapping] - :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.StorageClassificationMappingCollection] = 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_request( - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("StorageClassificationMappingCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_storage_classifications_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_storage_classifications_operations.py deleted file mode 100644 index 4aba06fa6de5..000000000000 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_storage_classifications_operations.py +++ /dev/null @@ -1,286 +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, AsyncIterable, Callable, Dict, 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 ..._serialization import Deserializer, Serializer -from ...operations._replication_storage_classifications_operations import ( - build_get_request, - build_list_by_replication_fabrics_request, - build_list_request, -) -from .._configuration import SiteRecoveryManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ReplicationStorageClassificationsOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicessiterecovery.aio.SiteRecoveryManagementClient`'s - :attr:`replication_storage_classifications` 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: SiteRecoveryManagementClientConfiguration = ( - 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_replication_fabrics( - self, fabric_name: str, **kwargs: Any - ) -> AsyncIterable["_models.StorageClassification"]: - """Gets the list of storage classification objects under a fabric. - - Lists the storage classifications available in the specified fabric. - - :param fabric_name: Site name of interest. Required. - :type fabric_name: str - :return: An iterator like instance of either StorageClassification or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.StorageClassification] - :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.StorageClassificationCollection] = 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_replication_fabrics_request( - fabric_name=fabric_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("StorageClassificationCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, fabric_name: str, storage_classification_name: str, **kwargs: Any - ) -> _models.StorageClassification: - """Gets the details of a storage classification. - - Gets the details of the specified storage classification. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param storage_classification_name: Storage classification name. Required. - :type storage_classification_name: str - :return: StorageClassification or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.StorageClassification - :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.StorageClassification] = kwargs.pop("cls", None) - - _request = build_get_request( - fabric_name=fabric_name, - storage_classification_name=storage_classification_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("StorageClassification", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.StorageClassification"]: - """Gets the list of storage classification objects under a vault. - - Lists the storage classifications in the vault. - - :return: An iterator like instance of either StorageClassification or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.StorageClassification] - :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.StorageClassificationCollection] = 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_request( - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("StorageClassificationCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_vault_health_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_vault_health_operations.py deleted file mode 100644 index 52bcf45a98ab..000000000000 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_vault_health_operations.py +++ /dev/null @@ -1,208 +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, AsyncIterator, Callable, Dict, Optional, TypeVar, Union, cast - -from azure.core import AsyncPipelineClient -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_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 ..._serialization import Deserializer, Serializer -from ...operations._replication_vault_health_operations import build_get_request, build_refresh_request -from .._configuration import SiteRecoveryManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ReplicationVaultHealthOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicessiterecovery.aio.SiteRecoveryManagementClient`'s - :attr:`replication_vault_health` 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: SiteRecoveryManagementClientConfiguration = ( - 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, **kwargs: Any) -> _models.VaultHealthDetails: - """Gets the health summary for the vault. - - Gets the health details of the vault. - - :return: VaultHealthDetails or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.VaultHealthDetails - :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.VaultHealthDetails] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("VaultHealthDetails", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _refresh_initial(self, **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_refresh_request( - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_refresh(self, **kwargs: Any) -> AsyncLROPoller[_models.VaultHealthDetails]: - """Refreshes health summary of the vault. - - Refreshes health summary of the vault. - - :return: An instance of AsyncLROPoller that returns either VaultHealthDetails or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.VaultHealthDetails] - :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.VaultHealthDetails] = 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._refresh_initial( - 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): - deserialized = self._deserialize("VaultHealthDetails", 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.VaultHealthDetails].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.VaultHealthDetails]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_vault_setting_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_vault_setting_operations.py deleted file mode 100644 index 36bed49c7729..000000000000 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_vault_setting_operations.py +++ /dev/null @@ -1,381 +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, AsyncIterable, AsyncIterator, Callable, Dict, 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 ..._serialization import Deserializer, Serializer -from ...operations._replication_vault_setting_operations import ( - build_create_request, - build_get_request, - build_list_request, -) -from .._configuration import SiteRecoveryManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ReplicationVaultSettingOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicessiterecovery.aio.SiteRecoveryManagementClient`'s - :attr:`replication_vault_setting` 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: SiteRecoveryManagementClientConfiguration = ( - 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) -> AsyncIterable["_models.VaultSetting"]: - """Gets the list of vault setting. - - Gets the list of vault setting. This includes the Migration Hub connection settings. - - :return: An iterator like instance of either VaultSetting or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.VaultSetting] - :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.VaultSettingCollection] = 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_request( - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("VaultSettingCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get(self, vault_setting_name: str, **kwargs: Any) -> _models.VaultSetting: - """Gets the vault setting. - - Gets the vault setting. This includes the Migration Hub connection settings. - - :param vault_setting_name: Vault setting name. Required. - :type vault_setting_name: str - :return: VaultSetting or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.VaultSetting - :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.VaultSetting] = kwargs.pop("cls", None) - - _request = build_get_request( - vault_setting_name=vault_setting_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("VaultSetting", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_initial( - self, vault_setting_name: str, input: Union[_models.VaultSettingCreationInput, 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(input, (IOBase, bytes)): - _content = input - else: - _json = self._serialize.body(input, "VaultSettingCreationInput") - - _request = build_create_request( - vault_setting_name=vault_setting_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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]: - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create( - self, - vault_setting_name: str, - input: _models.VaultSettingCreationInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.VaultSetting]: - """Updates vault setting. A vault setting object is a singleton per vault and it is always present - by default. - - The operation to configure vault setting. - - :param vault_setting_name: Vault setting name. Required. - :type vault_setting_name: str - :param input: Vault setting creation input. Required. - :type input: ~azure.mgmt.recoveryservicessiterecovery.models.VaultSettingCreationInput - :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 VaultSetting or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.VaultSetting] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create( - self, vault_setting_name: str, input: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.VaultSetting]: - """Updates vault setting. A vault setting object is a singleton per vault and it is always present - by default. - - The operation to configure vault setting. - - :param vault_setting_name: Vault setting name. Required. - :type vault_setting_name: str - :param input: Vault setting creation input. Required. - :type input: 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 VaultSetting or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.VaultSetting] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create( - self, vault_setting_name: str, input: Union[_models.VaultSettingCreationInput, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.VaultSetting]: - """Updates vault setting. A vault setting object is a singleton per vault and it is always present - by default. - - The operation to configure vault setting. - - :param vault_setting_name: Vault setting name. Required. - :type vault_setting_name: str - :param input: Vault setting creation input. Is either a VaultSettingCreationInput type or a - IO[bytes] type. Required. - :type input: ~azure.mgmt.recoveryservicessiterecovery.models.VaultSettingCreationInput or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either VaultSetting or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.VaultSetting] - :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.VaultSetting] = 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( - vault_setting_name=vault_setting_name, - input=input, - 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("VaultSetting", 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.VaultSetting].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.VaultSetting]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replicationv_centers_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replicationv_centers_operations.py deleted file mode 100644 index 13e1c0de4d52..000000000000 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replicationv_centers_operations.py +++ /dev/null @@ -1,795 +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, AsyncIterable, AsyncIterator, Callable, Dict, 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 ..._serialization import Deserializer, Serializer -from ...operations._replicationv_centers_operations import ( - build_create_request, - build_delete_request, - build_get_request, - build_list_by_replication_fabrics_request, - build_list_request, - build_update_request, -) -from .._configuration import SiteRecoveryManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ReplicationvCentersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicessiterecovery.aio.SiteRecoveryManagementClient`'s - :attr:`replicationv_centers` 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: SiteRecoveryManagementClientConfiguration = ( - 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_replication_fabrics(self, fabric_name: str, **kwargs: Any) -> AsyncIterable["_models.VCenter"]: - """Gets the list of vCenter registered under a fabric. - - Lists the vCenter servers registered in a fabric. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :return: An iterator like instance of either VCenter or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.VCenter] - :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.VCenterCollection] = 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_replication_fabrics_request( - fabric_name=fabric_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("VCenterCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get(self, fabric_name: str, vcenter_name: str, **kwargs: Any) -> _models.VCenter: - """Gets the details of a vCenter. - - Gets the details of a registered vCenter server(Add vCenter server). - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param vcenter_name: vcenter name. Required. - :type vcenter_name: str - :return: VCenter or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.VCenter - :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.VCenter] = kwargs.pop("cls", None) - - _request = build_get_request( - fabric_name=fabric_name, - vcenter_name=vcenter_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("VCenter", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_initial( - self, - fabric_name: str, - vcenter_name: str, - add_v_center_request: Union[_models.AddVCenterRequest, 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(add_v_center_request, (IOBase, bytes)): - _content = add_v_center_request - else: - _json = self._serialize.body(add_v_center_request, "AddVCenterRequest") - - _request = build_create_request( - fabric_name=fabric_name, - vcenter_name=vcenter_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create( - self, - fabric_name: str, - vcenter_name: str, - add_v_center_request: _models.AddVCenterRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.VCenter]: - """Add vCenter. - - The operation to create a vCenter object.. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param vcenter_name: vcenter name. Required. - :type vcenter_name: str - :param add_v_center_request: The input to the add vCenter operation. Required. - :type add_v_center_request: ~azure.mgmt.recoveryservicessiterecovery.models.AddVCenterRequest - :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 VCenter or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.VCenter] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create( - self, - fabric_name: str, - vcenter_name: str, - add_v_center_request: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.VCenter]: - """Add vCenter. - - The operation to create a vCenter object.. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param vcenter_name: vcenter name. Required. - :type vcenter_name: str - :param add_v_center_request: The input to the add vCenter operation. Required. - :type add_v_center_request: 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 VCenter or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.VCenter] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create( - self, - fabric_name: str, - vcenter_name: str, - add_v_center_request: Union[_models.AddVCenterRequest, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.VCenter]: - """Add vCenter. - - The operation to create a vCenter object.. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param vcenter_name: vcenter name. Required. - :type vcenter_name: str - :param add_v_center_request: The input to the add vCenter operation. Is either a - AddVCenterRequest type or a IO[bytes] type. Required. - :type add_v_center_request: ~azure.mgmt.recoveryservicessiterecovery.models.AddVCenterRequest - or IO[bytes] - :return: An instance of AsyncLROPoller that returns either VCenter or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.VCenter] - :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.VCenter] = 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( - fabric_name=fabric_name, - vcenter_name=vcenter_name, - add_v_center_request=add_v_center_request, - 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("VCenter", 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.VCenter].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.VCenter]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial(self, fabric_name: str, vcenter_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( - fabric_name=fabric_name, - vcenter_name=vcenter_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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 [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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete(self, fabric_name: str, vcenter_name: str, **kwargs: Any) -> AsyncLROPoller[None]: - """Remove vcenter operation. - - The operation to remove(unregister) a registered vCenter server from the vault. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param vcenter_name: vcenter name. Required. - :type vcenter_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( - fabric_name=fabric_name, - vcenter_name=vcenter_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 - - async def _update_initial( - self, - fabric_name: str, - vcenter_name: str, - update_v_center_request: Union[_models.UpdateVCenterRequest, 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(update_v_center_request, (IOBase, bytes)): - _content = update_v_center_request - else: - _json = self._serialize.body(update_v_center_request, "UpdateVCenterRequest") - - _request = build_update_request( - fabric_name=fabric_name, - vcenter_name=vcenter_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - fabric_name: str, - vcenter_name: str, - update_v_center_request: _models.UpdateVCenterRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.VCenter]: - """Update vCenter operation. - - The operation to update a registered vCenter. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param vcenter_name: vcenter name. Required. - :type vcenter_name: str - :param update_v_center_request: The input to the update vCenter operation. Required. - :type update_v_center_request: - ~azure.mgmt.recoveryservicessiterecovery.models.UpdateVCenterRequest - :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 VCenter or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.VCenter] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - fabric_name: str, - vcenter_name: str, - update_v_center_request: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.VCenter]: - """Update vCenter operation. - - The operation to update a registered vCenter. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param vcenter_name: vcenter name. Required. - :type vcenter_name: str - :param update_v_center_request: The input to the update vCenter operation. Required. - :type update_v_center_request: 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 VCenter or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.VCenter] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - fabric_name: str, - vcenter_name: str, - update_v_center_request: Union[_models.UpdateVCenterRequest, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.VCenter]: - """Update vCenter operation. - - The operation to update a registered vCenter. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param vcenter_name: vcenter name. Required. - :type vcenter_name: str - :param update_v_center_request: The input to the update vCenter operation. Is either a - UpdateVCenterRequest type or a IO[bytes] type. Required. - :type update_v_center_request: - ~azure.mgmt.recoveryservicessiterecovery.models.UpdateVCenterRequest or IO[bytes] - :return: An instance of AsyncLROPoller that returns either VCenter or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicessiterecovery.models.VCenter] - :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.VCenter] = 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( - fabric_name=fabric_name, - vcenter_name=vcenter_name, - update_v_center_request=update_v_center_request, - 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("VCenter", 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.VCenter].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.VCenter]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.VCenter"]: - """Gets the list of vCenter registered under the vault. - - Lists the vCenter servers registered in the vault. - - :return: An iterator like instance of either VCenter or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.VCenter] - :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.VCenterCollection] = 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_request( - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("VCenterCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_supported_operating_systems_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_supported_operating_systems_operations.py deleted file mode 100644 index 5a31a715ae3d..000000000000 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_supported_operating_systems_operations.py +++ /dev/null @@ -1,109 +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, Dict, 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 ..._serialization import Deserializer, Serializer -from ...operations._supported_operating_systems_operations import build_get_request -from .._configuration import SiteRecoveryManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class SupportedOperatingSystemsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicessiterecovery.aio.SiteRecoveryManagementClient`'s - :attr:`supported_operating_systems` 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: SiteRecoveryManagementClientConfiguration = ( - 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, instance_type: Optional[str] = None, **kwargs: Any) -> _models.SupportedOperatingSystems: - """Gets the data of supported operating systems by SRS. - - Gets the data of supported operating systems by SRS. - - :param instance_type: The instance type. Default value is None. - :type instance_type: str - :return: SupportedOperatingSystems or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.SupportedOperatingSystems - :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.SupportedOperatingSystems] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_name, - subscription_id=self._config.subscription_id, - instance_type=instance_type, - 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("SupportedOperatingSystems", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_target_compute_sizes_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_target_compute_sizes_operations.py deleted file mode 100644 index 16c5da223ce7..000000000000 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_target_compute_sizes_operations.py +++ /dev/null @@ -1,146 +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, AsyncIterable, Callable, Dict, 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.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._serialization import Deserializer, Serializer -from ...operations._target_compute_sizes_operations import build_list_by_replication_protected_items_request -from .._configuration import SiteRecoveryManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class TargetComputeSizesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicessiterecovery.aio.SiteRecoveryManagementClient`'s - :attr:`target_compute_sizes` 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: SiteRecoveryManagementClientConfiguration = ( - 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_replication_protected_items( - self, fabric_name: str, protection_container_name: str, replicated_protected_item_name: str, **kwargs: Any - ) -> AsyncIterable["_models.TargetComputeSize"]: - """Gets the list of target compute sizes for the replication protected item. - - Lists the available target compute sizes for a replication protected item. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. Required. - :type replicated_protected_item_name: str - :return: An iterator like instance of either TargetComputeSize or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.TargetComputeSize] - :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.TargetComputeSizeCollection] = 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_replication_protected_items_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replicated_protected_item_name=replicated_protected_item_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("TargetComputeSizeCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/models/__init__.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/models/__init__.py index c53ac6712464..cdf6ad57e84e 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/models/__init__.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/models/__init__.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. # -------------------------------------------------------------------------- # pylint: disable=wrong-import-position @@ -14,8 +14,9 @@ from ._patch import * # pylint: disable=unused-wildcard-import -from ._models_py3 import ( # type: ignore +from ._models import ( # type: ignore A2AAddDisksInput, + A2AAgentReinstallBlockingErrorDetails, A2AApplyClusterRecoveryPointInput, A2AApplyRecoveryPointInput, A2AClusterRecoveryPointDetails, @@ -71,11 +72,8 @@ AgentDetails, AgentDiskDetails, Alert, - AlertCollection, AlertProperties, - ApplianceCollection, ApplianceMonitoringDetails, - ApplianceQueryParameter, ApplianceResourceDetails, ApplianceSpecificDetails, ApplyClusterRecoveryPointInput, @@ -96,7 +94,6 @@ ClusterFailoverJobDetails, ClusterProviderSpecificRecoveryPointDetails, ClusterRecoveryPoint, - ClusterRecoveryPointCollection, ClusterRecoveryPointProperties, ClusterSwitchProtectionJobDetails, ClusterTestFailoverCleanupInput, @@ -153,10 +150,8 @@ ErrorDetail, ErrorResponse, Event, - EventCollection, EventProperties, EventProviderSpecificDetails, - EventQueryParameter, EventSpecificDetails, ExistingProtectionProfile, ExistingRecoveryAvailabilitySet, @@ -167,11 +162,9 @@ ExportJobDetails, ExtendedLocation, Fabric, - FabricCollection, FabricCreationInput, FabricCreationInputProperties, FabricProperties, - FabricQueryParameter, FabricReplicationGroupTaskDetails, FabricSpecificCreateNetworkMappingInput, FabricSpecificCreationInput, @@ -246,6 +239,7 @@ InMagePolicyInput, InMageProtectedDiskDetails, InMageRcmAddDisksInput, + InMageRcmAgentReinstallBlockingErrorDetails, InMageRcmAgentUpgradeBlockingErrorDetails, InMageRcmApplianceDetails, InMageRcmApplianceSpecificDetails, @@ -298,7 +292,6 @@ InnerHealthError, InputEndpoint, Job, - JobCollection, JobDetails, JobEntity, JobErrorDetails, @@ -308,7 +301,6 @@ JobTaskDetails, KeyEncryptionKeyInfo, LogicalNetwork, - LogicalNetworkCollection, LogicalNetworkProperties, ManagedRunCommandScriptInput, ManualActionTaskDetails, @@ -318,18 +310,13 @@ MigrateInputProperties, MigrateProviderSpecificInput, MigrationItem, - MigrationItemCollection, MigrationItemProperties, - MigrationItemsQueryParameter, MigrationProviderSpecificSettings, MigrationRecoveryPoint, - MigrationRecoveryPointCollection, MigrationRecoveryPointProperties, MobilityServiceUpdate, Network, - NetworkCollection, NetworkMapping, - NetworkMappingCollection, NetworkMappingFabricSpecificSettings, NetworkMappingProperties, NetworkProperties, @@ -340,36 +327,29 @@ OSUpgradeSupportedVersions, OSVersionWrapper, OperationsDiscovery, - OperationsDiscoveryCollection, PauseReplicationInput, PauseReplicationInputProperties, PlannedFailoverInput, PlannedFailoverInputProperties, PlannedFailoverProviderSpecificFailoverInput, Policy, - PolicyCollection, PolicyProperties, PolicyProviderSpecificDetails, PolicyProviderSpecificInput, ProcessServer, ProcessServerDetails, ProtectableItem, - ProtectableItemCollection, ProtectableItemProperties, - ProtectableItemQueryParameter, - ProtectedClustersQueryParameter, - ProtectedItemsQueryParameter, ProtectionContainer, - ProtectionContainerCollection, ProtectionContainerFabricSpecificDetails, ProtectionContainerMapping, - ProtectionContainerMappingCollection, ProtectionContainerMappingProperties, ProtectionContainerMappingProviderSpecificDetails, ProtectionContainerProperties, ProtectionProfileCustomDetails, ProviderError, ProviderSpecificRecoveryPointDetails, + ProxyResource, PushInstallerDetails, RcmProxyDetails, RecoveryAvailabilitySetCustomDetails, @@ -380,7 +360,6 @@ RecoveryPlanAction, RecoveryPlanActionDetails, RecoveryPlanAutomationRunbookActionDetails, - RecoveryPlanCollection, RecoveryPlanGroup, RecoveryPlanGroupTaskDetails, RecoveryPlanHyperVReplicaAzureFailbackInput, @@ -406,15 +385,15 @@ RecoveryPlanUnplannedFailoverInput, RecoveryPlanUnplannedFailoverInputProperties, RecoveryPoint, - RecoveryPointCollection, RecoveryPointProperties, RecoveryProximityPlacementGroupCustomDetails, RecoveryResourceGroupCustomDetails, RecoveryServicesProvider, - RecoveryServicesProviderCollection, RecoveryServicesProviderProperties, RecoveryVirtualNetworkCustomDetails, RegisteredClusterNodes, + ReinstallMobilityServiceRequest, + ReinstallMobilityServiceRequestProperties, RemoveDisksInput, RemoveDisksInputProperties, RemoveDisksProviderSpecificInput, @@ -432,13 +411,10 @@ ReplicationEligibilityResultsProperties, ReplicationGroupDetails, ReplicationProtectedItem, - ReplicationProtectedItemCollection, ReplicationProtectedItemProperties, ReplicationProtectionCluster, - ReplicationProtectionClusterCollection, ReplicationProtectionClusterProperties, ReplicationProtectionIntent, - ReplicationProtectionIntentCollection, ReplicationProtectionIntentProperties, ReplicationProtectionIntentProviderSpecificSettings, ReplicationProviderContainerUnmappingInput, @@ -464,7 +440,6 @@ ReverseReplicationInput, ReverseReplicationInputProperties, ReverseReplicationProviderSpecificInput, - RoleAssignment, RunAsAccount, ScriptActionTaskDetails, SecurityProfileProperties, @@ -473,9 +448,7 @@ SharedDiskReplicationProviderSpecificSettings, StorageAccountCustomDetails, StorageClassification, - StorageClassificationCollection, StorageClassificationMapping, - StorageClassificationMappingCollection, StorageClassificationMappingInput, StorageClassificationMappingProperties, StorageClassificationProperties, @@ -495,8 +468,8 @@ SwitchProviderInput, SwitchProviderInputProperties, SwitchProviderSpecificInput, + SystemData, TargetComputeSize, - TargetComputeSizeCollection, TargetComputeSizeProperties, TaskTypeDetails, TestFailoverCleanupInput, @@ -537,7 +510,6 @@ UpdateVCenterRequestProperties, UserCreatedResourceTag, VCenter, - VCenterCollection, VCenterProperties, VMNicDetails, VMNicInputDetails, @@ -566,7 +538,6 @@ VaultHealthDetails, VaultHealthProperties, VaultSetting, - VaultSettingCollection, VaultSettingCreationInput, VaultSettingCreationInputProperties, VaultSettingProperties, @@ -584,10 +555,11 @@ VmwareCbtPolicyDetails, ) -from ._site_recovery_management_client_enums import ( # type: ignore +from ._enums import ( # type: ignore A2ARecoveryAvailabilityType, A2ARpRecoveryPointType, AgentAutoUpdateStatus, + AgentReinstallBlockedReason, AgentUpgradeBlockedReason, AgentVersionStatus, AlternateLocationRecoveryOption, @@ -595,6 +567,7 @@ AutomationAccountAuthenticationType, ChurnOptionSelected, ClusterRecoveryPointType, + CreatedByType, DataSyncStatus, DisableProtectionReason, DiskAccountType, @@ -615,6 +588,7 @@ MigrationItemOperation, MigrationRecoveryPointType, MigrationState, + MobilityAgentReinstallType, MobilityAgentUpgradeState, MultiVmGroupCreateOption, MultiVmSyncPointOption, @@ -647,6 +621,7 @@ __all__ = [ "A2AAddDisksInput", + "A2AAgentReinstallBlockingErrorDetails", "A2AApplyClusterRecoveryPointInput", "A2AApplyRecoveryPointInput", "A2AClusterRecoveryPointDetails", @@ -702,11 +677,8 @@ "AgentDetails", "AgentDiskDetails", "Alert", - "AlertCollection", "AlertProperties", - "ApplianceCollection", "ApplianceMonitoringDetails", - "ApplianceQueryParameter", "ApplianceResourceDetails", "ApplianceSpecificDetails", "ApplyClusterRecoveryPointInput", @@ -727,7 +699,6 @@ "ClusterFailoverJobDetails", "ClusterProviderSpecificRecoveryPointDetails", "ClusterRecoveryPoint", - "ClusterRecoveryPointCollection", "ClusterRecoveryPointProperties", "ClusterSwitchProtectionJobDetails", "ClusterTestFailoverCleanupInput", @@ -784,10 +755,8 @@ "ErrorDetail", "ErrorResponse", "Event", - "EventCollection", "EventProperties", "EventProviderSpecificDetails", - "EventQueryParameter", "EventSpecificDetails", "ExistingProtectionProfile", "ExistingRecoveryAvailabilitySet", @@ -798,11 +767,9 @@ "ExportJobDetails", "ExtendedLocation", "Fabric", - "FabricCollection", "FabricCreationInput", "FabricCreationInputProperties", "FabricProperties", - "FabricQueryParameter", "FabricReplicationGroupTaskDetails", "FabricSpecificCreateNetworkMappingInput", "FabricSpecificCreationInput", @@ -877,6 +844,7 @@ "InMagePolicyInput", "InMageProtectedDiskDetails", "InMageRcmAddDisksInput", + "InMageRcmAgentReinstallBlockingErrorDetails", "InMageRcmAgentUpgradeBlockingErrorDetails", "InMageRcmApplianceDetails", "InMageRcmApplianceSpecificDetails", @@ -929,7 +897,6 @@ "InnerHealthError", "InputEndpoint", "Job", - "JobCollection", "JobDetails", "JobEntity", "JobErrorDetails", @@ -939,7 +906,6 @@ "JobTaskDetails", "KeyEncryptionKeyInfo", "LogicalNetwork", - "LogicalNetworkCollection", "LogicalNetworkProperties", "ManagedRunCommandScriptInput", "ManualActionTaskDetails", @@ -949,18 +915,13 @@ "MigrateInputProperties", "MigrateProviderSpecificInput", "MigrationItem", - "MigrationItemCollection", "MigrationItemProperties", - "MigrationItemsQueryParameter", "MigrationProviderSpecificSettings", "MigrationRecoveryPoint", - "MigrationRecoveryPointCollection", "MigrationRecoveryPointProperties", "MobilityServiceUpdate", "Network", - "NetworkCollection", "NetworkMapping", - "NetworkMappingCollection", "NetworkMappingFabricSpecificSettings", "NetworkMappingProperties", "NetworkProperties", @@ -971,36 +932,29 @@ "OSUpgradeSupportedVersions", "OSVersionWrapper", "OperationsDiscovery", - "OperationsDiscoveryCollection", "PauseReplicationInput", "PauseReplicationInputProperties", "PlannedFailoverInput", "PlannedFailoverInputProperties", "PlannedFailoverProviderSpecificFailoverInput", "Policy", - "PolicyCollection", "PolicyProperties", "PolicyProviderSpecificDetails", "PolicyProviderSpecificInput", "ProcessServer", "ProcessServerDetails", "ProtectableItem", - "ProtectableItemCollection", "ProtectableItemProperties", - "ProtectableItemQueryParameter", - "ProtectedClustersQueryParameter", - "ProtectedItemsQueryParameter", "ProtectionContainer", - "ProtectionContainerCollection", "ProtectionContainerFabricSpecificDetails", "ProtectionContainerMapping", - "ProtectionContainerMappingCollection", "ProtectionContainerMappingProperties", "ProtectionContainerMappingProviderSpecificDetails", "ProtectionContainerProperties", "ProtectionProfileCustomDetails", "ProviderError", "ProviderSpecificRecoveryPointDetails", + "ProxyResource", "PushInstallerDetails", "RcmProxyDetails", "RecoveryAvailabilitySetCustomDetails", @@ -1011,7 +965,6 @@ "RecoveryPlanAction", "RecoveryPlanActionDetails", "RecoveryPlanAutomationRunbookActionDetails", - "RecoveryPlanCollection", "RecoveryPlanGroup", "RecoveryPlanGroupTaskDetails", "RecoveryPlanHyperVReplicaAzureFailbackInput", @@ -1037,15 +990,15 @@ "RecoveryPlanUnplannedFailoverInput", "RecoveryPlanUnplannedFailoverInputProperties", "RecoveryPoint", - "RecoveryPointCollection", "RecoveryPointProperties", "RecoveryProximityPlacementGroupCustomDetails", "RecoveryResourceGroupCustomDetails", "RecoveryServicesProvider", - "RecoveryServicesProviderCollection", "RecoveryServicesProviderProperties", "RecoveryVirtualNetworkCustomDetails", "RegisteredClusterNodes", + "ReinstallMobilityServiceRequest", + "ReinstallMobilityServiceRequestProperties", "RemoveDisksInput", "RemoveDisksInputProperties", "RemoveDisksProviderSpecificInput", @@ -1063,13 +1016,10 @@ "ReplicationEligibilityResultsProperties", "ReplicationGroupDetails", "ReplicationProtectedItem", - "ReplicationProtectedItemCollection", "ReplicationProtectedItemProperties", "ReplicationProtectionCluster", - "ReplicationProtectionClusterCollection", "ReplicationProtectionClusterProperties", "ReplicationProtectionIntent", - "ReplicationProtectionIntentCollection", "ReplicationProtectionIntentProperties", "ReplicationProtectionIntentProviderSpecificSettings", "ReplicationProviderContainerUnmappingInput", @@ -1095,7 +1045,6 @@ "ReverseReplicationInput", "ReverseReplicationInputProperties", "ReverseReplicationProviderSpecificInput", - "RoleAssignment", "RunAsAccount", "ScriptActionTaskDetails", "SecurityProfileProperties", @@ -1104,9 +1053,7 @@ "SharedDiskReplicationProviderSpecificSettings", "StorageAccountCustomDetails", "StorageClassification", - "StorageClassificationCollection", "StorageClassificationMapping", - "StorageClassificationMappingCollection", "StorageClassificationMappingInput", "StorageClassificationMappingProperties", "StorageClassificationProperties", @@ -1126,8 +1073,8 @@ "SwitchProviderInput", "SwitchProviderInputProperties", "SwitchProviderSpecificInput", + "SystemData", "TargetComputeSize", - "TargetComputeSizeCollection", "TargetComputeSizeProperties", "TaskTypeDetails", "TestFailoverCleanupInput", @@ -1168,7 +1115,6 @@ "UpdateVCenterRequestProperties", "UserCreatedResourceTag", "VCenter", - "VCenterCollection", "VCenterProperties", "VMNicDetails", "VMNicInputDetails", @@ -1197,7 +1143,6 @@ "VaultHealthDetails", "VaultHealthProperties", "VaultSetting", - "VaultSettingCollection", "VaultSettingCreationInput", "VaultSettingCreationInputProperties", "VaultSettingProperties", @@ -1216,6 +1161,7 @@ "A2ARecoveryAvailabilityType", "A2ARpRecoveryPointType", "AgentAutoUpdateStatus", + "AgentReinstallBlockedReason", "AgentUpgradeBlockedReason", "AgentVersionStatus", "AlternateLocationRecoveryOption", @@ -1223,6 +1169,7 @@ "AutomationAccountAuthenticationType", "ChurnOptionSelected", "ClusterRecoveryPointType", + "CreatedByType", "DataSyncStatus", "DisableProtectionReason", "DiskAccountType", @@ -1243,6 +1190,7 @@ "MigrationItemOperation", "MigrationRecoveryPointType", "MigrationState", + "MobilityAgentReinstallType", "MobilityAgentUpgradeState", "MultiVmGroupCreateOption", "MultiVmSyncPointOption", diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/models/_site_recovery_management_client_enums.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/models/_enums.py similarity index 69% rename from sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/models/_site_recovery_management_client_enums.py rename to sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/models/_enums.py index 9f7c81b92e4e..93d714538390 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/models/_site_recovery_management_client_enums.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/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,291 +14,457 @@ class A2ARecoveryAvailabilityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The recovery availability type of the virtual machine.""" SINGLE = "Single" + """Single.""" AVAILABILITY_SET = "AvailabilitySet" + """AvailabilitySet.""" AVAILABILITY_ZONE = "AvailabilityZone" + """AvailabilityZone.""" class A2ARpRecoveryPointType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The recovery point type.""" LATEST = "Latest" + """Latest.""" LATEST_APPLICATION_CONSISTENT = "LatestApplicationConsistent" + """LatestApplicationConsistent.""" LATEST_CRASH_CONSISTENT = "LatestCrashConsistent" + """LatestCrashConsistent.""" LATEST_PROCESSED = "LatestProcessed" + """LatestProcessed.""" class AgentAutoUpdateStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """A value indicating whether the auto update is enabled.""" DISABLED = "Disabled" + """Disabled.""" ENABLED = "Enabled" + """Enabled.""" + + +class AgentReinstallBlockedReason(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of AgentReinstallBlockedReason.""" + + DISTRO_NOT_SUPPORTED = "DistroNotSupported" + """DistroNotSupported.""" + AGENT_NO_HEARTBEAT = "AgentNoHeartbeat" + """AgentNoHeartbeat.""" + UNKNOWN = "Unknown" + """Unknown.""" class AgentUpgradeBlockedReason(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """AgentUpgradeBlockedReason.""" + """Type of AgentUpgradeBlockedReason.""" ALREADY_ON_LATEST_VERSION = "AlreadyOnLatestVersion" + """AlreadyOnLatestVersion.""" REBOOT_REQUIRED = "RebootRequired" + """RebootRequired.""" AGENT_NO_HEARTBEAT = "AgentNoHeartbeat" + """AgentNoHeartbeat.""" RCM_PROXY_NO_HEARTBEAT = "RcmProxyNoHeartbeat" + """RcmProxyNoHeartbeat.""" PROCESS_SERVER_NO_HEARTBEAT = "ProcessServerNoHeartbeat" + """ProcessServerNoHeartbeat.""" INCOMPATIBLE_APPLIANCE_VERSION = "IncompatibleApplianceVersion" + """IncompatibleApplianceVersion.""" NOT_PROTECTED = "NotProtected" + """NotProtected.""" UNSUPPORTED_PROTECTION_SCENARIO = "UnsupportedProtectionScenario" + """UnsupportedProtectionScenario.""" DISTRO_IS_NOT_REPORTED = "DistroIsNotReported" + """DistroIsNotReported.""" DISTRO_NOT_SUPPORTED_FOR_UPGRADE = "DistroNotSupportedForUpgrade" + """DistroNotSupportedForUpgrade.""" MISSING_UPGRADE_PATH = "MissingUpgradePath" + """MissingUpgradePath.""" INVALID_AGENT_VERSION = "InvalidAgentVersion" + """InvalidAgentVersion.""" INVALID_DRIVER_VERSION = "InvalidDriverVersion" + """InvalidDriverVersion.""" + RE_INSTALL_REQUIRED = "ReInstallRequired" + """ReInstallRequired.""" UNKNOWN = "Unknown" + """Unknown.""" class AgentVersionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """A value indicating whether security update required.""" SUPPORTED = "Supported" + """Supported.""" NOT_SUPPORTED = "NotSupported" + """NotSupported.""" DEPRECATED = "Deprecated" + """Deprecated.""" UPDATE_REQUIRED = "UpdateRequired" + """UpdateRequired.""" SECURITY_UPDATE_REQUIRED = "SecurityUpdateRequired" + """SecurityUpdateRequired.""" class AlternateLocationRecoveryOption(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The ALR option.""" CREATE_VM_IF_NOT_FOUND = "CreateVmIfNotFound" + """CreateVmIfNotFound.""" NO_ACTION = "NoAction" + """NoAction.""" class AutomationAccountAuthenticationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """A value indicating the type authentication to use for automation Account.""" RUN_AS_ACCOUNT = "RunAsAccount" + """RunAsAccount.""" SYSTEM_ASSIGNED_IDENTITY = "SystemAssignedIdentity" + """SystemAssignedIdentity.""" class AutoProtectionOfDataDisk(str, Enum, metaclass=CaseInsensitiveEnumMeta): """A value indicating whether the auto protection is enabled.""" DISABLED = "Disabled" + """Disabled.""" ENABLED = "Enabled" + """Enabled.""" class ChurnOptionSelected(str, Enum, metaclass=CaseInsensitiveEnumMeta): """A value indicating the churn option selected by user.""" NORMAL = "Normal" + """Normal.""" HIGH = "High" + """High.""" class ClusterRecoveryPointType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The recovery point type.""" NOT_SPECIFIED = "NotSpecified" + """NotSpecified.""" APPLICATION_CONSISTENT = "ApplicationConsistent" + """ApplicationConsistent.""" CRASH_CONSISTENT = "CrashConsistent" + """CrashConsistent.""" + + +class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """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 DataSyncStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The data sync option.""" FOR_DOWN_TIME = "ForDownTime" + """ForDownTime.""" FOR_SYNCHRONIZATION = "ForSynchronization" + """ForSynchronization.""" class DisableProtectionReason(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Disable protection reason. It can have values NotSpecified/MigrationComplete.""" NOT_SPECIFIED = "NotSpecified" + """NotSpecified.""" MIGRATION_COMPLETE = "MigrationComplete" + """MigrationComplete.""" class DiskAccountType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The disk type.""" STANDARD_LRS = "Standard_LRS" + """Standard_LRS.""" PREMIUM_LRS = "Premium_LRS" + """Premium_LRS.""" STANDARD_SSD_LRS = "StandardSSD_LRS" + """StandardSSD_LRS.""" PREMIUM_V2_LRS = "PremiumV2_LRS" + """PremiumV2_LRS.""" ULTRA_SSD_LRS = "UltraSSD_LRS" + """UltraSSD_LRS.""" STANDARD_SSD_ZRS = "StandardSSD_ZRS" + """StandardSSD_ZRS.""" PREMIUM_ZRS = "Premium_ZRS" + """Premium_ZRS.""" class DiskReplicationProgressHealth(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The progress health.""" NONE = "None" + """None.""" IN_PROGRESS = "InProgress" + """InProgress.""" SLOW_PROGRESS = "SlowProgress" + """SlowProgress.""" NO_PROGRESS = "NoProgress" + """NoProgress.""" QUEUED = "Queued" + """Queued.""" class DiskState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The disk state.""" UNAVAILABLE = "Unavailable" + """Unavailable.""" INITIAL_REPLICATION_PENDING = "InitialReplicationPending" + """InitialReplicationPending.""" INITIAL_REPLICATION_FAILED = "InitialReplicationFailed" + """InitialReplicationFailed.""" PROTECTED = "Protected" + """Protected.""" class EthernetAddressType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The source IP address type.""" DYNAMIC = "Dynamic" + """Dynamic.""" STATIC = "Static" + """Static.""" class ExportJobOutputSerializationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The output type of the jobs.""" JSON = "Json" + """Json.""" XML = "Xml" + """Xml.""" EXCEL = "Excel" + """Excel.""" class ExtendedLocationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The extended location type.""" EDGE_ZONE = "EdgeZone" + """EdgeZone.""" class FailoverDeploymentModel(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The failover deployment model.""" NOT_APPLICABLE = "NotApplicable" + """NotApplicable.""" CLASSIC = "Classic" + """Classic.""" RESOURCE_MANAGER = "ResourceManager" + """ResourceManager.""" class FailoverDirection(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Failover direction.""" PRIMARY_TO_RECOVERY = "PrimaryToRecovery" + """PrimaryToRecovery.""" RECOVERY_TO_PRIMARY = "RecoveryToPrimary" + """RecoveryToPrimary.""" class HealthErrorCategory(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The category of the health error.""" NONE = "None" + """None.""" REPLICATION = "Replication" + """Replication.""" TEST_FAILOVER = "TestFailover" + """TestFailover.""" CONFIGURATION = "Configuration" + """Configuration.""" FABRIC_INFRASTRUCTURE = "FabricInfrastructure" + """FabricInfrastructure.""" VERSION_EXPIRY = "VersionExpiry" + """VersionExpiry.""" AGENT_AUTO_UPDATE_INFRA = "AgentAutoUpdateInfra" + """AgentAutoUpdateInfra.""" AGENT_AUTO_UPDATE_ARTIFACT_DELETED = "AgentAutoUpdateArtifactDeleted" + """AgentAutoUpdateArtifactDeleted.""" AGENT_AUTO_UPDATE_RUN_AS_ACCOUNT = "AgentAutoUpdateRunAsAccount" + """AgentAutoUpdateRunAsAccount.""" AGENT_AUTO_UPDATE_RUN_AS_ACCOUNT_EXPIRY = "AgentAutoUpdateRunAsAccountExpiry" + """AgentAutoUpdateRunAsAccountExpiry.""" AGENT_AUTO_UPDATE_RUN_AS_ACCOUNT_EXPIRED = "AgentAutoUpdateRunAsAccountExpired" + """AgentAutoUpdateRunAsAccountExpired.""" class HealthErrorCustomerResolvability(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Value indicating whether the health error is customer resolvable.""" ALLOWED = "Allowed" + """Allowed.""" NOT_ALLOWED = "NotAllowed" + """NotAllowed.""" class HyperVReplicaAzureRpRecoveryPointType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The recovery point type.""" LATEST = "Latest" + """Latest.""" LATEST_APPLICATION_CONSISTENT = "LatestApplicationConsistent" + """LatestApplicationConsistent.""" LATEST_PROCESSED = "LatestProcessed" + """LatestProcessed.""" class InMageRcmFailbackRecoveryPointType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The recovery point type.""" APPLICATION_CONSISTENT = "ApplicationConsistent" + """ApplicationConsistent.""" CRASH_CONSISTENT = "CrashConsistent" + """CrashConsistent.""" class InMageV2RpRecoveryPointType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The recovery point type.""" LATEST = "Latest" + """Latest.""" LATEST_APPLICATION_CONSISTENT = "LatestApplicationConsistent" + """LatestApplicationConsistent.""" LATEST_CRASH_CONSISTENT = "LatestCrashConsistent" + """LatestCrashConsistent.""" LATEST_PROCESSED = "LatestProcessed" + """LatestProcessed.""" class LicenseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """License type.""" NOT_SPECIFIED = "NotSpecified" + """NotSpecified.""" NO_LICENSE_TYPE = "NoLicenseType" + """NoLicenseType.""" WINDOWS_SERVER = "WindowsServer" + """WindowsServer.""" class LinuxLicenseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The license type for Linux VM's.""" NOT_SPECIFIED = "NotSpecified" + """NotSpecified.""" NO_LICENSE_TYPE = "NoLicenseType" + """NoLicenseType.""" LINUX_SERVER = "LinuxServer" + """LinuxServer.""" class MigrationItemOperation(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """MigrationItemOperation.""" + """The allowed operations on the migration item based on the current migration state of the item.""" DISABLE_MIGRATION = "DisableMigration" + """DisableMigration.""" TEST_MIGRATE = "TestMigrate" + """TestMigrate.""" TEST_MIGRATE_CLEANUP = "TestMigrateCleanup" + """TestMigrateCleanup.""" MIGRATE = "Migrate" + """Migrate.""" START_RESYNC = "StartResync" + """StartResync.""" PAUSE_REPLICATION = "PauseReplication" + """PauseReplication.""" RESUME_REPLICATION = "ResumeReplication" + """ResumeReplication.""" class MigrationRecoveryPointType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The recovery point type.""" NOT_SPECIFIED = "NotSpecified" + """NotSpecified.""" APPLICATION_CONSISTENT = "ApplicationConsistent" + """ApplicationConsistent.""" CRASH_CONSISTENT = "CrashConsistent" + """CrashConsistent.""" class MigrationState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The migration status.""" NONE = "None" + """None.""" ENABLE_MIGRATION_IN_PROGRESS = "EnableMigrationInProgress" + """EnableMigrationInProgress.""" ENABLE_MIGRATION_FAILED = "EnableMigrationFailed" + """EnableMigrationFailed.""" DISABLE_MIGRATION_IN_PROGRESS = "DisableMigrationInProgress" + """DisableMigrationInProgress.""" DISABLE_MIGRATION_FAILED = "DisableMigrationFailed" + """DisableMigrationFailed.""" INITIAL_SEEDING_IN_PROGRESS = "InitialSeedingInProgress" + """InitialSeedingInProgress.""" INITIAL_SEEDING_FAILED = "InitialSeedingFailed" + """InitialSeedingFailed.""" REPLICATING = "Replicating" + """Replicating.""" MIGRATION_IN_PROGRESS = "MigrationInProgress" + """MigrationInProgress.""" MIGRATION_SUCCEEDED = "MigrationSucceeded" + """MigrationSucceeded.""" MIGRATION_FAILED = "MigrationFailed" + """MigrationFailed.""" RESUME_IN_PROGRESS = "ResumeInProgress" + """ResumeInProgress.""" RESUME_INITIATED = "ResumeInitiated" + """ResumeInitiated.""" SUSPENDING_PROTECTION = "SuspendingProtection" + """SuspendingProtection.""" PROTECTION_SUSPENDED = "ProtectionSuspended" + """ProtectionSuspended.""" MIGRATION_COMPLETED_WITH_INFORMATION = "MigrationCompletedWithInformation" + """MigrationCompletedWithInformation.""" MIGRATION_PARTIALLY_SUCCEEDED = "MigrationPartiallySucceeded" + """MigrationPartiallySucceeded.""" + + +class MobilityAgentReinstallType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of MobilityAgentReinstallType.""" + + USER_TRIGGERED = "UserTriggered" + """UserTriggered.""" + AUTO_TRIGGERED = "AutoTriggered" + """AutoTriggered.""" class MobilityAgentUpgradeState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The agent auto upgrade state.""" NONE = "None" + """None.""" STARTED = "Started" + """Started.""" COMPLETED = "Completed" + """Completed.""" COMMIT = "Commit" + """Commit.""" class MultiVmGroupCreateOption(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Whether Multi VM group is auto created or specified by user.""" AUTO_CREATED = "AutoCreated" + """AutoCreated.""" USER_SPECIFIED = "UserSpecified" + """UserSpecified.""" class MultiVmSyncPointOption(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -307,23 +473,31 @@ class MultiVmSyncPointOption(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ USE_MULTI_VM_SYNC_RECOVERY_POINT = "UseMultiVmSyncRecoveryPoint" + """UseMultiVmSyncRecoveryPoint.""" USE_PER_VM_RECOVERY_POINT = "UsePerVmRecoveryPoint" + """UsePerVmRecoveryPoint.""" class PlannedFailoverStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The last planned failover status.""" SUCCEEDED = "Succeeded" + """Succeeded.""" FAILED = "Failed" + """Failed.""" CANCELLED = "Cancelled" + """Cancelled.""" UNKNOWN = "Unknown" + """Unknown.""" class PossibleOperationsDirections(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """PossibleOperationsDirections.""" + """The failover direction.""" PRIMARY_TO_RECOVERY = "PrimaryToRecovery" + """PrimaryToRecovery.""" RECOVERY_TO_PRIMARY = "RecoveryToPrimary" + """RecoveryToPrimary.""" class PresenceStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -332,57 +506,79 @@ class PresenceStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ UNKNOWN = "Unknown" + """Unknown.""" PRESENT = "Present" + """Present.""" NOT_PRESENT = "NotPresent" + """NotPresent.""" class ProtectionHealth(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The health.""" NONE = "None" + """None.""" NORMAL = "Normal" + """Normal.""" WARNING = "Warning" + """Warning.""" CRITICAL = "Critical" + """Critical.""" class RcmComponentStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The throughput status.""" HEALTHY = "Healthy" + """Healthy.""" WARNING = "Warning" + """Warning.""" CRITICAL = "Critical" + """Critical.""" UNKNOWN = "Unknown" + """Unknown.""" class RecoveryPlanActionLocation(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The fabric location.""" PRIMARY = "Primary" + """Primary.""" RECOVERY = "Recovery" + """Recovery.""" class RecoveryPlanGroupType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The group type.""" SHUTDOWN = "Shutdown" + """Shutdown.""" BOOT = "Boot" + """Boot.""" FAILOVER = "Failover" + """Failover.""" class RecoveryPlanPointType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The recovery point type.""" LATEST = "Latest" + """Latest.""" LATEST_APPLICATION_CONSISTENT = "LatestApplicationConsistent" + """LatestApplicationConsistent.""" LATEST_CRASH_CONSISTENT = "LatestCrashConsistent" + """LatestCrashConsistent.""" LATEST_PROCESSED = "LatestProcessed" + """LatestProcessed.""" class RecoveryPointSyncType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """A value indicating whether the recovery point is multi VM consistent.""" MULTI_VM_SYNC_RECOVERY_POINT = "MultiVmSyncRecoveryPoint" + """MultiVmSyncRecoveryPoint.""" PER_VM_RECOVERY_POINT = "PerVmRecoveryPoint" + """PerVmRecoveryPoint.""" class RecoveryPointType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -392,58 +588,86 @@ class RecoveryPointType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ LATEST_TIME = "LatestTime" + """LatestTime.""" LATEST_TAG = "LatestTag" + """LatestTag.""" CUSTOM = "Custom" + """Custom.""" class ReplicationProtectedItemOperation(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """ReplicationProtectedItemOperation.""" + """The list of failover types.""" REVERSE_REPLICATE = "ReverseReplicate" + """ReverseReplicate.""" COMMIT = "Commit" + """Commit.""" PLANNED_FAILOVER = "PlannedFailover" + """PlannedFailover.""" UNPLANNED_FAILOVER = "UnplannedFailover" + """UnplannedFailover.""" DISABLE_PROTECTION = "DisableProtection" + """DisableProtection.""" TEST_FAILOVER = "TestFailover" + """TestFailover.""" TEST_FAILOVER_CLEANUP = "TestFailoverCleanup" + """TestFailoverCleanup.""" FAILBACK = "Failback" + """Failback.""" FINALIZE_FAILBACK = "FinalizeFailback" + """FinalizeFailback.""" CANCEL_FAILOVER = "CancelFailover" + """CancelFailover.""" CHANGE_PIT = "ChangePit" + """ChangePit.""" REPAIR_REPLICATION = "RepairReplication" + """RepairReplication.""" SWITCH_PROTECTION = "SwitchProtection" + """SwitchProtection.""" COMPLETE_MIGRATION = "CompleteMigration" + """CompleteMigration.""" class ResyncState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The resync state.""" NONE = "None" + """None.""" PREPARED_FOR_RESYNCHRONIZATION = "PreparedForResynchronization" + """PreparedForResynchronization.""" STARTED_RESYNCHRONIZATION = "StartedResynchronization" + """StartedResynchronization.""" class RpInMageRecoveryPointType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The recovery point type.""" LATEST_TIME = "LatestTime" + """LatestTime.""" LATEST_TAG = "LatestTag" + """LatestTag.""" CUSTOM = "Custom" + """Custom.""" class SecurityConfiguration(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Security configuration state.""" DISABLED = "Disabled" + """Disabled.""" ENABLED = "Enabled" + """Enabled.""" class SecurityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The target VM security type.""" NONE = "None" + """None.""" TRUSTED_LAUNCH = "TrustedLaunch" + """TrustedLaunch.""" CONFIDENTIAL_VM = "ConfidentialVM" + """ConfidentialVM.""" class SetMultiVmSyncStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -452,58 +676,84 @@ class SetMultiVmSyncStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ ENABLE = "Enable" + """Enable.""" DISABLE = "Disable" + """Disable.""" class Severity(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Severity of error.""" NONE = "NONE" + """NONE.""" WARNING = "Warning" + """Warning.""" ERROR = "Error" + """Error.""" INFO = "Info" + """Info.""" class SourceSiteOperations(str, Enum, metaclass=CaseInsensitiveEnumMeta): """A value indicating whether source site operations are required.""" REQUIRED = "Required" + """Required.""" NOT_REQUIRED = "NotRequired" + """NotRequired.""" class SqlServerLicenseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The SQL Server license type.""" NOT_SPECIFIED = "NotSpecified" + """NotSpecified.""" NO_LICENSE_TYPE = "NoLicenseType" + """NoLicenseType.""" PAYG = "PAYG" + """PAYG.""" AHUB = "AHUB" + """AHUB.""" class TestMigrationState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The test migrate state.""" NONE = "None" + """None.""" TEST_MIGRATION_IN_PROGRESS = "TestMigrationInProgress" + """TestMigrationInProgress.""" TEST_MIGRATION_SUCCEEDED = "TestMigrationSucceeded" + """TestMigrationSucceeded.""" TEST_MIGRATION_FAILED = "TestMigrationFailed" + """TestMigrationFailed.""" TEST_MIGRATION_CLEANUP_IN_PROGRESS = "TestMigrationCleanupInProgress" + """TestMigrationCleanupInProgress.""" TEST_MIGRATION_COMPLETED_WITH_INFORMATION = "TestMigrationCompletedWithInformation" + """TestMigrationCompletedWithInformation.""" TEST_MIGRATION_PARTIALLY_SUCCEEDED = "TestMigrationPartiallySucceeded" + """TestMigrationPartiallySucceeded.""" class VmEncryptionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The encryption type of the VM.""" NOT_ENCRYPTED = "NotEncrypted" + """NotEncrypted.""" ONE_PASS_ENCRYPTED = "OnePassEncrypted" + """OnePassEncrypted.""" TWO_PASS_ENCRYPTED = "TwoPassEncrypted" + """TwoPassEncrypted.""" class VmReplicationProgressHealth(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The initial replication progress health.""" NONE = "None" + """None.""" IN_PROGRESS = "InProgress" + """InProgress.""" SLOW_PROGRESS = "SlowProgress" + """SlowProgress.""" NO_PROGRESS = "NoProgress" + """NoProgress.""" diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/models/_models.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/models/_models.py new file mode 100644 index 000000000000..de090a4a117e --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/models/_models.py @@ -0,0 +1,31364 @@ +# 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, Literal, Mapping, Optional, TYPE_CHECKING, Union, overload + +from .._utils.model_base import Model as _Model, rest_discriminator, rest_field + +if TYPE_CHECKING: + from .. import models as _models + + +class AddDisksProviderSpecificInput(_Model): + """Add Disks provider specific input. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + A2AAddDisksInput, InMageRcmAddDisksInput + + :ivar instance_type: The class type. Required. Default value is None. + :vartype instance_type: str + """ + + __mapping__: dict[str, _Model] = {} + instance_type: str = rest_discriminator( + name="instanceType", visibility=["read", "create", "update", "delete", "query"] + ) + """The class type. Required. Default value is None.""" + + @overload + def __init__( + self, + *, + instance_type: str, + ) -> 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 A2AAddDisksInput(AddDisksProviderSpecificInput, discriminator="A2A"): + """A2A add disk(s) input. + + :ivar vm_disks: The list of vm disk details. + :vartype vm_disks: list[~azure.mgmt.recoveryservicessiterecovery.models.A2AVmDiskInputDetails] + :ivar vm_managed_disks: The list of vm managed disk details. + :vartype vm_managed_disks: + list[~azure.mgmt.recoveryservicessiterecovery.models.A2AVmManagedDiskInputDetails] + :ivar instance_type: The class type. Required. Default value is "A2A". + :vartype instance_type: str + """ + + vm_disks: Optional[list["_models.A2AVmDiskInputDetails"]] = rest_field( + name="vmDisks", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of vm disk details.""" + vm_managed_disks: Optional[list["_models.A2AVmManagedDiskInputDetails"]] = rest_field( + name="vmManagedDisks", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of vm managed disk details.""" + instance_type: Literal["A2A"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The class type. Required. Default value is \"A2A\".""" + + @overload + def __init__( + self, + *, + vm_disks: Optional[list["_models.A2AVmDiskInputDetails"]] = None, + vm_managed_disks: Optional[list["_models.A2AVmManagedDiskInputDetails"]] = 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) + self.instance_type = "A2A" # type: ignore + + +class A2AAgentReinstallBlockingErrorDetails(_Model): + """A2A source agent reinstall blocking error details. + + :ivar error_code: error code. + :vartype error_code: str + :ivar error_message: error message. + :vartype error_message: str + :ivar possible_causes: possible causes. + :vartype possible_causes: str + :ivar recommended_action: recommended action. + :vartype recommended_action: str + :ivar error_message_parameters: error message parameters. + :vartype error_message_parameters: dict[str, str] + :ivar error_tags: error tags. + :vartype error_tags: dict[str, str] + """ + + error_code: Optional[str] = rest_field(name="errorCode", visibility=["read", "create", "update", "delete", "query"]) + """error code.""" + error_message: Optional[str] = rest_field( + name="errorMessage", visibility=["read", "create", "update", "delete", "query"] + ) + """error message.""" + possible_causes: Optional[str] = rest_field( + name="possibleCauses", visibility=["read", "create", "update", "delete", "query"] + ) + """possible causes.""" + recommended_action: Optional[str] = rest_field( + name="recommendedAction", visibility=["read", "create", "update", "delete", "query"] + ) + """recommended action.""" + error_message_parameters: Optional[dict[str, str]] = rest_field( + name="errorMessageParameters", visibility=["read", "create", "update", "delete", "query"] + ) + """error message parameters.""" + error_tags: Optional[dict[str, str]] = rest_field( + name="errorTags", visibility=["read", "create", "update", "delete", "query"] + ) + """error tags.""" + + @overload + def __init__( + self, + *, + error_code: Optional[str] = None, + error_message: Optional[str] = None, + possible_causes: Optional[str] = None, + recommended_action: Optional[str] = None, + error_message_parameters: Optional[dict[str, str]] = None, + error_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 ApplyClusterRecoveryPointProviderSpecificInput(_Model): # pylint: disable=name-too-long + """Provider specific input for apply cluster recovery point. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + A2AApplyClusterRecoveryPointInput + + :ivar instance_type: The class type. Required. Default value is None. + :vartype instance_type: str + """ + + __mapping__: dict[str, _Model] = {} + instance_type: str = rest_discriminator( + name="instanceType", visibility=["read", "create", "update", "delete", "query"] + ) + """The class type. Required. Default value is None.""" + + @overload + def __init__( + self, + *, + instance_type: str, + ) -> 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 A2AApplyClusterRecoveryPointInput(ApplyClusterRecoveryPointProviderSpecificInput, discriminator="A2A"): + """A2A provider specific input for apply cluster recovery point. + + :ivar instance_type: The class type. Required. Default value is "A2A". + :vartype instance_type: str + """ + + instance_type: Literal["A2A"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The class type. Required. Default value is \"A2A\".""" + + @overload + def __init__( + self, + ) -> 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) + self.instance_type = "A2A" # type: ignore + + +class ApplyRecoveryPointProviderSpecificInput(_Model): + """Provider specific input for apply recovery point. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + A2AApplyRecoveryPointInput, A2ACrossClusterMigrationApplyRecoveryPointInput, + HyperVReplicaAzureApplyRecoveryPointInput, InMageAzureV2ApplyRecoveryPointInput, + InMageRcmApplyRecoveryPointInput + + :ivar instance_type: The class type. Required. Default value is None. + :vartype instance_type: str + """ + + __mapping__: dict[str, _Model] = {} + instance_type: str = rest_discriminator( + name="instanceType", visibility=["read", "create", "update", "delete", "query"] + ) + """The class type. Required. Default value is None.""" + + @overload + def __init__( + self, + *, + instance_type: str, + ) -> 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 A2AApplyRecoveryPointInput(ApplyRecoveryPointProviderSpecificInput, discriminator="A2A"): + """ApplyRecoveryPoint input specific to A2A provider. + + :ivar instance_type: The class type. Required. Default value is "A2A". + :vartype instance_type: str + """ + + instance_type: Literal["A2A"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The class type. Required. Default value is \"A2A\".""" + + @overload + def __init__( + self, + ) -> 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) + self.instance_type = "A2A" # type: ignore + + +class ClusterProviderSpecificRecoveryPointDetails(_Model): # pylint: disable=name-too-long + """Replication provider specific cluster recovery point details. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + A2AClusterRecoveryPointDetails + + :ivar instance_type: Gets the provider type. Required. Default value is None. + :vartype instance_type: str + """ + + __mapping__: dict[str, _Model] = {} + instance_type: str = rest_discriminator(name="instanceType", visibility=["read"]) + """Gets the provider type. Required. Default value is None.""" + + @overload + def __init__( + self, + *, + instance_type: str, + ) -> 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 A2AClusterRecoveryPointDetails(ClusterProviderSpecificRecoveryPointDetails, discriminator="A2A"): + """A2A provider specific cluster recovery point details. + + :ivar recovery_point_sync_type: A value indicating whether the recovery point is multi VM + consistent. Known values are: "MultiVmSyncRecoveryPoint" and "PerVmRecoveryPoint". + :vartype recovery_point_sync_type: str or + ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPointSyncType + :ivar nodes: The list of nodes representing the cluster. + :vartype nodes: list[str] + :ivar instance_type: Gets the provider type. Required. Default value is "A2A". + :vartype instance_type: str + """ + + recovery_point_sync_type: Optional[Union[str, "_models.RecoveryPointSyncType"]] = rest_field( + name="recoveryPointSyncType", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether the recovery point is multi VM consistent. Known values are: + \"MultiVmSyncRecoveryPoint\" and \"PerVmRecoveryPoint\".""" + nodes: Optional[list[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The list of nodes representing the cluster.""" + instance_type: Literal["A2A"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets the provider type. Required. Default value is \"A2A\".""" + + @overload + def __init__( + self, + *, + recovery_point_sync_type: Optional[Union[str, "_models.RecoveryPointSyncType"]] = None, + nodes: 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) + self.instance_type = "A2A" # type: ignore + + +class ClusterTestFailoverProviderSpecificInput(_Model): + """Provider specific test cluster failover input. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + A2AClusterTestFailoverInput + + :ivar instance_type: The class type. Required. Default value is None. + :vartype instance_type: str + """ + + __mapping__: dict[str, _Model] = {} + instance_type: str = rest_discriminator( + name="instanceType", visibility=["read", "create", "update", "delete", "query"] + ) + """The class type. Required. Default value is None.""" + + @overload + def __init__( + self, + *, + instance_type: str, + ) -> 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 A2AClusterTestFailoverInput(ClusterTestFailoverProviderSpecificInput, discriminator="A2A"): + """A2A provider specific input for test cluster failover. + + :ivar cluster_recovery_point_id: The cluster recovery point id to be passed to failover to a + particular recovery point. + :vartype cluster_recovery_point_id: str + :ivar individual_node_recovery_points: The list of individual node recovery points. + :vartype individual_node_recovery_points: list[str] + :ivar instance_type: The class type. Required. Default value is "A2A". + :vartype instance_type: str + """ + + cluster_recovery_point_id: Optional[str] = rest_field( + name="clusterRecoveryPointId", visibility=["read", "create", "update", "delete", "query"] + ) + """The cluster recovery point id to be passed to failover to a particular recovery point.""" + individual_node_recovery_points: Optional[list[str]] = rest_field( + name="individualNodeRecoveryPoints", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of individual node recovery points.""" + instance_type: Literal["A2A"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The class type. Required. Default value is \"A2A\".""" + + @overload + def __init__( + self, + *, + cluster_recovery_point_id: Optional[str] = None, + individual_node_recovery_points: 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) + self.instance_type = "A2A" # type: ignore + + +class ClusterUnplannedFailoverProviderSpecificInput(_Model): # pylint: disable=name-too-long + """Provider specific unplanned cluster failover input. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + A2AClusterUnplannedFailoverInput + + :ivar instance_type: The class type. Required. Default value is None. + :vartype instance_type: str + """ + + __mapping__: dict[str, _Model] = {} + instance_type: str = rest_discriminator( + name="instanceType", visibility=["read", "create", "update", "delete", "query"] + ) + """The class type. Required. Default value is None.""" + + @overload + def __init__( + self, + *, + instance_type: str, + ) -> 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 A2AClusterUnplannedFailoverInput(ClusterUnplannedFailoverProviderSpecificInput, discriminator="A2A"): + """A2A provider specific input for unplanned cluster failover. + + :ivar cluster_recovery_point_id: The cluster recovery point id to be passed to failover to a + particular recovery point. + :vartype cluster_recovery_point_id: str + :ivar individual_node_recovery_points: The list of individual node recovery points. + :vartype individual_node_recovery_points: list[str] + :ivar instance_type: The class type. Required. Default value is "A2A". + :vartype instance_type: str + """ + + cluster_recovery_point_id: Optional[str] = rest_field( + name="clusterRecoveryPointId", visibility=["read", "create", "update", "delete", "query"] + ) + """The cluster recovery point id to be passed to failover to a particular recovery point.""" + individual_node_recovery_points: Optional[list[str]] = rest_field( + name="individualNodeRecoveryPoints", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of individual node recovery points.""" + instance_type: Literal["A2A"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The class type. Required. Default value is \"A2A\".""" + + @overload + def __init__( + self, + *, + cluster_recovery_point_id: Optional[str] = None, + individual_node_recovery_points: 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) + self.instance_type = "A2A" # type: ignore + + +class ReplicationProviderSpecificContainerCreationInput(_Model): # pylint: disable=name-too-long + """Provider specific input for container creation operation. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + A2AContainerCreationInput, A2ACrossClusterMigrationContainerCreationInput, + VMwareCbtContainerCreationInput + + :ivar instance_type: The class type. Required. Default value is None. + :vartype instance_type: str + """ + + __mapping__: dict[str, _Model] = {} + instance_type: str = rest_discriminator( + name="instanceType", visibility=["read", "create", "update", "delete", "query"] + ) + """The class type. Required. Default value is None.""" + + @overload + def __init__( + self, + *, + instance_type: str, + ) -> 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 A2AContainerCreationInput(ReplicationProviderSpecificContainerCreationInput, discriminator="A2A"): + """A2A cloud creation input. + + :ivar instance_type: The class type. Required. Default value is "A2A". + :vartype instance_type: str + """ + + instance_type: Literal["A2A"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The class type. Required. Default value is \"A2A\".""" + + @overload + def __init__( + self, + ) -> 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) + self.instance_type = "A2A" # type: ignore + + +class ReplicationProviderSpecificContainerMappingInput(_Model): # pylint: disable=name-too-long + """Provider specific input for pairing operations. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + A2AContainerMappingInput, VMwareCbtContainerMappingInput + + :ivar instance_type: The class type. Required. Default value is None. + :vartype instance_type: str + """ + + __mapping__: dict[str, _Model] = {} + instance_type: str = rest_discriminator( + name="instanceType", visibility=["read", "create", "update", "delete", "query"] + ) + """The class type. Required. Default value is None.""" + + @overload + def __init__( + self, + *, + instance_type: str, + ) -> 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 A2AContainerMappingInput(ReplicationProviderSpecificContainerMappingInput, discriminator="A2A"): + """A2A container mapping input. + + :ivar agent_auto_update_status: A value indicating whether the auto update is enabled. Known + values are: "Disabled" and "Enabled". + :vartype agent_auto_update_status: str or + ~azure.mgmt.recoveryservicessiterecovery.models.AgentAutoUpdateStatus + :ivar automation_account_arm_id: The automation account arm id. + :vartype automation_account_arm_id: str + :ivar automation_account_authentication_type: A value indicating the type authentication to use + for automation Account. Known values are: "RunAsAccount" and "SystemAssignedIdentity". + :vartype automation_account_authentication_type: str or + ~azure.mgmt.recoveryservicessiterecovery.models.AutomationAccountAuthenticationType + :ivar instance_type: The class type. Required. Default value is "A2A". + :vartype instance_type: str + """ + + agent_auto_update_status: Optional[Union[str, "_models.AgentAutoUpdateStatus"]] = rest_field( + name="agentAutoUpdateStatus", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether the auto update is enabled. Known values are: \"Disabled\" and + \"Enabled\".""" + automation_account_arm_id: Optional[str] = rest_field( + name="automationAccountArmId", visibility=["read", "create", "update", "delete", "query"] + ) + """The automation account arm id.""" + automation_account_authentication_type: Optional[Union[str, "_models.AutomationAccountAuthenticationType"]] = ( + rest_field( + name="automationAccountAuthenticationType", visibility=["read", "create", "update", "delete", "query"] + ) + ) + """A value indicating the type authentication to use for automation Account. Known values are: + \"RunAsAccount\" and \"SystemAssignedIdentity\".""" + instance_type: Literal["A2A"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The class type. Required. Default value is \"A2A\".""" + + @overload + def __init__( + self, + *, + agent_auto_update_status: Optional[Union[str, "_models.AgentAutoUpdateStatus"]] = None, + automation_account_arm_id: Optional[str] = None, + automation_account_authentication_type: Optional[ + Union[str, "_models.AutomationAccountAuthenticationType"] + ] = 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) + self.instance_type = "A2A" # type: ignore + + +class CreateProtectionIntentProviderSpecificDetails(_Model): # pylint: disable=name-too-long + """Create protection intent provider specific input. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + A2ACreateProtectionIntentInput + + :ivar instance_type: The class type. Required. Default value is None. + :vartype instance_type: str + """ + + __mapping__: dict[str, _Model] = {} + instance_type: str = rest_discriminator( + name="instanceType", visibility=["read", "create", "update", "delete", "query"] + ) + """The class type. Required. Default value is None.""" + + @overload + def __init__( + self, + *, + instance_type: str, + ) -> 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 A2ACreateProtectionIntentInput(CreateProtectionIntentProviderSpecificDetails, discriminator="A2A"): + """A2A create protection intent input. + + :ivar fabric_object_id: The fabric specific object Id of the virtual machine. Required. + :vartype fabric_object_id: str + :ivar primary_location: The primary location for the virtual machine. Required. + :vartype primary_location: str + :ivar recovery_location: The recovery location for the virtual machine. Required. + :vartype recovery_location: str + :ivar recovery_subscription_id: The recovery subscription Id of the virtual machine. Required. + :vartype recovery_subscription_id: str + :ivar recovery_availability_type: The recovery availability type of the virtual machine. + Required. Known values are: "Single", "AvailabilitySet", and "AvailabilityZone". + :vartype recovery_availability_type: str or + ~azure.mgmt.recoveryservicessiterecovery.models.A2ARecoveryAvailabilityType + :ivar protection_profile_custom_input: The protection profile custom inputs. + :vartype protection_profile_custom_input: + ~azure.mgmt.recoveryservicessiterecovery.models.ProtectionProfileCustomDetails + :ivar recovery_resource_group_id: The recovery resource group Id. Valid for V2 scenarios. + Required. + :vartype recovery_resource_group_id: str + :ivar primary_staging_storage_account_custom_input: The primary staging storage account input. + :vartype primary_staging_storage_account_custom_input: + ~azure.mgmt.recoveryservicessiterecovery.models.StorageAccountCustomDetails + :ivar recovery_availability_set_custom_input: The recovery availability set input. + :vartype recovery_availability_set_custom_input: + ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryAvailabilitySetCustomDetails + :ivar recovery_virtual_network_custom_input: The recovery virtual network input. + :vartype recovery_virtual_network_custom_input: + ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryVirtualNetworkCustomDetails + :ivar recovery_proximity_placement_group_custom_input: The recovery proximity placement group + custom input. + :vartype recovery_proximity_placement_group_custom_input: + ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryProximityPlacementGroupCustomDetails + :ivar auto_protection_of_data_disk: A value indicating whether the auto protection is enabled. + Known values are: "Disabled" and "Enabled". + :vartype auto_protection_of_data_disk: str or + ~azure.mgmt.recoveryservicessiterecovery.models.AutoProtectionOfDataDisk + :ivar vm_disks: The list of vm disk inputs. + :vartype vm_disks: + list[~azure.mgmt.recoveryservicessiterecovery.models.A2AProtectionIntentDiskInputDetails] + :ivar vm_managed_disks: The list of vm managed disk inputs. + :vartype vm_managed_disks: + list[~azure.mgmt.recoveryservicessiterecovery.models.A2AProtectionIntentManagedDiskInputDetails] + :ivar multi_vm_group_name: The multi vm group name. + :vartype multi_vm_group_name: str + :ivar multi_vm_group_id: The multi vm group id. + :vartype multi_vm_group_id: str + :ivar recovery_boot_diag_storage_account: The boot diagnostic storage account. + :vartype recovery_boot_diag_storage_account: + ~azure.mgmt.recoveryservicessiterecovery.models.StorageAccountCustomDetails + :ivar disk_encryption_info: The recovery disk encryption information (for two pass flows). + :vartype disk_encryption_info: + ~azure.mgmt.recoveryservicessiterecovery.models.DiskEncryptionInfo + :ivar recovery_availability_zone: The recovery availability zone. + :vartype recovery_availability_zone: str + :ivar agent_auto_update_status: A value indicating whether the auto update is enabled. Known + values are: "Disabled" and "Enabled". + :vartype agent_auto_update_status: str or + ~azure.mgmt.recoveryservicessiterecovery.models.AgentAutoUpdateStatus + :ivar automation_account_authentication_type: A value indicating the authentication type for + automation account. The default value is "RunAsAccount". Known values are: "RunAsAccount" and + "SystemAssignedIdentity". + :vartype automation_account_authentication_type: str or + ~azure.mgmt.recoveryservicessiterecovery.models.AutomationAccountAuthenticationType + :ivar automation_account_arm_id: The automation account arm id. + :vartype automation_account_arm_id: str + :ivar instance_type: The class type. Required. Default value is "A2A". + :vartype instance_type: str + """ + + fabric_object_id: str = rest_field( + name="fabricObjectId", visibility=["read", "create", "update", "delete", "query"] + ) + """The fabric specific object Id of the virtual machine. Required.""" + primary_location: str = rest_field( + name="primaryLocation", visibility=["read", "create", "update", "delete", "query"] + ) + """The primary location for the virtual machine. Required.""" + recovery_location: str = rest_field( + name="recoveryLocation", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery location for the virtual machine. Required.""" + recovery_subscription_id: str = rest_field( + name="recoverySubscriptionId", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery subscription Id of the virtual machine. Required.""" + recovery_availability_type: Union[str, "_models.A2ARecoveryAvailabilityType"] = rest_field( + name="recoveryAvailabilityType", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery availability type of the virtual machine. Required. Known values are: \"Single\", + \"AvailabilitySet\", and \"AvailabilityZone\".""" + protection_profile_custom_input: Optional["_models.ProtectionProfileCustomDetails"] = rest_field( + name="protectionProfileCustomInput", visibility=["read", "create", "update", "delete", "query"] + ) + """The protection profile custom inputs.""" + recovery_resource_group_id: str = rest_field( + name="recoveryResourceGroupId", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery resource group Id. Valid for V2 scenarios. Required.""" + primary_staging_storage_account_custom_input: Optional["_models.StorageAccountCustomDetails"] = rest_field( + name="primaryStagingStorageAccountCustomInput", visibility=["read", "create", "update", "delete", "query"] + ) + """The primary staging storage account input.""" + recovery_availability_set_custom_input: Optional["_models.RecoveryAvailabilitySetCustomDetails"] = rest_field( + name="recoveryAvailabilitySetCustomInput", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery availability set input.""" + recovery_virtual_network_custom_input: Optional["_models.RecoveryVirtualNetworkCustomDetails"] = rest_field( + name="recoveryVirtualNetworkCustomInput", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery virtual network input.""" + recovery_proximity_placement_group_custom_input: Optional[ + "_models.RecoveryProximityPlacementGroupCustomDetails" + ] = rest_field( + name="recoveryProximityPlacementGroupCustomInput", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery proximity placement group custom input.""" + auto_protection_of_data_disk: Optional[Union[str, "_models.AutoProtectionOfDataDisk"]] = rest_field( + name="autoProtectionOfDataDisk", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether the auto protection is enabled. Known values are: \"Disabled\" and + \"Enabled\".""" + vm_disks: Optional[list["_models.A2AProtectionIntentDiskInputDetails"]] = rest_field( + name="vmDisks", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of vm disk inputs.""" + vm_managed_disks: Optional[list["_models.A2AProtectionIntentManagedDiskInputDetails"]] = rest_field( + name="vmManagedDisks", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of vm managed disk inputs.""" + multi_vm_group_name: Optional[str] = rest_field( + name="multiVmGroupName", visibility=["read", "create", "update", "delete", "query"] + ) + """The multi vm group name.""" + multi_vm_group_id: Optional[str] = rest_field( + name="multiVmGroupId", visibility=["read", "create", "update", "delete", "query"] + ) + """The multi vm group id.""" + recovery_boot_diag_storage_account: Optional["_models.StorageAccountCustomDetails"] = rest_field( + name="recoveryBootDiagStorageAccount", visibility=["read", "create", "update", "delete", "query"] + ) + """The boot diagnostic storage account.""" + disk_encryption_info: Optional["_models.DiskEncryptionInfo"] = rest_field( + name="diskEncryptionInfo", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery disk encryption information (for two pass flows).""" + recovery_availability_zone: Optional[str] = rest_field( + name="recoveryAvailabilityZone", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery availability zone.""" + agent_auto_update_status: Optional[Union[str, "_models.AgentAutoUpdateStatus"]] = rest_field( + name="agentAutoUpdateStatus", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether the auto update is enabled. Known values are: \"Disabled\" and + \"Enabled\".""" + automation_account_authentication_type: Optional[Union[str, "_models.AutomationAccountAuthenticationType"]] = ( + rest_field( + name="automationAccountAuthenticationType", visibility=["read", "create", "update", "delete", "query"] + ) + ) + """A value indicating the authentication type for automation account. The default value is + \"RunAsAccount\". Known values are: \"RunAsAccount\" and \"SystemAssignedIdentity\".""" + automation_account_arm_id: Optional[str] = rest_field( + name="automationAccountArmId", visibility=["read", "create", "update", "delete", "query"] + ) + """The automation account arm id.""" + instance_type: Literal["A2A"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The class type. Required. Default value is \"A2A\".""" + + @overload + def __init__( + self, + *, + fabric_object_id: str, + primary_location: str, + recovery_location: str, + recovery_subscription_id: str, + recovery_availability_type: Union[str, "_models.A2ARecoveryAvailabilityType"], + recovery_resource_group_id: str, + protection_profile_custom_input: Optional["_models.ProtectionProfileCustomDetails"] = None, + primary_staging_storage_account_custom_input: Optional["_models.StorageAccountCustomDetails"] = None, + recovery_availability_set_custom_input: Optional["_models.RecoveryAvailabilitySetCustomDetails"] = None, + recovery_virtual_network_custom_input: Optional["_models.RecoveryVirtualNetworkCustomDetails"] = None, + recovery_proximity_placement_group_custom_input: Optional[ + "_models.RecoveryProximityPlacementGroupCustomDetails" + ] = None, + auto_protection_of_data_disk: Optional[Union[str, "_models.AutoProtectionOfDataDisk"]] = None, + vm_disks: Optional[list["_models.A2AProtectionIntentDiskInputDetails"]] = None, + vm_managed_disks: Optional[list["_models.A2AProtectionIntentManagedDiskInputDetails"]] = None, + multi_vm_group_name: Optional[str] = None, + multi_vm_group_id: Optional[str] = None, + recovery_boot_diag_storage_account: Optional["_models.StorageAccountCustomDetails"] = None, + disk_encryption_info: Optional["_models.DiskEncryptionInfo"] = None, + recovery_availability_zone: Optional[str] = None, + agent_auto_update_status: Optional[Union[str, "_models.AgentAutoUpdateStatus"]] = None, + automation_account_authentication_type: Optional[ + Union[str, "_models.AutomationAccountAuthenticationType"] + ] = None, + automation_account_arm_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) + self.instance_type = "A2A" # type: ignore + + +class A2ACrossClusterMigrationApplyRecoveryPointInput( + ApplyRecoveryPointProviderSpecificInput, discriminator="A2ACrossClusterMigration" +): # pylint: disable=name-too-long + """ApplyRecoveryPoint input specific to A2ACrossClusterMigration provider. + + :ivar instance_type: The class type. Required. Default value is "A2ACrossClusterMigration". + :vartype instance_type: str + """ + + instance_type: Literal["A2ACrossClusterMigration"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The class type. Required. Default value is \"A2ACrossClusterMigration\".""" + + @overload + def __init__( + self, + ) -> 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) + self.instance_type = "A2ACrossClusterMigration" # type: ignore + + +class A2ACrossClusterMigrationContainerCreationInput( + ReplicationProviderSpecificContainerCreationInput, discriminator="A2ACrossClusterMigration" +): # pylint: disable=name-too-long + """A2ACrossClusterMigration cloud creation input. + + :ivar instance_type: The class type. Required. Default value is "A2ACrossClusterMigration". + :vartype instance_type: str + """ + + instance_type: Literal["A2ACrossClusterMigration"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The class type. Required. Default value is \"A2ACrossClusterMigration\".""" + + @overload + def __init__( + self, + ) -> 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) + self.instance_type = "A2ACrossClusterMigration" # type: ignore + + +class EnableProtectionProviderSpecificInput(_Model): + """Enable protection provider specific input. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + A2AEnableProtectionInput, A2ACrossClusterMigrationEnableProtectionInput, + HyperVReplicaAzureEnableProtectionInput, InMageEnableProtectionInput, + InMageAzureV2EnableProtectionInput, InMageRcmEnableProtectionInput + + :ivar instance_type: The class type. Required. Default value is None. + :vartype instance_type: str + """ + + __mapping__: dict[str, _Model] = {} + instance_type: str = rest_discriminator( + name="instanceType", visibility=["read", "create", "update", "delete", "query"] + ) + """The class type. Required. Default value is None.""" + + @overload + def __init__( + self, + *, + instance_type: str, + ) -> 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 A2ACrossClusterMigrationEnableProtectionInput( + EnableProtectionProviderSpecificInput, discriminator="A2ACrossClusterMigration" +): # pylint: disable=name-too-long + """A2A Cross-Cluster Migration enable protection input. + + :ivar fabric_object_id: The fabric specific object Id of the virtual machine. + :vartype fabric_object_id: str + :ivar recovery_container_id: The recovery container Id. + :vartype recovery_container_id: str + :ivar instance_type: The class type. Required. Default value is "A2ACrossClusterMigration". + :vartype instance_type: str + """ + + fabric_object_id: Optional[str] = rest_field( + name="fabricObjectId", visibility=["read", "create", "update", "delete", "query"] + ) + """The fabric specific object Id of the virtual machine.""" + recovery_container_id: Optional[str] = rest_field( + name="recoveryContainerId", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery container Id.""" + instance_type: Literal["A2ACrossClusterMigration"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The class type. Required. Default value is \"A2ACrossClusterMigration\".""" + + @overload + def __init__( + self, + *, + fabric_object_id: Optional[str] = None, + recovery_container_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) + self.instance_type = "A2ACrossClusterMigration" # type: ignore + + +class PolicyProviderSpecificInput(_Model): + """Base class for provider specific input. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + A2APolicyCreationInput, A2ACrossClusterMigrationPolicyCreationInput, HyperVReplicaPolicyInput, + HyperVReplicaBluePolicyInput, HyperVReplicaAzurePolicyInput, InMagePolicyInput, + InMageAzureV2PolicyInput, InMageRcmPolicyCreationInput, InMageRcmFailbackPolicyCreationInput, + VMwareCbtPolicyCreationInput + + :ivar instance_type: The class type. Required. Default value is None. + :vartype instance_type: str + """ + + __mapping__: dict[str, _Model] = {} + instance_type: str = rest_discriminator( + name="instanceType", visibility=["read", "create", "update", "delete", "query"] + ) + """The class type. Required. Default value is None.""" + + @overload + def __init__( + self, + *, + instance_type: str, + ) -> 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 A2ACrossClusterMigrationPolicyCreationInput( + PolicyProviderSpecificInput, discriminator="A2ACrossClusterMigration" +): # pylint: disable=name-too-long + """A2A Cross-Cluster Migration Policy creation input. + + :ivar instance_type: The class type. Required. Default value is "A2ACrossClusterMigration". + :vartype instance_type: str + """ + + instance_type: Literal["A2ACrossClusterMigration"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The class type. Required. Default value is \"A2ACrossClusterMigration\".""" + + @overload + def __init__( + self, + ) -> 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) + self.instance_type = "A2ACrossClusterMigration" # type: ignore + + +class ReplicationProviderSpecificSettings(_Model): + """Replication provider specific settings. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + A2AReplicationDetails, A2ACrossClusterMigrationReplicationDetails, + HyperVReplicaReplicationDetails, HyperVReplicaBlueReplicationDetails, + HyperVReplicaAzureReplicationDetails, HyperVReplicaBaseReplicationDetails, + InMageReplicationDetails, InMageAzureV2ReplicationDetails, InMageRcmReplicationDetails, + InMageRcmFailbackReplicationDetails + + :ivar instance_type: Gets the Instance type. Required. Default value is None. + :vartype instance_type: str + """ + + __mapping__: dict[str, _Model] = {} + instance_type: str = rest_discriminator( + name="instanceType", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets the Instance type. Required. Default value is None.""" + + @overload + def __init__( + self, + *, + instance_type: str, + ) -> 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 A2ACrossClusterMigrationReplicationDetails( + ReplicationProviderSpecificSettings, discriminator="A2ACrossClusterMigration" +): # pylint: disable=name-too-long + """A2A provider specific settings. + + :ivar fabric_object_id: The fabric specific object Id of the virtual machine. + :vartype fabric_object_id: str + :ivar primary_fabric_location: Primary fabric location. + :vartype primary_fabric_location: str + :ivar os_type: The type of operating system. + :vartype os_type: str + :ivar vm_protection_state: The protection state for the vm. + :vartype vm_protection_state: str + :ivar vm_protection_state_description: The protection state description for the vm. + :vartype vm_protection_state_description: str + :ivar lifecycle_id: An id associated with the PE that survives actions like switch protection + which change the backing PE/CPE objects internally.The lifecycle id gets carried forward to + have a link/continuity in being able to have an Id that denotes the "same" protected item even + though other internal Ids/ARM Id might be changing. + :vartype lifecycle_id: str + :ivar instance_type: Gets the Instance type. Required. Default value is + "A2ACrossClusterMigration". + :vartype instance_type: str + """ + + fabric_object_id: Optional[str] = rest_field( + name="fabricObjectId", visibility=["read", "create", "update", "delete", "query"] + ) + """The fabric specific object Id of the virtual machine.""" + primary_fabric_location: Optional[str] = rest_field( + name="primaryFabricLocation", visibility=["read", "create", "update", "delete", "query"] + ) + """Primary fabric location.""" + os_type: Optional[str] = rest_field(name="osType", visibility=["read", "create", "update", "delete", "query"]) + """The type of operating system.""" + vm_protection_state: Optional[str] = rest_field( + name="vmProtectionState", visibility=["read", "create", "update", "delete", "query"] + ) + """The protection state for the vm.""" + vm_protection_state_description: Optional[str] = rest_field( + name="vmProtectionStateDescription", visibility=["read", "create", "update", "delete", "query"] + ) + """The protection state description for the vm.""" + lifecycle_id: Optional[str] = rest_field( + name="lifecycleId", visibility=["read", "create", "update", "delete", "query"] + ) + """An id associated with the PE that survives actions like switch protection which change the + backing PE/CPE objects internally.The lifecycle id gets carried forward to have a + link/continuity in being able to have an Id that denotes the \"same\" protected item even + though other internal Ids/ARM Id might be changing.""" + instance_type: Literal["A2ACrossClusterMigration"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets the Instance type. Required. Default value is \"A2ACrossClusterMigration\".""" + + @overload + def __init__( + self, + *, + fabric_object_id: Optional[str] = None, + primary_fabric_location: Optional[str] = None, + os_type: Optional[str] = None, + vm_protection_state: Optional[str] = None, + vm_protection_state_description: Optional[str] = None, + lifecycle_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) + self.instance_type = "A2ACrossClusterMigration" # type: ignore + + +class A2AEnableProtectionInput(EnableProtectionProviderSpecificInput, discriminator="A2A"): + """A2A enable protection input. + + :ivar fabric_object_id: The fabric specific object Id of the virtual machine. Required. + :vartype fabric_object_id: str + :ivar recovery_container_id: The recovery container Id. + :vartype recovery_container_id: str + :ivar recovery_resource_group_id: The recovery resource group Id. Valid for V2 scenarios. + :vartype recovery_resource_group_id: str + :ivar recovery_cloud_service_id: The recovery cloud service Id. Valid for V1 scenarios. + :vartype recovery_cloud_service_id: str + :ivar recovery_availability_set_id: The recovery availability set Id. + :vartype recovery_availability_set_id: str + :ivar recovery_proximity_placement_group_id: The recovery proximity placement group Id. + :vartype recovery_proximity_placement_group_id: str + :ivar vm_disks: The list of vm disk details. + :vartype vm_disks: list[~azure.mgmt.recoveryservicessiterecovery.models.A2AVmDiskInputDetails] + :ivar vm_managed_disks: The list of vm managed disk details. + :vartype vm_managed_disks: + list[~azure.mgmt.recoveryservicessiterecovery.models.A2AVmManagedDiskInputDetails] + :ivar multi_vm_group_name: The multi vm group name. + :vartype multi_vm_group_name: str + :ivar multi_vm_group_id: The multi vm group id. + :vartype multi_vm_group_id: str + :ivar protection_cluster_id: The replication protection cluster Id. + :vartype protection_cluster_id: str + :ivar recovery_boot_diag_storage_account_id: The boot diagnostic storage account. + :vartype recovery_boot_diag_storage_account_id: str + :ivar disk_encryption_info: The recovery disk encryption information (for two pass flows). + :vartype disk_encryption_info: + ~azure.mgmt.recoveryservicessiterecovery.models.DiskEncryptionInfo + :ivar recovery_availability_zone: The recovery availability zone. + :vartype recovery_availability_zone: str + :ivar recovery_extended_location: The recovery extended location. + :vartype recovery_extended_location: + ~azure.mgmt.recoveryservicessiterecovery.models.ExtendedLocation + :ivar recovery_azure_network_id: The recovery Azure virtual network ARM id. + :vartype recovery_azure_network_id: str + :ivar recovery_subnet_name: The recovery subnet name. + :vartype recovery_subnet_name: str + :ivar recovery_virtual_machine_scale_set_id: The virtual machine scale set Id. + :vartype recovery_virtual_machine_scale_set_id: str + :ivar recovery_capacity_reservation_group_id: The recovery capacity reservation group Id. + :vartype recovery_capacity_reservation_group_id: str + :ivar platform_fault_domain: the platform fault domain. + :vartype platform_fault_domain: int + :ivar auto_protection_of_data_disk: A value indicating whether the auto protection is enabled. + Known values are: "Disabled" and "Enabled". + :vartype auto_protection_of_data_disk: str or + ~azure.mgmt.recoveryservicessiterecovery.models.AutoProtectionOfDataDisk + :ivar instance_type: The class type. Required. Default value is "A2A". + :vartype instance_type: str + """ + + fabric_object_id: str = rest_field( + name="fabricObjectId", visibility=["read", "create", "update", "delete", "query"] + ) + """The fabric specific object Id of the virtual machine. Required.""" + recovery_container_id: Optional[str] = rest_field( + name="recoveryContainerId", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery container Id.""" + recovery_resource_group_id: Optional[str] = rest_field( + name="recoveryResourceGroupId", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery resource group Id. Valid for V2 scenarios.""" + recovery_cloud_service_id: Optional[str] = rest_field( + name="recoveryCloudServiceId", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery cloud service Id. Valid for V1 scenarios.""" + recovery_availability_set_id: Optional[str] = rest_field( + name="recoveryAvailabilitySetId", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery availability set Id.""" + recovery_proximity_placement_group_id: Optional[str] = rest_field( + name="recoveryProximityPlacementGroupId", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery proximity placement group Id.""" + vm_disks: Optional[list["_models.A2AVmDiskInputDetails"]] = rest_field( + name="vmDisks", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of vm disk details.""" + vm_managed_disks: Optional[list["_models.A2AVmManagedDiskInputDetails"]] = rest_field( + name="vmManagedDisks", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of vm managed disk details.""" + multi_vm_group_name: Optional[str] = rest_field( + name="multiVmGroupName", visibility=["read", "create", "update", "delete", "query"] + ) + """The multi vm group name.""" + multi_vm_group_id: Optional[str] = rest_field( + name="multiVmGroupId", visibility=["read", "create", "update", "delete", "query"] + ) + """The multi vm group id.""" + protection_cluster_id: Optional[str] = rest_field( + name="protectionClusterId", visibility=["read", "create", "update", "delete", "query"] + ) + """The replication protection cluster Id.""" + recovery_boot_diag_storage_account_id: Optional[str] = rest_field( + name="recoveryBootDiagStorageAccountId", visibility=["read", "create", "update", "delete", "query"] + ) + """The boot diagnostic storage account.""" + disk_encryption_info: Optional["_models.DiskEncryptionInfo"] = rest_field( + name="diskEncryptionInfo", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery disk encryption information (for two pass flows).""" + recovery_availability_zone: Optional[str] = rest_field( + name="recoveryAvailabilityZone", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery availability zone.""" + recovery_extended_location: Optional["_models.ExtendedLocation"] = rest_field( + name="recoveryExtendedLocation", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery extended location.""" + recovery_azure_network_id: Optional[str] = rest_field( + name="recoveryAzureNetworkId", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery Azure virtual network ARM id.""" + recovery_subnet_name: Optional[str] = rest_field( + name="recoverySubnetName", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery subnet name.""" + recovery_virtual_machine_scale_set_id: Optional[str] = rest_field( + name="recoveryVirtualMachineScaleSetId", visibility=["read", "create", "update", "delete", "query"] + ) + """The virtual machine scale set Id.""" + recovery_capacity_reservation_group_id: Optional[str] = rest_field( + name="recoveryCapacityReservationGroupId", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery capacity reservation group Id.""" + platform_fault_domain: Optional[int] = rest_field( + name="platformFaultDomain", visibility=["read", "create", "update", "delete", "query"] + ) + """the platform fault domain.""" + auto_protection_of_data_disk: Optional[Union[str, "_models.AutoProtectionOfDataDisk"]] = rest_field( + name="autoProtectionOfDataDisk", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether the auto protection is enabled. Known values are: \"Disabled\" and + \"Enabled\".""" + instance_type: Literal["A2A"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The class type. Required. Default value is \"A2A\".""" + + @overload + def __init__( + self, + *, + fabric_object_id: str, + recovery_container_id: Optional[str] = None, + recovery_resource_group_id: Optional[str] = None, + recovery_cloud_service_id: Optional[str] = None, + recovery_availability_set_id: Optional[str] = None, + recovery_proximity_placement_group_id: Optional[str] = None, + vm_disks: Optional[list["_models.A2AVmDiskInputDetails"]] = None, + vm_managed_disks: Optional[list["_models.A2AVmManagedDiskInputDetails"]] = None, + multi_vm_group_name: Optional[str] = None, + multi_vm_group_id: Optional[str] = None, + protection_cluster_id: Optional[str] = None, + recovery_boot_diag_storage_account_id: Optional[str] = None, + disk_encryption_info: Optional["_models.DiskEncryptionInfo"] = None, + recovery_availability_zone: Optional[str] = None, + recovery_extended_location: Optional["_models.ExtendedLocation"] = None, + recovery_azure_network_id: Optional[str] = None, + recovery_subnet_name: Optional[str] = None, + recovery_virtual_machine_scale_set_id: Optional[str] = None, + recovery_capacity_reservation_group_id: Optional[str] = None, + platform_fault_domain: Optional[int] = None, + auto_protection_of_data_disk: Optional[Union[str, "_models.AutoProtectionOfDataDisk"]] = 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) + self.instance_type = "A2A" # type: ignore + + +class EventProviderSpecificDetails(_Model): + """Model class for provider specific details for an event. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + A2AEventDetails, HyperVReplica2012EventDetails, HyperVReplica2012R2EventDetails, + HyperVReplicaAzureEventDetails, HyperVReplicaBaseEventDetails, InMageAzureV2EventDetails, + InMageRcmEventDetails, InMageRcmFailbackEventDetails, VMwareCbtEventDetails + + :ivar instance_type: Gets the class type. Overridden in derived classes. Required. Default + value is None. + :vartype instance_type: str + """ + + __mapping__: dict[str, _Model] = {} + instance_type: str = rest_discriminator( + name="instanceType", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets the class type. Overridden in derived classes. Required. Default value is None.""" + + @overload + def __init__( + self, + *, + instance_type: str, + ) -> 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 A2AEventDetails(EventProviderSpecificDetails, discriminator="A2A"): + """Model class for event details of a A2A event. + + :ivar protected_item_name: The protected item arm name. + :vartype protected_item_name: str + :ivar fabric_object_id: The azure vm arm id. + :vartype fabric_object_id: str + :ivar fabric_name: Fabric arm name. + :vartype fabric_name: str + :ivar fabric_location: The fabric location. + :vartype fabric_location: str + :ivar remote_fabric_name: Remote fabric arm name. + :vartype remote_fabric_name: str + :ivar remote_fabric_location: Remote fabric location. + :vartype remote_fabric_location: str + :ivar instance_type: Gets the class type. Overridden in derived classes. Required. Default + value is "A2A". + :vartype instance_type: str + """ + + protected_item_name: Optional[str] = rest_field( + name="protectedItemName", visibility=["read", "create", "update", "delete", "query"] + ) + """The protected item arm name.""" + fabric_object_id: Optional[str] = rest_field( + name="fabricObjectId", visibility=["read", "create", "update", "delete", "query"] + ) + """The azure vm arm id.""" + fabric_name: Optional[str] = rest_field( + name="fabricName", visibility=["read", "create", "update", "delete", "query"] + ) + """Fabric arm name.""" + fabric_location: Optional[str] = rest_field( + name="fabricLocation", visibility=["read", "create", "update", "delete", "query"] + ) + """The fabric location.""" + remote_fabric_name: Optional[str] = rest_field( + name="remoteFabricName", visibility=["read", "create", "update", "delete", "query"] + ) + """Remote fabric arm name.""" + remote_fabric_location: Optional[str] = rest_field( + name="remoteFabricLocation", visibility=["read", "create", "update", "delete", "query"] + ) + """Remote fabric location.""" + instance_type: Literal["A2A"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets the class type. Overridden in derived classes. Required. Default value is \"A2A\".""" + + @overload + def __init__( + self, + *, + protected_item_name: Optional[str] = None, + fabric_object_id: Optional[str] = None, + fabric_name: Optional[str] = None, + fabric_location: Optional[str] = None, + remote_fabric_name: Optional[str] = None, + remote_fabric_location: 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) + self.instance_type = "A2A" # type: ignore + + +class A2AExtendedLocationDetails(_Model): + """ExtendedLocation details data. + + :ivar primary_extended_location: The primary ExtendedLocation. + :vartype primary_extended_location: + ~azure.mgmt.recoveryservicessiterecovery.models.ExtendedLocation + :ivar recovery_extended_location: The recovery ExtendedLocation. + :vartype recovery_extended_location: + ~azure.mgmt.recoveryservicessiterecovery.models.ExtendedLocation + """ + + primary_extended_location: Optional["_models.ExtendedLocation"] = rest_field( + name="primaryExtendedLocation", visibility=["read", "create", "update", "delete", "query"] + ) + """The primary ExtendedLocation.""" + recovery_extended_location: Optional["_models.ExtendedLocation"] = rest_field( + name="recoveryExtendedLocation", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery ExtendedLocation.""" + + @overload + def __init__( + self, + *, + primary_extended_location: Optional["_models.ExtendedLocation"] = None, + recovery_extended_location: Optional["_models.ExtendedLocation"] = 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 A2AFabricSpecificLocationDetails(_Model): + """ExtendedLocation details data. + + :ivar initial_primary_zone: The initial source zone info. + :vartype initial_primary_zone: str + :ivar initial_recovery_zone: The initial target zone info. + :vartype initial_recovery_zone: str + :ivar initial_primary_extended_location: The initial primary ExtendedLocation. + :vartype initial_primary_extended_location: + ~azure.mgmt.recoveryservicessiterecovery.models.ExtendedLocation + :ivar initial_recovery_extended_location: The initial recovery ExtendedLocation. + :vartype initial_recovery_extended_location: + ~azure.mgmt.recoveryservicessiterecovery.models.ExtendedLocation + :ivar initial_primary_fabric_location: Initial primary fabric location info. + :vartype initial_primary_fabric_location: str + :ivar initial_recovery_fabric_location: The initial recovery fabric location info. + :vartype initial_recovery_fabric_location: str + :ivar primary_zone: Source zone info. + :vartype primary_zone: str + :ivar recovery_zone: The target zone info. + :vartype recovery_zone: str + :ivar primary_extended_location: The primary ExtendedLocation. + :vartype primary_extended_location: + ~azure.mgmt.recoveryservicessiterecovery.models.ExtendedLocation + :ivar recovery_extended_location: The recovery ExtendedLocation. + :vartype recovery_extended_location: + ~azure.mgmt.recoveryservicessiterecovery.models.ExtendedLocation + :ivar primary_fabric_location: Primary fabric location info. + :vartype primary_fabric_location: str + :ivar recovery_fabric_location: The recovery fabric location info. + :vartype recovery_fabric_location: str + """ + + initial_primary_zone: Optional[str] = rest_field( + name="initialPrimaryZone", visibility=["read", "create", "update", "delete", "query"] + ) + """The initial source zone info.""" + initial_recovery_zone: Optional[str] = rest_field( + name="initialRecoveryZone", visibility=["read", "create", "update", "delete", "query"] + ) + """The initial target zone info.""" + initial_primary_extended_location: Optional["_models.ExtendedLocation"] = rest_field( + name="initialPrimaryExtendedLocation", visibility=["read", "create", "update", "delete", "query"] + ) + """The initial primary ExtendedLocation.""" + initial_recovery_extended_location: Optional["_models.ExtendedLocation"] = rest_field( + name="initialRecoveryExtendedLocation", visibility=["read", "create", "update", "delete", "query"] + ) + """The initial recovery ExtendedLocation.""" + initial_primary_fabric_location: Optional[str] = rest_field( + name="initialPrimaryFabricLocation", visibility=["read", "create", "update", "delete", "query"] + ) + """Initial primary fabric location info.""" + initial_recovery_fabric_location: Optional[str] = rest_field( + name="initialRecoveryFabricLocation", visibility=["read", "create", "update", "delete", "query"] + ) + """The initial recovery fabric location info.""" + primary_zone: Optional[str] = rest_field( + name="primaryZone", visibility=["read", "create", "update", "delete", "query"] + ) + """Source zone info.""" + recovery_zone: Optional[str] = rest_field( + name="recoveryZone", visibility=["read", "create", "update", "delete", "query"] + ) + """The target zone info.""" + primary_extended_location: Optional["_models.ExtendedLocation"] = rest_field( + name="primaryExtendedLocation", visibility=["read", "create", "update", "delete", "query"] + ) + """The primary ExtendedLocation.""" + recovery_extended_location: Optional["_models.ExtendedLocation"] = rest_field( + name="recoveryExtendedLocation", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery ExtendedLocation.""" + primary_fabric_location: Optional[str] = rest_field( + name="primaryFabricLocation", visibility=["read", "create", "update", "delete", "query"] + ) + """Primary fabric location info.""" + recovery_fabric_location: Optional[str] = rest_field( + name="recoveryFabricLocation", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery fabric location info.""" + + @overload + def __init__( + self, + *, + initial_primary_zone: Optional[str] = None, + initial_recovery_zone: Optional[str] = None, + initial_primary_extended_location: Optional["_models.ExtendedLocation"] = None, + initial_recovery_extended_location: Optional["_models.ExtendedLocation"] = None, + initial_primary_fabric_location: Optional[str] = None, + initial_recovery_fabric_location: Optional[str] = None, + primary_zone: Optional[str] = None, + recovery_zone: Optional[str] = None, + primary_extended_location: Optional["_models.ExtendedLocation"] = None, + recovery_extended_location: Optional["_models.ExtendedLocation"] = None, + primary_fabric_location: Optional[str] = None, + recovery_fabric_location: 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 A2APolicyCreationInput(PolicyProviderSpecificInput, discriminator="A2A"): + """A2A Policy creation input. + + :ivar recovery_point_history: The duration in minutes until which the recovery points need to + be stored. + :vartype recovery_point_history: int + :ivar crash_consistent_frequency_in_minutes: The crash consistent snapshot frequency (in + minutes). + :vartype crash_consistent_frequency_in_minutes: int + :ivar app_consistent_frequency_in_minutes: The app consistent snapshot frequency (in minutes). + :vartype app_consistent_frequency_in_minutes: int + :ivar multi_vm_sync_status: A value indicating whether multi-VM sync has to be enabled. Value + should be 'Enabled' or 'Disabled'. Required. Known values are: "Enable" and "Disable". + :vartype multi_vm_sync_status: str or + ~azure.mgmt.recoveryservicessiterecovery.models.SetMultiVmSyncStatus + :ivar instance_type: The class type. Required. Default value is "A2A". + :vartype instance_type: str + """ + + recovery_point_history: Optional[int] = rest_field( + name="recoveryPointHistory", visibility=["read", "create", "update", "delete", "query"] + ) + """The duration in minutes until which the recovery points need to be stored.""" + crash_consistent_frequency_in_minutes: Optional[int] = rest_field( + name="crashConsistentFrequencyInMinutes", visibility=["read", "create", "update", "delete", "query"] + ) + """The crash consistent snapshot frequency (in minutes).""" + app_consistent_frequency_in_minutes: Optional[int] = rest_field( + name="appConsistentFrequencyInMinutes", visibility=["read", "create", "update", "delete", "query"] + ) + """The app consistent snapshot frequency (in minutes).""" + multi_vm_sync_status: Union[str, "_models.SetMultiVmSyncStatus"] = rest_field( + name="multiVmSyncStatus", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether multi-VM sync has to be enabled. Value should be 'Enabled' or + 'Disabled'. Required. Known values are: \"Enable\" and \"Disable\".""" + instance_type: Literal["A2A"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The class type. Required. Default value is \"A2A\".""" + + @overload + def __init__( + self, + *, + multi_vm_sync_status: Union[str, "_models.SetMultiVmSyncStatus"], + recovery_point_history: Optional[int] = None, + crash_consistent_frequency_in_minutes: Optional[int] = None, + app_consistent_frequency_in_minutes: 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) + self.instance_type = "A2A" # type: ignore + + +class PolicyProviderSpecificDetails(_Model): + """Base class for Provider specific details for policies. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + A2APolicyDetails, HyperVReplicaPolicyDetails, HyperVReplicaBluePolicyDetails, + HyperVReplicaAzurePolicyDetails, HyperVReplicaBasePolicyDetails, InMagePolicyDetails, + InMageAzureV2PolicyDetails, InMageBasePolicyDetails, InMageRcmPolicyDetails, + InMageRcmFailbackPolicyDetails, VmwareCbtPolicyDetails + + :ivar instance_type: Gets the class type. Overridden in derived classes. Required. Default + value is None. + :vartype instance_type: str + """ + + __mapping__: dict[str, _Model] = {} + instance_type: str = rest_discriminator( + name="instanceType", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets the class type. Overridden in derived classes. Required. Default value is None.""" + + @overload + def __init__( + self, + *, + instance_type: str, + ) -> 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 A2APolicyDetails(PolicyProviderSpecificDetails, discriminator="A2A"): + """A2A specific policy details. + + :ivar recovery_point_threshold_in_minutes: The recovery point threshold in minutes. + :vartype recovery_point_threshold_in_minutes: int + :ivar recovery_point_history: The duration in minutes until which the recovery points need to + be stored. + :vartype recovery_point_history: int + :ivar app_consistent_frequency_in_minutes: The app consistent snapshot frequency in minutes. + :vartype app_consistent_frequency_in_minutes: int + :ivar multi_vm_sync_status: A value indicating whether multi-VM sync has to be enabled. + :vartype multi_vm_sync_status: str + :ivar crash_consistent_frequency_in_minutes: The crash consistent snapshot frequency in + minutes. + :vartype crash_consistent_frequency_in_minutes: int + :ivar instance_type: Gets the class type. Overridden in derived classes. Required. Default + value is "A2A". + :vartype instance_type: str + """ + + recovery_point_threshold_in_minutes: Optional[int] = rest_field( + name="recoveryPointThresholdInMinutes", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery point threshold in minutes.""" + recovery_point_history: Optional[int] = rest_field( + name="recoveryPointHistory", visibility=["read", "create", "update", "delete", "query"] + ) + """The duration in minutes until which the recovery points need to be stored.""" + app_consistent_frequency_in_minutes: Optional[int] = rest_field( + name="appConsistentFrequencyInMinutes", visibility=["read", "create", "update", "delete", "query"] + ) + """The app consistent snapshot frequency in minutes.""" + multi_vm_sync_status: Optional[str] = rest_field( + name="multiVmSyncStatus", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether multi-VM sync has to be enabled.""" + crash_consistent_frequency_in_minutes: Optional[int] = rest_field( + name="crashConsistentFrequencyInMinutes", visibility=["read", "create", "update", "delete", "query"] + ) + """The crash consistent snapshot frequency in minutes.""" + instance_type: Literal["A2A"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets the class type. Overridden in derived classes. Required. Default value is \"A2A\".""" + + @overload + def __init__( + self, + *, + recovery_point_threshold_in_minutes: Optional[int] = None, + recovery_point_history: Optional[int] = None, + app_consistent_frequency_in_minutes: Optional[int] = None, + multi_vm_sync_status: Optional[str] = None, + crash_consistent_frequency_in_minutes: 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) + self.instance_type = "A2A" # type: ignore + + +class A2AProtectedDiskDetails(_Model): + """A2A protected disk details. + + :ivar disk_uri: The disk uri. + :vartype disk_uri: str + :ivar recovery_azure_storage_account_id: The recovery disk storage account. + :vartype recovery_azure_storage_account_id: str + :ivar primary_disk_azure_storage_account_id: The primary disk storage account. + :vartype primary_disk_azure_storage_account_id: str + :ivar recovery_disk_uri: Recovery disk uri. + :vartype recovery_disk_uri: str + :ivar disk_name: The disk name. + :vartype disk_name: str + :ivar disk_capacity_in_bytes: The disk capacity in bytes. + :vartype disk_capacity_in_bytes: int + :ivar primary_staging_azure_storage_account_id: The primary staging storage account. + :vartype primary_staging_azure_storage_account_id: str + :ivar disk_type: The type of disk. + :vartype disk_type: str + :ivar resync_required: A value indicating whether resync is required for this disk. + :vartype resync_required: bool + :ivar monitoring_percentage_completion: The percentage of the monitoring job. The type of the + monitoring job is defined by MonitoringJobType property. + :vartype monitoring_percentage_completion: int + :ivar monitoring_job_type: The type of the monitoring job. The progress is contained in + MonitoringPercentageCompletion property. + :vartype monitoring_job_type: str + :ivar data_pending_in_staging_storage_account_in_mb: The data pending for replication in MB at + staging account. + :vartype data_pending_in_staging_storage_account_in_mb: float + :ivar data_pending_at_source_agent_in_mb: The data pending at source virtual machine in MB. + :vartype data_pending_at_source_agent_in_mb: float + :ivar disk_state: The disk state. + :vartype disk_state: str + :ivar allowed_disk_level_operation: The disk level operations list. + :vartype allowed_disk_level_operation: list[str] + :ivar is_disk_encrypted: A value indicating whether vm has encrypted os disk or not. + :vartype is_disk_encrypted: bool + :ivar secret_identifier: The secret URL / identifier (BEK). + :vartype secret_identifier: str + :ivar dek_key_vault_arm_id: The KeyVault resource id for secret (BEK). + :vartype dek_key_vault_arm_id: str + :ivar is_disk_key_encrypted: A value indicating whether disk key got encrypted or not. + :vartype is_disk_key_encrypted: bool + :ivar key_identifier: The key URL / identifier (KEK). + :vartype key_identifier: str + :ivar kek_key_vault_arm_id: The KeyVault resource id for key (KEK). + :vartype kek_key_vault_arm_id: str + :ivar failover_disk_name: The failover name for the managed disk. + :vartype failover_disk_name: str + :ivar tfo_disk_name: The test failover name for the managed disk. + :vartype tfo_disk_name: str + """ + + disk_uri: Optional[str] = rest_field(name="diskUri", visibility=["read", "create", "update", "delete", "query"]) + """The disk uri.""" + recovery_azure_storage_account_id: Optional[str] = rest_field( + name="recoveryAzureStorageAccountId", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery disk storage account.""" + primary_disk_azure_storage_account_id: Optional[str] = rest_field( + name="primaryDiskAzureStorageAccountId", visibility=["read", "create", "update", "delete", "query"] + ) + """The primary disk storage account.""" + recovery_disk_uri: Optional[str] = rest_field( + name="recoveryDiskUri", visibility=["read", "create", "update", "delete", "query"] + ) + """Recovery disk uri.""" + disk_name: Optional[str] = rest_field(name="diskName", visibility=["read", "create", "update", "delete", "query"]) + """The disk name.""" + disk_capacity_in_bytes: Optional[int] = rest_field( + name="diskCapacityInBytes", visibility=["read", "create", "update", "delete", "query"] + ) + """The disk capacity in bytes.""" + primary_staging_azure_storage_account_id: Optional[str] = rest_field( + name="primaryStagingAzureStorageAccountId", visibility=["read", "create", "update", "delete", "query"] + ) + """The primary staging storage account.""" + disk_type: Optional[str] = rest_field(name="diskType", visibility=["read", "create", "update", "delete", "query"]) + """The type of disk.""" + resync_required: Optional[bool] = rest_field( + name="resyncRequired", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether resync is required for this disk.""" + monitoring_percentage_completion: Optional[int] = rest_field( + name="monitoringPercentageCompletion", visibility=["read", "create", "update", "delete", "query"] + ) + """The percentage of the monitoring job. The type of the monitoring job is defined by + MonitoringJobType property.""" + monitoring_job_type: Optional[str] = rest_field( + name="monitoringJobType", visibility=["read", "create", "update", "delete", "query"] + ) + """The type of the monitoring job. The progress is contained in MonitoringPercentageCompletion + property.""" + data_pending_in_staging_storage_account_in_mb: Optional[float] = rest_field( + name="dataPendingInStagingStorageAccountInMB", visibility=["read", "create", "update", "delete", "query"] + ) + """The data pending for replication in MB at staging account.""" + data_pending_at_source_agent_in_mb: Optional[float] = rest_field( + name="dataPendingAtSourceAgentInMB", visibility=["read", "create", "update", "delete", "query"] + ) + """The data pending at source virtual machine in MB.""" + disk_state: Optional[str] = rest_field(name="diskState", visibility=["read", "create", "update", "delete", "query"]) + """The disk state.""" + allowed_disk_level_operation: Optional[list[str]] = rest_field( + name="allowedDiskLevelOperation", visibility=["read", "create", "update", "delete", "query"] + ) + """The disk level operations list.""" + is_disk_encrypted: Optional[bool] = rest_field( + name="isDiskEncrypted", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether vm has encrypted os disk or not.""" + secret_identifier: Optional[str] = rest_field( + name="secretIdentifier", visibility=["read", "create", "update", "delete", "query"] + ) + """The secret URL / identifier (BEK).""" + dek_key_vault_arm_id: Optional[str] = rest_field( + name="dekKeyVaultArmId", visibility=["read", "create", "update", "delete", "query"] + ) + """The KeyVault resource id for secret (BEK).""" + is_disk_key_encrypted: Optional[bool] = rest_field( + name="isDiskKeyEncrypted", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether disk key got encrypted or not.""" + key_identifier: Optional[str] = rest_field( + name="keyIdentifier", visibility=["read", "create", "update", "delete", "query"] + ) + """The key URL / identifier (KEK).""" + kek_key_vault_arm_id: Optional[str] = rest_field( + name="kekKeyVaultArmId", visibility=["read", "create", "update", "delete", "query"] + ) + """The KeyVault resource id for key (KEK).""" + failover_disk_name: Optional[str] = rest_field( + name="failoverDiskName", visibility=["read", "create", "update", "delete", "query"] + ) + """The failover name for the managed disk.""" + tfo_disk_name: Optional[str] = rest_field( + name="tfoDiskName", visibility=["read", "create", "update", "delete", "query"] + ) + """The test failover name for the managed disk.""" + + @overload + def __init__( + self, + *, + disk_uri: Optional[str] = None, + recovery_azure_storage_account_id: Optional[str] = None, + primary_disk_azure_storage_account_id: Optional[str] = None, + recovery_disk_uri: Optional[str] = None, + disk_name: Optional[str] = None, + disk_capacity_in_bytes: Optional[int] = None, + primary_staging_azure_storage_account_id: Optional[str] = None, + disk_type: Optional[str] = None, + resync_required: Optional[bool] = None, + monitoring_percentage_completion: Optional[int] = None, + monitoring_job_type: Optional[str] = None, + data_pending_in_staging_storage_account_in_mb: Optional[float] = None, + data_pending_at_source_agent_in_mb: Optional[float] = None, + disk_state: Optional[str] = None, + allowed_disk_level_operation: Optional[list[str]] = None, + is_disk_encrypted: Optional[bool] = None, + secret_identifier: Optional[str] = None, + dek_key_vault_arm_id: Optional[str] = None, + is_disk_key_encrypted: Optional[bool] = None, + key_identifier: Optional[str] = None, + kek_key_vault_arm_id: Optional[str] = None, + failover_disk_name: Optional[str] = None, + tfo_disk_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 A2AProtectedItemDetail(_Model): + """A2A specific switch cluster protection input. + + :ivar vm_managed_disks: The list of vm managed disk details. + :vartype vm_managed_disks: + list[~azure.mgmt.recoveryservicessiterecovery.models.A2AVmManagedDiskInputDetails] + :ivar recovery_resource_group_id: The recovery resource group Id. + :vartype recovery_resource_group_id: str + :ivar recovery_availability_set_id: The recovery availability set. + :vartype recovery_availability_set_id: str + :ivar recovery_boot_diag_storage_account_id: The boot diagnostic storage account. + :vartype recovery_boot_diag_storage_account_id: str + :ivar recovery_availability_zone: The recovery availability zone. + :vartype recovery_availability_zone: str + :ivar recovery_proximity_placement_group_id: The recovery proximity placement group Id. + :vartype recovery_proximity_placement_group_id: str + :ivar recovery_virtual_machine_scale_set_id: The virtual machine scale set id. + :vartype recovery_virtual_machine_scale_set_id: str + :ivar recovery_capacity_reservation_group_id: The recovery capacity reservation group Id. + :vartype recovery_capacity_reservation_group_id: str + :ivar disk_encryption_info: The recovery disk encryption information. + :vartype disk_encryption_info: + ~azure.mgmt.recoveryservicessiterecovery.models.DiskEncryptionInfo + :ivar replication_protected_item_name: The Replication Protected item name. + :vartype replication_protected_item_name: str + """ + + vm_managed_disks: Optional[list["_models.A2AVmManagedDiskInputDetails"]] = rest_field( + name="vmManagedDisks", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of vm managed disk details.""" + recovery_resource_group_id: Optional[str] = rest_field( + name="recoveryResourceGroupId", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery resource group Id.""" + recovery_availability_set_id: Optional[str] = rest_field( + name="recoveryAvailabilitySetId", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery availability set.""" + recovery_boot_diag_storage_account_id: Optional[str] = rest_field( + name="recoveryBootDiagStorageAccountId", visibility=["read", "create", "update", "delete", "query"] + ) + """The boot diagnostic storage account.""" + recovery_availability_zone: Optional[str] = rest_field( + name="recoveryAvailabilityZone", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery availability zone.""" + recovery_proximity_placement_group_id: Optional[str] = rest_field( + name="recoveryProximityPlacementGroupId", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery proximity placement group Id.""" + recovery_virtual_machine_scale_set_id: Optional[str] = rest_field( + name="recoveryVirtualMachineScaleSetId", visibility=["read", "create", "update", "delete", "query"] + ) + """The virtual machine scale set id.""" + recovery_capacity_reservation_group_id: Optional[str] = rest_field( + name="recoveryCapacityReservationGroupId", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery capacity reservation group Id.""" + disk_encryption_info: Optional["_models.DiskEncryptionInfo"] = rest_field( + name="diskEncryptionInfo", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery disk encryption information.""" + replication_protected_item_name: Optional[str] = rest_field( + name="replicationProtectedItemName", visibility=["read", "create", "update", "delete", "query"] + ) + """The Replication Protected item name.""" + + @overload + def __init__( + self, + *, + vm_managed_disks: Optional[list["_models.A2AVmManagedDiskInputDetails"]] = None, + recovery_resource_group_id: Optional[str] = None, + recovery_availability_set_id: Optional[str] = None, + recovery_boot_diag_storage_account_id: Optional[str] = None, + recovery_availability_zone: Optional[str] = None, + recovery_proximity_placement_group_id: Optional[str] = None, + recovery_virtual_machine_scale_set_id: Optional[str] = None, + recovery_capacity_reservation_group_id: Optional[str] = None, + disk_encryption_info: Optional["_models.DiskEncryptionInfo"] = None, + replication_protected_item_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 A2AProtectedManagedDiskDetails(_Model): + """A2A protected managed disk details. + + :ivar disk_id: The managed disk Arm id. + :vartype disk_id: str + :ivar recovery_resource_group_id: The recovery disk resource group Arm Id. + :vartype recovery_resource_group_id: str + :ivar recovery_target_disk_id: Recovery target disk Arm Id. + :vartype recovery_target_disk_id: str + :ivar recovery_replica_disk_id: Recovery replica disk Arm Id. + :vartype recovery_replica_disk_id: str + :ivar recovery_orignal_target_disk_id: Recovery original target disk Arm Id. + :vartype recovery_orignal_target_disk_id: str + :ivar recovery_replica_disk_account_type: The replica disk type. Its an optional value and will + be same as source disk type if not user provided. + :vartype recovery_replica_disk_account_type: str + :ivar recovery_target_disk_account_type: The target disk type after failover. Its an optional + value and will be same as source disk type if not user provided. + :vartype recovery_target_disk_account_type: str + :ivar recovery_disk_encryption_set_id: The recovery disk encryption set Id. + :vartype recovery_disk_encryption_set_id: str + :ivar primary_disk_encryption_set_id: The primary disk encryption set Id. + :vartype primary_disk_encryption_set_id: str + :ivar disk_name: The disk name. + :vartype disk_name: str + :ivar disk_capacity_in_bytes: The disk capacity in bytes. + :vartype disk_capacity_in_bytes: int + :ivar primary_staging_azure_storage_account_id: The primary staging storage account. + :vartype primary_staging_azure_storage_account_id: str + :ivar disk_type: The type of disk. + :vartype disk_type: str + :ivar resync_required: A value indicating whether resync is required for this disk. + :vartype resync_required: bool + :ivar monitoring_percentage_completion: The percentage of the monitoring job. The type of the + monitoring job is defined by MonitoringJobType property. + :vartype monitoring_percentage_completion: int + :ivar monitoring_job_type: The type of the monitoring job. The progress is contained in + MonitoringPercentageCompletion property. + :vartype monitoring_job_type: str + :ivar data_pending_in_staging_storage_account_in_mb: The data pending for replication in MB at + staging account. + :vartype data_pending_in_staging_storage_account_in_mb: float + :ivar data_pending_at_source_agent_in_mb: The data pending at source virtual machine in MB. + :vartype data_pending_at_source_agent_in_mb: float + :ivar disk_state: The disk state. + :vartype disk_state: str + :ivar allowed_disk_level_operation: The disk level operations list. + :vartype allowed_disk_level_operation: list[str] + :ivar is_disk_encrypted: A value indicating whether vm has encrypted os disk or not. + :vartype is_disk_encrypted: bool + :ivar secret_identifier: The secret URL / identifier (BEK). + :vartype secret_identifier: str + :ivar dek_key_vault_arm_id: The KeyVault resource id for secret (BEK). + :vartype dek_key_vault_arm_id: str + :ivar is_disk_key_encrypted: A value indicating whether disk key got encrypted or not. + :vartype is_disk_key_encrypted: bool + :ivar key_identifier: The key URL / identifier (KEK). + :vartype key_identifier: str + :ivar kek_key_vault_arm_id: The KeyVault resource id for key (KEK). + :vartype kek_key_vault_arm_id: str + :ivar failover_disk_name: The failover name for the managed disk. + :vartype failover_disk_name: str + :ivar tfo_disk_name: The test failover name for the managed disk. + :vartype tfo_disk_name: str + """ + + disk_id: Optional[str] = rest_field(name="diskId", visibility=["read", "create", "update", "delete", "query"]) + """The managed disk Arm id.""" + recovery_resource_group_id: Optional[str] = rest_field( + name="recoveryResourceGroupId", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery disk resource group Arm Id.""" + recovery_target_disk_id: Optional[str] = rest_field( + name="recoveryTargetDiskId", visibility=["read", "create", "update", "delete", "query"] + ) + """Recovery target disk Arm Id.""" + recovery_replica_disk_id: Optional[str] = rest_field( + name="recoveryReplicaDiskId", visibility=["read", "create", "update", "delete", "query"] + ) + """Recovery replica disk Arm Id.""" + recovery_orignal_target_disk_id: Optional[str] = rest_field( + name="recoveryOrignalTargetDiskId", visibility=["read", "create", "update", "delete", "query"] + ) + """Recovery original target disk Arm Id.""" + recovery_replica_disk_account_type: Optional[str] = rest_field( + name="recoveryReplicaDiskAccountType", visibility=["read", "create", "update", "delete", "query"] + ) + """The replica disk type. Its an optional value and will be same as source disk type if not user + provided.""" + recovery_target_disk_account_type: Optional[str] = rest_field( + name="recoveryTargetDiskAccountType", visibility=["read", "create", "update", "delete", "query"] + ) + """The target disk type after failover. Its an optional value and will be same as source disk type + if not user provided.""" + recovery_disk_encryption_set_id: Optional[str] = rest_field( + name="recoveryDiskEncryptionSetId", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery disk encryption set Id.""" + primary_disk_encryption_set_id: Optional[str] = rest_field( + name="primaryDiskEncryptionSetId", visibility=["read", "create", "update", "delete", "query"] + ) + """The primary disk encryption set Id.""" + disk_name: Optional[str] = rest_field(name="diskName", visibility=["read", "create", "update", "delete", "query"]) + """The disk name.""" + disk_capacity_in_bytes: Optional[int] = rest_field( + name="diskCapacityInBytes", visibility=["read", "create", "update", "delete", "query"] + ) + """The disk capacity in bytes.""" + primary_staging_azure_storage_account_id: Optional[str] = rest_field( + name="primaryStagingAzureStorageAccountId", visibility=["read", "create", "update", "delete", "query"] + ) + """The primary staging storage account.""" + disk_type: Optional[str] = rest_field(name="diskType", visibility=["read", "create", "update", "delete", "query"]) + """The type of disk.""" + resync_required: Optional[bool] = rest_field( + name="resyncRequired", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether resync is required for this disk.""" + monitoring_percentage_completion: Optional[int] = rest_field( + name="monitoringPercentageCompletion", visibility=["read", "create", "update", "delete", "query"] + ) + """The percentage of the monitoring job. The type of the monitoring job is defined by + MonitoringJobType property.""" + monitoring_job_type: Optional[str] = rest_field( + name="monitoringJobType", visibility=["read", "create", "update", "delete", "query"] + ) + """The type of the monitoring job. The progress is contained in MonitoringPercentageCompletion + property.""" + data_pending_in_staging_storage_account_in_mb: Optional[float] = rest_field( + name="dataPendingInStagingStorageAccountInMB", visibility=["read", "create", "update", "delete", "query"] + ) + """The data pending for replication in MB at staging account.""" + data_pending_at_source_agent_in_mb: Optional[float] = rest_field( + name="dataPendingAtSourceAgentInMB", visibility=["read", "create", "update", "delete", "query"] + ) + """The data pending at source virtual machine in MB.""" + disk_state: Optional[str] = rest_field(name="diskState", visibility=["read", "create", "update", "delete", "query"]) + """The disk state.""" + allowed_disk_level_operation: Optional[list[str]] = rest_field( + name="allowedDiskLevelOperation", visibility=["read", "create", "update", "delete", "query"] + ) + """The disk level operations list.""" + is_disk_encrypted: Optional[bool] = rest_field( + name="isDiskEncrypted", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether vm has encrypted os disk or not.""" + secret_identifier: Optional[str] = rest_field( + name="secretIdentifier", visibility=["read", "create", "update", "delete", "query"] + ) + """The secret URL / identifier (BEK).""" + dek_key_vault_arm_id: Optional[str] = rest_field( + name="dekKeyVaultArmId", visibility=["read", "create", "update", "delete", "query"] + ) + """The KeyVault resource id for secret (BEK).""" + is_disk_key_encrypted: Optional[bool] = rest_field( + name="isDiskKeyEncrypted", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether disk key got encrypted or not.""" + key_identifier: Optional[str] = rest_field( + name="keyIdentifier", visibility=["read", "create", "update", "delete", "query"] + ) + """The key URL / identifier (KEK).""" + kek_key_vault_arm_id: Optional[str] = rest_field( + name="kekKeyVaultArmId", visibility=["read", "create", "update", "delete", "query"] + ) + """The KeyVault resource id for key (KEK).""" + failover_disk_name: Optional[str] = rest_field( + name="failoverDiskName", visibility=["read", "create", "update", "delete", "query"] + ) + """The failover name for the managed disk.""" + tfo_disk_name: Optional[str] = rest_field( + name="tfoDiskName", visibility=["read", "create", "update", "delete", "query"] + ) + """The test failover name for the managed disk.""" + + @overload + def __init__( # pylint: disable=too-many-locals + self, + *, + disk_id: Optional[str] = None, + recovery_resource_group_id: Optional[str] = None, + recovery_target_disk_id: Optional[str] = None, + recovery_replica_disk_id: Optional[str] = None, + recovery_orignal_target_disk_id: Optional[str] = None, + recovery_replica_disk_account_type: Optional[str] = None, + recovery_target_disk_account_type: Optional[str] = None, + recovery_disk_encryption_set_id: Optional[str] = None, + primary_disk_encryption_set_id: Optional[str] = None, + disk_name: Optional[str] = None, + disk_capacity_in_bytes: Optional[int] = None, + primary_staging_azure_storage_account_id: Optional[str] = None, + disk_type: Optional[str] = None, + resync_required: Optional[bool] = None, + monitoring_percentage_completion: Optional[int] = None, + monitoring_job_type: Optional[str] = None, + data_pending_in_staging_storage_account_in_mb: Optional[float] = None, + data_pending_at_source_agent_in_mb: Optional[float] = None, + disk_state: Optional[str] = None, + allowed_disk_level_operation: Optional[list[str]] = None, + is_disk_encrypted: Optional[bool] = None, + secret_identifier: Optional[str] = None, + dek_key_vault_arm_id: Optional[str] = None, + is_disk_key_encrypted: Optional[bool] = None, + key_identifier: Optional[str] = None, + kek_key_vault_arm_id: Optional[str] = None, + failover_disk_name: Optional[str] = None, + tfo_disk_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 ProtectionContainerMappingProviderSpecificDetails(_Model): # pylint: disable=name-too-long + """Container mapping provider specific details. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + A2AProtectionContainerMappingDetails, InMageRcmProtectionContainerMappingDetails, + VMwareCbtProtectionContainerMappingDetails + + :ivar instance_type: Gets the class type. Overridden in derived classes. Required. Default + value is None. + :vartype instance_type: str + """ + + __mapping__: dict[str, _Model] = {} + instance_type: str = rest_discriminator( + name="instanceType", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets the class type. Overridden in derived classes. Required. Default value is None.""" + + @overload + def __init__( + self, + *, + instance_type: str, + ) -> 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 A2AProtectionContainerMappingDetails(ProtectionContainerMappingProviderSpecificDetails, discriminator="A2A"): + """A2A provider specific settings. + + :ivar agent_auto_update_status: A value indicating whether the auto update is enabled. Known + values are: "Disabled" and "Enabled". + :vartype agent_auto_update_status: str or + ~azure.mgmt.recoveryservicessiterecovery.models.AgentAutoUpdateStatus + :ivar automation_account_arm_id: The automation account arm id. + :vartype automation_account_arm_id: str + :ivar automation_account_authentication_type: A value indicating the type authentication to use + for automation Account. Known values are: "RunAsAccount" and "SystemAssignedIdentity". + :vartype automation_account_authentication_type: str or + ~azure.mgmt.recoveryservicessiterecovery.models.AutomationAccountAuthenticationType + :ivar schedule_name: The schedule arm name. + :vartype schedule_name: str + :ivar job_schedule_name: The job schedule arm name. + :vartype job_schedule_name: str + :ivar instance_type: Gets the class type. Overridden in derived classes. Required. Default + value is "A2A". + :vartype instance_type: str + """ + + agent_auto_update_status: Optional[Union[str, "_models.AgentAutoUpdateStatus"]] = rest_field( + name="agentAutoUpdateStatus", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether the auto update is enabled. Known values are: \"Disabled\" and + \"Enabled\".""" + automation_account_arm_id: Optional[str] = rest_field( + name="automationAccountArmId", visibility=["read", "create", "update", "delete", "query"] + ) + """The automation account arm id.""" + automation_account_authentication_type: Optional[Union[str, "_models.AutomationAccountAuthenticationType"]] = ( + rest_field( + name="automationAccountAuthenticationType", visibility=["read", "create", "update", "delete", "query"] + ) + ) + """A value indicating the type authentication to use for automation Account. Known values are: + \"RunAsAccount\" and \"SystemAssignedIdentity\".""" + schedule_name: Optional[str] = rest_field( + name="scheduleName", visibility=["read", "create", "update", "delete", "query"] + ) + """The schedule arm name.""" + job_schedule_name: Optional[str] = rest_field( + name="jobScheduleName", visibility=["read", "create", "update", "delete", "query"] + ) + """The job schedule arm name.""" + instance_type: Literal["A2A"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets the class type. Overridden in derived classes. Required. Default value is \"A2A\".""" + + @overload + def __init__( + self, + *, + agent_auto_update_status: Optional[Union[str, "_models.AgentAutoUpdateStatus"]] = None, + automation_account_arm_id: Optional[str] = None, + automation_account_authentication_type: Optional[ + Union[str, "_models.AutomationAccountAuthenticationType"] + ] = None, + schedule_name: Optional[str] = None, + job_schedule_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) + self.instance_type = "A2A" # type: ignore + + +class A2AProtectionIntentDiskInputDetails(_Model): + """Azure VM unmanaged disk input details. + + :ivar disk_uri: The disk Uri. Required. + :vartype disk_uri: str + :ivar recovery_azure_storage_account_custom_input: The recovery VHD storage account input. + :vartype recovery_azure_storage_account_custom_input: + ~azure.mgmt.recoveryservicessiterecovery.models.StorageAccountCustomDetails + :ivar primary_staging_storage_account_custom_input: The primary staging storage account input. + :vartype primary_staging_storage_account_custom_input: + ~azure.mgmt.recoveryservicessiterecovery.models.StorageAccountCustomDetails + """ + + disk_uri: str = rest_field(name="diskUri", visibility=["read", "create", "update", "delete", "query"]) + """The disk Uri. Required.""" + recovery_azure_storage_account_custom_input: Optional["_models.StorageAccountCustomDetails"] = rest_field( + name="recoveryAzureStorageAccountCustomInput", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery VHD storage account input.""" + primary_staging_storage_account_custom_input: Optional["_models.StorageAccountCustomDetails"] = rest_field( + name="primaryStagingStorageAccountCustomInput", visibility=["read", "create", "update", "delete", "query"] + ) + """The primary staging storage account input.""" + + @overload + def __init__( + self, + *, + disk_uri: str, + recovery_azure_storage_account_custom_input: Optional["_models.StorageAccountCustomDetails"] = None, + primary_staging_storage_account_custom_input: Optional["_models.StorageAccountCustomDetails"] = 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 A2AProtectionIntentManagedDiskInputDetails(_Model): # pylint: disable=name-too-long + """Azure VM managed disk input details. + + :ivar disk_id: The disk Id. Required. + :vartype disk_id: str + :ivar primary_staging_storage_account_custom_input: The primary staging storage account input. + :vartype primary_staging_storage_account_custom_input: + ~azure.mgmt.recoveryservicessiterecovery.models.StorageAccountCustomDetails + :ivar recovery_resource_group_custom_input: The recovery resource group input. + :vartype recovery_resource_group_custom_input: + ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryResourceGroupCustomDetails + :ivar recovery_replica_disk_account_type: The replica disk type. Its an optional value and will + be same as source disk type if not user provided. + :vartype recovery_replica_disk_account_type: str + :ivar recovery_target_disk_account_type: The target disk type after failover. Its an optional + value and will be same as source disk type if not user provided. + :vartype recovery_target_disk_account_type: str + :ivar recovery_disk_encryption_set_id: The recovery disk encryption set Id. + :vartype recovery_disk_encryption_set_id: str + :ivar disk_encryption_info: The recovery disk encryption information (for one / single pass + flows). + :vartype disk_encryption_info: + ~azure.mgmt.recoveryservicessiterecovery.models.DiskEncryptionInfo + """ + + disk_id: str = rest_field(name="diskId", visibility=["read", "create", "update", "delete", "query"]) + """The disk Id. Required.""" + primary_staging_storage_account_custom_input: Optional["_models.StorageAccountCustomDetails"] = rest_field( + name="primaryStagingStorageAccountCustomInput", visibility=["read", "create", "update", "delete", "query"] + ) + """The primary staging storage account input.""" + recovery_resource_group_custom_input: Optional["_models.RecoveryResourceGroupCustomDetails"] = rest_field( + name="recoveryResourceGroupCustomInput", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery resource group input.""" + recovery_replica_disk_account_type: Optional[str] = rest_field( + name="recoveryReplicaDiskAccountType", visibility=["read", "create", "update", "delete", "query"] + ) + """The replica disk type. Its an optional value and will be same as source disk type if not user + provided.""" + recovery_target_disk_account_type: Optional[str] = rest_field( + name="recoveryTargetDiskAccountType", visibility=["read", "create", "update", "delete", "query"] + ) + """The target disk type after failover. Its an optional value and will be same as source disk type + if not user provided.""" + recovery_disk_encryption_set_id: Optional[str] = rest_field( + name="recoveryDiskEncryptionSetId", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery disk encryption set Id.""" + disk_encryption_info: Optional["_models.DiskEncryptionInfo"] = rest_field( + name="diskEncryptionInfo", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery disk encryption information (for one / single pass flows).""" + + @overload + def __init__( + self, + *, + disk_id: str, + primary_staging_storage_account_custom_input: Optional["_models.StorageAccountCustomDetails"] = None, + recovery_resource_group_custom_input: Optional["_models.RecoveryResourceGroupCustomDetails"] = None, + recovery_replica_disk_account_type: Optional[str] = None, + recovery_target_disk_account_type: Optional[str] = None, + recovery_disk_encryption_set_id: Optional[str] = None, + disk_encryption_info: Optional["_models.DiskEncryptionInfo"] = 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 ProviderSpecificRecoveryPointDetails(_Model): + """Replication provider specific recovery point details. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + A2ARecoveryPointDetails, InMageAzureV2RecoveryPointDetails, InMageRcmRecoveryPointDetails + + :ivar instance_type: Gets the provider type. Required. Default value is None. + :vartype instance_type: str + """ + + __mapping__: dict[str, _Model] = {} + instance_type: str = rest_discriminator( + name="instanceType", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets the provider type. Required. Default value is None.""" + + @overload + def __init__( + self, + *, + instance_type: str, + ) -> 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 A2ARecoveryPointDetails(ProviderSpecificRecoveryPointDetails, discriminator="A2A"): + """A2A provider specific recovery point details. + + :ivar recovery_point_sync_type: A value indicating whether the recovery point is multi VM + consistent. Known values are: "MultiVmSyncRecoveryPoint" and "PerVmRecoveryPoint". + :vartype recovery_point_sync_type: str or + ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPointSyncType + :ivar disks: List of disk ids representing a recovery point. + :vartype disks: list[str] + :ivar instance_type: Gets the provider type. Required. Default value is "A2A". + :vartype instance_type: str + """ + + recovery_point_sync_type: Optional[Union[str, "_models.RecoveryPointSyncType"]] = rest_field( + name="recoveryPointSyncType", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether the recovery point is multi VM consistent. Known values are: + \"MultiVmSyncRecoveryPoint\" and \"PerVmRecoveryPoint\".""" + disks: Optional[list[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """List of disk ids representing a recovery point.""" + instance_type: Literal["A2A"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets the provider type. Required. Default value is \"A2A\".""" + + @overload + def __init__( + self, + *, + recovery_point_sync_type: Optional[Union[str, "_models.RecoveryPointSyncType"]] = None, + disks: 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) + self.instance_type = "A2A" # type: ignore + + +class RemoveDisksProviderSpecificInput(_Model): + """Remove Disk provider specific input. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + A2ARemoveDisksInput + + :ivar instance_type: The class type. Required. Default value is None. + :vartype instance_type: str + """ + + __mapping__: dict[str, _Model] = {} + instance_type: str = rest_discriminator( + name="instanceType", visibility=["read", "create", "update", "delete", "query"] + ) + """The class type. Required. Default value is None.""" + + @overload + def __init__( + self, + *, + instance_type: str, + ) -> 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 A2ARemoveDisksInput(RemoveDisksProviderSpecificInput, discriminator="A2A"): + """A2A remove disk(s) input. + + :ivar vm_disks_uris: The list of vm disk vhd URIs. + :vartype vm_disks_uris: list[str] + :ivar vm_managed_disks_ids: The list of vm managed disk Ids. + :vartype vm_managed_disks_ids: list[str] + :ivar instance_type: The class type. Required. Default value is "A2A". + :vartype instance_type: str + """ + + vm_disks_uris: Optional[list[str]] = rest_field( + name="vmDisksUris", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of vm disk vhd URIs.""" + vm_managed_disks_ids: Optional[list[str]] = rest_field( + name="vmManagedDisksIds", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of vm managed disk Ids.""" + instance_type: Literal["A2A"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The class type. Required. Default value is \"A2A\".""" + + @overload + def __init__( + self, + *, + vm_disks_uris: Optional[list[str]] = None, + vm_managed_disks_ids: 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) + self.instance_type = "A2A" # type: ignore + + +class A2AReplicationDetails(ReplicationProviderSpecificSettings, discriminator="A2A"): + """A2A provider specific settings. + + :ivar fabric_object_id: The fabric specific object Id of the virtual machine. + :vartype fabric_object_id: str + :ivar initial_primary_zone: The initial primary availability zone. + :vartype initial_primary_zone: str + :ivar initial_primary_fabric_location: The initial primary fabric location. + :vartype initial_primary_fabric_location: str + :ivar initial_recovery_zone: The initial recovery availability zone. + :vartype initial_recovery_zone: str + :ivar initial_primary_extended_location: The initial primary extended location. + :vartype initial_primary_extended_location: + ~azure.mgmt.recoveryservicessiterecovery.models.ExtendedLocation + :ivar initial_recovery_extended_location: The initial recovery extended location. + :vartype initial_recovery_extended_location: + ~azure.mgmt.recoveryservicessiterecovery.models.ExtendedLocation + :ivar initial_recovery_fabric_location: The initial recovery fabric location. + :vartype initial_recovery_fabric_location: str + :ivar multi_vm_group_id: The multi vm group Id. + :vartype multi_vm_group_id: str + :ivar multi_vm_group_name: The multi vm group name. + :vartype multi_vm_group_name: str + :ivar multi_vm_group_create_option: Whether Multi VM group is auto created or specified by + user. Known values are: "AutoCreated" and "UserSpecified". + :vartype multi_vm_group_create_option: str or + ~azure.mgmt.recoveryservicessiterecovery.models.MultiVmGroupCreateOption + :ivar management_id: The management Id. + :vartype management_id: str + :ivar protection_cluster_id: The replication protection cluster Id. + :vartype protection_cluster_id: str + :ivar is_cluster_infra_ready: A value indicating if the cluster infra is ready or not. + :vartype is_cluster_infra_ready: bool + :ivar protected_disks: The list of protected disks. + :vartype protected_disks: + list[~azure.mgmt.recoveryservicessiterecovery.models.A2AProtectedDiskDetails] + :ivar unprotected_disks: The list of unprotected disks. + :vartype unprotected_disks: + list[~azure.mgmt.recoveryservicessiterecovery.models.A2AUnprotectedDiskDetails] + :ivar protected_managed_disks: The list of protected managed disks. + :vartype protected_managed_disks: + list[~azure.mgmt.recoveryservicessiterecovery.models.A2AProtectedManagedDiskDetails] + :ivar recovery_boot_diag_storage_account_id: The recovery boot diagnostic storage account Arm + Id. + :vartype recovery_boot_diag_storage_account_id: str + :ivar primary_fabric_location: Primary fabric location. + :vartype primary_fabric_location: str + :ivar recovery_fabric_location: The recovery fabric location. + :vartype recovery_fabric_location: str + :ivar os_type: The type of operating system. + :vartype os_type: str + :ivar recovery_azure_vm_size: The size of recovery virtual machine. + :vartype recovery_azure_vm_size: str + :ivar recovery_azure_vm_name: The name of recovery virtual machine. + :vartype recovery_azure_vm_name: str + :ivar recovery_azure_resource_group_id: The recovery resource group. + :vartype recovery_azure_resource_group_id: str + :ivar recovery_cloud_service: The recovery cloud service. + :vartype recovery_cloud_service: str + :ivar recovery_availability_set: The recovery availability set. + :vartype recovery_availability_set: str + :ivar selected_recovery_azure_network_id: The recovery virtual network. + :vartype selected_recovery_azure_network_id: str + :ivar selected_tfo_azure_network_id: The test failover virtual network. + :vartype selected_tfo_azure_network_id: str + :ivar vm_nics: The virtual machine nic details. + :vartype vm_nics: list[~azure.mgmt.recoveryservicessiterecovery.models.VMNicDetails] + :ivar vm_synced_config_details: The synced configuration details. + :vartype vm_synced_config_details: + ~azure.mgmt.recoveryservicessiterecovery.models.AzureToAzureVmSyncedConfigDetails + :ivar monitoring_percentage_completion: The percentage of the monitoring job. The type of the + monitoring job is defined by MonitoringJobType property. + :vartype monitoring_percentage_completion: int + :ivar monitoring_job_type: The type of the monitoring job. The progress is contained in + MonitoringPercentageCompletion property. + :vartype monitoring_job_type: str + :ivar last_heartbeat: The last heartbeat received from the source server. + :vartype last_heartbeat: ~datetime.datetime + :ivar agent_version: The agent version. + :vartype agent_version: str + :ivar agent_expiry_date: Agent expiry date. + :vartype agent_expiry_date: ~datetime.datetime + :ivar is_replication_agent_update_required: A value indicating whether replication agent update + is required. + :vartype is_replication_agent_update_required: bool + :ivar agent_certificate_expiry_date: Agent certificate expiry date. + :vartype agent_certificate_expiry_date: ~datetime.datetime + :ivar is_replication_agent_certificate_update_required: A value indicating whether agent + certificate update is required. + :vartype is_replication_agent_certificate_update_required: bool + :ivar recovery_fabric_object_id: The recovery fabric object Id. + :vartype recovery_fabric_object_id: str + :ivar vm_protection_state: The protection state for the vm. + :vartype vm_protection_state: str + :ivar vm_protection_state_description: The protection state description for the vm. + :vartype vm_protection_state_description: str + :ivar lifecycle_id: An id associated with the PE that survives actions like switch protection + which change the backing PE/CPE objects internally.The lifecycle id gets carried forward to + have a link/continuity in being able to have an Id that denotes the "same" protected item even + though other internal Ids/ARM Id might be changing. + :vartype lifecycle_id: str + :ivar test_failover_recovery_fabric_object_id: The test failover fabric object Id. + :vartype test_failover_recovery_fabric_object_id: str + :ivar rpo_in_seconds: The last RPO value in seconds. + :vartype rpo_in_seconds: int + :ivar last_rpo_calculated_time: The time (in UTC) when the last RPO value was calculated by + Protection Service. + :vartype last_rpo_calculated_time: ~datetime.datetime + :ivar primary_availability_zone: The primary availability zone. + :vartype primary_availability_zone: str + :ivar recovery_availability_zone: The recovery availability zone. + :vartype recovery_availability_zone: str + :ivar primary_extended_location: The primary Extended Location. + :vartype primary_extended_location: + ~azure.mgmt.recoveryservicessiterecovery.models.ExtendedLocation + :ivar recovery_extended_location: The recovery Extended Location. + :vartype recovery_extended_location: + ~azure.mgmt.recoveryservicessiterecovery.models.ExtendedLocation + :ivar vm_encryption_type: The encryption type of the VM. Known values are: "NotEncrypted", + "OnePassEncrypted", and "TwoPassEncrypted". + :vartype vm_encryption_type: str or + ~azure.mgmt.recoveryservicessiterecovery.models.VmEncryptionType + :ivar tfo_azure_vm_name: The test failover vm name. + :vartype tfo_azure_vm_name: str + :ivar recovery_azure_generation: The recovery azure generation. + :vartype recovery_azure_generation: str + :ivar recovery_proximity_placement_group_id: The recovery proximity placement group Id. + :vartype recovery_proximity_placement_group_id: str + :ivar auto_protection_of_data_disk: A value indicating whether the auto protection is enabled. + Known values are: "Disabled" and "Enabled". + :vartype auto_protection_of_data_disk: str or + ~azure.mgmt.recoveryservicessiterecovery.models.AutoProtectionOfDataDisk + :ivar recovery_virtual_machine_scale_set_id: The recovery virtual machine scale set id. + :vartype recovery_virtual_machine_scale_set_id: str + :ivar recovery_capacity_reservation_group_id: The recovery capacity reservation group Id. + :vartype recovery_capacity_reservation_group_id: str + :ivar churn_option_selected: A value indicating the churn option selected by user. Known values + are: "Normal" and "High". + :vartype churn_option_selected: str or + ~azure.mgmt.recoveryservicessiterecovery.models.ChurnOptionSelected + :ivar agent_reinstall_attempt_to_version: The agent version to which last agent reinstall was + attempted. + :vartype agent_reinstall_attempt_to_version: str + :ivar os_family_name: The OS family name. + :vartype os_family_name: str + :ivar distro_name: The distro name. + :vartype distro_name: str + :ivar distro_name_for_which_agent_is_installed: The agent os name last agent reinstall was + attempted. + :vartype distro_name_for_which_agent_is_installed: str + :ivar is_agent_upgradeable: A value indicating whether replication agent upgradeable. + :vartype is_agent_upgradeable: bool + :ivar is_agent_reinstall_required: A value indicating whether replication agent reinstallation + is required. + :vartype is_agent_reinstall_required: bool + :ivar reasons_blocking_re_install: value for reason blocking reinstall. + :vartype reasons_blocking_re_install: str + :ivar reasons_blocking_reinstall_details: whether reinstall is possible or not. + :vartype reasons_blocking_reinstall_details: + list[~azure.mgmt.recoveryservicessiterecovery.models.A2AAgentReinstallBlockingErrorDetails] + :ivar is_agent_upgrade_in_progress: A value indicating whether replication agent Upgrade is + In-Progress. + :vartype is_agent_upgrade_in_progress: bool + :ivar auto_agent_upgrade_retry_count: auto agent upgrade retry count. + :vartype auto_agent_upgrade_retry_count: int + :ivar is_agent_upgrade_retry_threshold_exhausted: A value indicating whether replication agent + Upgrade retry exhausted. + :vartype is_agent_upgrade_retry_threshold_exhausted: bool + :ivar platform_fault_domain: the platform fault domain. + :vartype platform_fault_domain: int + :ivar instance_type: Gets the Instance type. Required. Default value is "A2A". + :vartype instance_type: str + """ + + fabric_object_id: Optional[str] = rest_field( + name="fabricObjectId", visibility=["read", "create", "update", "delete", "query"] + ) + """The fabric specific object Id of the virtual machine.""" + initial_primary_zone: Optional[str] = rest_field(name="initialPrimaryZone", visibility=["read"]) + """The initial primary availability zone.""" + initial_primary_fabric_location: Optional[str] = rest_field( + name="initialPrimaryFabricLocation", visibility=["read"] + ) + """The initial primary fabric location.""" + initial_recovery_zone: Optional[str] = rest_field(name="initialRecoveryZone", visibility=["read"]) + """The initial recovery availability zone.""" + initial_primary_extended_location: Optional["_models.ExtendedLocation"] = rest_field( + name="initialPrimaryExtendedLocation", visibility=["read", "create", "update", "delete", "query"] + ) + """The initial primary extended location.""" + initial_recovery_extended_location: Optional["_models.ExtendedLocation"] = rest_field( + name="initialRecoveryExtendedLocation", visibility=["read", "create", "update", "delete", "query"] + ) + """The initial recovery extended location.""" + initial_recovery_fabric_location: Optional[str] = rest_field( + name="initialRecoveryFabricLocation", visibility=["read"] + ) + """The initial recovery fabric location.""" + multi_vm_group_id: Optional[str] = rest_field( + name="multiVmGroupId", visibility=["read", "create", "update", "delete", "query"] + ) + """The multi vm group Id.""" + multi_vm_group_name: Optional[str] = rest_field( + name="multiVmGroupName", visibility=["read", "create", "update", "delete", "query"] + ) + """The multi vm group name.""" + multi_vm_group_create_option: Optional[Union[str, "_models.MultiVmGroupCreateOption"]] = rest_field( + name="multiVmGroupCreateOption", visibility=["read", "create", "update", "delete", "query"] + ) + """Whether Multi VM group is auto created or specified by user. Known values are: \"AutoCreated\" + and \"UserSpecified\".""" + management_id: Optional[str] = rest_field( + name="managementId", visibility=["read", "create", "update", "delete", "query"] + ) + """The management Id.""" + protection_cluster_id: Optional[str] = rest_field( + name="protectionClusterId", visibility=["read", "create", "update", "delete", "query"] + ) + """The replication protection cluster Id.""" + is_cluster_infra_ready: Optional[bool] = rest_field( + name="isClusterInfraReady", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating if the cluster infra is ready or not.""" + protected_disks: Optional[list["_models.A2AProtectedDiskDetails"]] = rest_field( + name="protectedDisks", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of protected disks.""" + unprotected_disks: Optional[list["_models.A2AUnprotectedDiskDetails"]] = rest_field( + name="unprotectedDisks", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of unprotected disks.""" + protected_managed_disks: Optional[list["_models.A2AProtectedManagedDiskDetails"]] = rest_field( + name="protectedManagedDisks", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of protected managed disks.""" + recovery_boot_diag_storage_account_id: Optional[str] = rest_field( + name="recoveryBootDiagStorageAccountId", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery boot diagnostic storage account Arm Id.""" + primary_fabric_location: Optional[str] = rest_field( + name="primaryFabricLocation", visibility=["read", "create", "update", "delete", "query"] + ) + """Primary fabric location.""" + recovery_fabric_location: Optional[str] = rest_field( + name="recoveryFabricLocation", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery fabric location.""" + os_type: Optional[str] = rest_field(name="osType", visibility=["read", "create", "update", "delete", "query"]) + """The type of operating system.""" + recovery_azure_vm_size: Optional[str] = rest_field( + name="recoveryAzureVMSize", visibility=["read", "create", "update", "delete", "query"] + ) + """The size of recovery virtual machine.""" + recovery_azure_vm_name: Optional[str] = rest_field( + name="recoveryAzureVMName", visibility=["read", "create", "update", "delete", "query"] + ) + """The name of recovery virtual machine.""" + recovery_azure_resource_group_id: Optional[str] = rest_field( + name="recoveryAzureResourceGroupId", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery resource group.""" + recovery_cloud_service: Optional[str] = rest_field( + name="recoveryCloudService", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery cloud service.""" + recovery_availability_set: Optional[str] = rest_field( + name="recoveryAvailabilitySet", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery availability set.""" + selected_recovery_azure_network_id: Optional[str] = rest_field( + name="selectedRecoveryAzureNetworkId", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery virtual network.""" + selected_tfo_azure_network_id: Optional[str] = rest_field( + name="selectedTfoAzureNetworkId", visibility=["read", "create", "update", "delete", "query"] + ) + """The test failover virtual network.""" + vm_nics: Optional[list["_models.VMNicDetails"]] = rest_field( + name="vmNics", visibility=["read", "create", "update", "delete", "query"] + ) + """The virtual machine nic details.""" + vm_synced_config_details: Optional["_models.AzureToAzureVmSyncedConfigDetails"] = rest_field( + name="vmSyncedConfigDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """The synced configuration details.""" + monitoring_percentage_completion: Optional[int] = rest_field( + name="monitoringPercentageCompletion", visibility=["read", "create", "update", "delete", "query"] + ) + """The percentage of the monitoring job. The type of the monitoring job is defined by + MonitoringJobType property.""" + monitoring_job_type: Optional[str] = rest_field( + name="monitoringJobType", visibility=["read", "create", "update", "delete", "query"] + ) + """The type of the monitoring job. The progress is contained in MonitoringPercentageCompletion + property.""" + last_heartbeat: Optional[datetime.datetime] = rest_field( + name="lastHeartbeat", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The last heartbeat received from the source server.""" + agent_version: Optional[str] = rest_field( + name="agentVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """The agent version.""" + agent_expiry_date: Optional[datetime.datetime] = rest_field( + name="agentExpiryDate", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """Agent expiry date.""" + is_replication_agent_update_required: Optional[bool] = rest_field( + name="isReplicationAgentUpdateRequired", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether replication agent update is required.""" + agent_certificate_expiry_date: Optional[datetime.datetime] = rest_field( + name="agentCertificateExpiryDate", visibility=["read"], format="rfc3339" + ) + """Agent certificate expiry date.""" + is_replication_agent_certificate_update_required: Optional[bool] = rest_field( + name="isReplicationAgentCertificateUpdateRequired", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether agent certificate update is required.""" + recovery_fabric_object_id: Optional[str] = rest_field( + name="recoveryFabricObjectId", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery fabric object Id.""" + vm_protection_state: Optional[str] = rest_field( + name="vmProtectionState", visibility=["read", "create", "update", "delete", "query"] + ) + """The protection state for the vm.""" + vm_protection_state_description: Optional[str] = rest_field( + name="vmProtectionStateDescription", visibility=["read", "create", "update", "delete", "query"] + ) + """The protection state description for the vm.""" + lifecycle_id: Optional[str] = rest_field( + name="lifecycleId", visibility=["read", "create", "update", "delete", "query"] + ) + """An id associated with the PE that survives actions like switch protection which change the + backing PE/CPE objects internally.The lifecycle id gets carried forward to have a + link/continuity in being able to have an Id that denotes the \"same\" protected item even + though other internal Ids/ARM Id might be changing.""" + test_failover_recovery_fabric_object_id: Optional[str] = rest_field( + name="testFailoverRecoveryFabricObjectId", visibility=["read", "create", "update", "delete", "query"] + ) + """The test failover fabric object Id.""" + rpo_in_seconds: Optional[int] = rest_field( + name="rpoInSeconds", visibility=["read", "create", "update", "delete", "query"] + ) + """The last RPO value in seconds.""" + last_rpo_calculated_time: Optional[datetime.datetime] = rest_field( + name="lastRpoCalculatedTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The time (in UTC) when the last RPO value was calculated by Protection Service.""" + primary_availability_zone: Optional[str] = rest_field( + name="primaryAvailabilityZone", visibility=["read", "create", "update", "delete", "query"] + ) + """The primary availability zone.""" + recovery_availability_zone: Optional[str] = rest_field( + name="recoveryAvailabilityZone", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery availability zone.""" + primary_extended_location: Optional["_models.ExtendedLocation"] = rest_field( + name="primaryExtendedLocation", visibility=["read", "create", "update", "delete", "query"] + ) + """The primary Extended Location.""" + recovery_extended_location: Optional["_models.ExtendedLocation"] = rest_field( + name="recoveryExtendedLocation", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery Extended Location.""" + vm_encryption_type: Optional[Union[str, "_models.VmEncryptionType"]] = rest_field( + name="vmEncryptionType", visibility=["read"] + ) + """The encryption type of the VM. Known values are: \"NotEncrypted\", \"OnePassEncrypted\", and + \"TwoPassEncrypted\".""" + tfo_azure_vm_name: Optional[str] = rest_field( + name="tfoAzureVMName", visibility=["read", "create", "update", "delete", "query"] + ) + """The test failover vm name.""" + recovery_azure_generation: Optional[str] = rest_field(name="recoveryAzureGeneration", visibility=["read"]) + """The recovery azure generation.""" + recovery_proximity_placement_group_id: Optional[str] = rest_field( + name="recoveryProximityPlacementGroupId", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery proximity placement group Id.""" + auto_protection_of_data_disk: Optional[Union[str, "_models.AutoProtectionOfDataDisk"]] = rest_field( + name="autoProtectionOfDataDisk", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether the auto protection is enabled. Known values are: \"Disabled\" and + \"Enabled\".""" + recovery_virtual_machine_scale_set_id: Optional[str] = rest_field( + name="recoveryVirtualMachineScaleSetId", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery virtual machine scale set id.""" + recovery_capacity_reservation_group_id: Optional[str] = rest_field( + name="recoveryCapacityReservationGroupId", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery capacity reservation group Id.""" + churn_option_selected: Optional[Union[str, "_models.ChurnOptionSelected"]] = rest_field( + name="churnOptionSelected", visibility=["read"] + ) + """A value indicating the churn option selected by user. Known values are: \"Normal\" and + \"High\".""" + agent_reinstall_attempt_to_version: Optional[str] = rest_field( + name="agentReinstallAttemptToVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """The agent version to which last agent reinstall was attempted.""" + os_family_name: Optional[str] = rest_field( + name="osFamilyName", visibility=["read", "create", "update", "delete", "query"] + ) + """The OS family name.""" + distro_name: Optional[str] = rest_field( + name="distroName", visibility=["read", "create", "update", "delete", "query"] + ) + """The distro name.""" + distro_name_for_which_agent_is_installed: Optional[str] = rest_field( + name="distroNameForWhichAgentIsInstalled", visibility=["read", "create", "update", "delete", "query"] + ) + """The agent os name last agent reinstall was attempted.""" + is_agent_upgradeable: Optional[bool] = rest_field( + name="isAgentUpgradeable", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether replication agent upgradeable.""" + is_agent_reinstall_required: Optional[bool] = rest_field( + name="isAgentReinstallRequired", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether replication agent reinstallation is required.""" + reasons_blocking_re_install: Optional[str] = rest_field( + name="reasonsBlockingReInstall", visibility=["read", "create", "update", "delete", "query"] + ) + """value for reason blocking reinstall.""" + reasons_blocking_reinstall_details: Optional[list["_models.A2AAgentReinstallBlockingErrorDetails"]] = rest_field( + name="reasonsBlockingReinstallDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """whether reinstall is possible or not.""" + is_agent_upgrade_in_progress: Optional[bool] = rest_field( + name="isAgentUpgradeInProgress", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether replication agent Upgrade is In-Progress.""" + auto_agent_upgrade_retry_count: Optional[int] = rest_field( + name="autoAgentUpgradeRetryCount", visibility=["read", "create", "update", "delete", "query"] + ) + """auto agent upgrade retry count.""" + is_agent_upgrade_retry_threshold_exhausted: Optional[bool] = rest_field( + name="isAgentUpgradeRetryThresholdExhausted", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether replication agent Upgrade retry exhausted.""" + platform_fault_domain: Optional[int] = rest_field( + name="platformFaultDomain", visibility=["read", "create", "update", "delete", "query"] + ) + """the platform fault domain.""" + instance_type: Literal["A2A"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets the Instance type. Required. Default value is \"A2A\".""" + + @overload + def __init__( # pylint: disable=too-many-locals + self, + *, + fabric_object_id: Optional[str] = None, + initial_primary_extended_location: Optional["_models.ExtendedLocation"] = None, + initial_recovery_extended_location: Optional["_models.ExtendedLocation"] = None, + multi_vm_group_id: Optional[str] = None, + multi_vm_group_name: Optional[str] = None, + multi_vm_group_create_option: Optional[Union[str, "_models.MultiVmGroupCreateOption"]] = None, + management_id: Optional[str] = None, + protection_cluster_id: Optional[str] = None, + is_cluster_infra_ready: Optional[bool] = None, + protected_disks: Optional[list["_models.A2AProtectedDiskDetails"]] = None, + unprotected_disks: Optional[list["_models.A2AUnprotectedDiskDetails"]] = None, + protected_managed_disks: Optional[list["_models.A2AProtectedManagedDiskDetails"]] = None, + recovery_boot_diag_storage_account_id: Optional[str] = None, + primary_fabric_location: Optional[str] = None, + recovery_fabric_location: Optional[str] = None, + os_type: Optional[str] = None, + recovery_azure_vm_size: Optional[str] = None, + recovery_azure_vm_name: Optional[str] = None, + recovery_azure_resource_group_id: Optional[str] = None, + recovery_cloud_service: Optional[str] = None, + recovery_availability_set: Optional[str] = None, + selected_recovery_azure_network_id: Optional[str] = None, + selected_tfo_azure_network_id: Optional[str] = None, + vm_nics: Optional[list["_models.VMNicDetails"]] = None, + vm_synced_config_details: Optional["_models.AzureToAzureVmSyncedConfigDetails"] = None, + monitoring_percentage_completion: Optional[int] = None, + monitoring_job_type: Optional[str] = None, + last_heartbeat: Optional[datetime.datetime] = None, + agent_version: Optional[str] = None, + agent_expiry_date: Optional[datetime.datetime] = None, + is_replication_agent_update_required: Optional[bool] = None, + is_replication_agent_certificate_update_required: Optional[bool] = None, + recovery_fabric_object_id: Optional[str] = None, + vm_protection_state: Optional[str] = None, + vm_protection_state_description: Optional[str] = None, + lifecycle_id: Optional[str] = None, + test_failover_recovery_fabric_object_id: Optional[str] = None, + rpo_in_seconds: Optional[int] = None, + last_rpo_calculated_time: Optional[datetime.datetime] = None, + primary_availability_zone: Optional[str] = None, + recovery_availability_zone: Optional[str] = None, + primary_extended_location: Optional["_models.ExtendedLocation"] = None, + recovery_extended_location: Optional["_models.ExtendedLocation"] = None, + tfo_azure_vm_name: Optional[str] = None, + recovery_proximity_placement_group_id: Optional[str] = None, + auto_protection_of_data_disk: Optional[Union[str, "_models.AutoProtectionOfDataDisk"]] = None, + recovery_virtual_machine_scale_set_id: Optional[str] = None, + recovery_capacity_reservation_group_id: Optional[str] = None, + agent_reinstall_attempt_to_version: Optional[str] = None, + os_family_name: Optional[str] = None, + distro_name: Optional[str] = None, + distro_name_for_which_agent_is_installed: Optional[str] = None, + is_agent_upgradeable: Optional[bool] = None, + is_agent_reinstall_required: Optional[bool] = None, + reasons_blocking_re_install: Optional[str] = None, + reasons_blocking_reinstall_details: Optional[list["_models.A2AAgentReinstallBlockingErrorDetails"]] = None, + is_agent_upgrade_in_progress: Optional[bool] = None, + auto_agent_upgrade_retry_count: Optional[int] = None, + is_agent_upgrade_retry_threshold_exhausted: Optional[bool] = None, + platform_fault_domain: 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) + self.instance_type = "A2A" # type: ignore + + +class ReplicationProtectionIntentProviderSpecificSettings(_Model): # pylint: disable=name-too-long + """Replication provider specific settings. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + A2AReplicationIntentDetails + + :ivar instance_type: Gets the Instance type. Required. Default value is None. + :vartype instance_type: str + """ + + __mapping__: dict[str, _Model] = {} + instance_type: str = rest_discriminator( + name="instanceType", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets the Instance type. Required. Default value is None.""" + + @overload + def __init__( + self, + *, + instance_type: str, + ) -> 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 A2AReplicationIntentDetails(ReplicationProtectionIntentProviderSpecificSettings, discriminator="A2A"): + """A2A provider specific settings. + + :ivar fabric_object_id: The fabric specific object Id of the virtual machine. + :vartype fabric_object_id: str + :ivar primary_location: The primary location for the virtual machine. + :vartype primary_location: str + :ivar recovery_location: The recovery location for the virtual machine. + :vartype recovery_location: str + :ivar recovery_subscription_id: The recovery subscription Id of the virtual machine. + :vartype recovery_subscription_id: str + :ivar vm_disks: The list of vm disk details. + :vartype vm_disks: + list[~azure.mgmt.recoveryservicessiterecovery.models.A2AProtectionIntentDiskInputDetails] + :ivar vm_managed_disks: The list of vm managed disk details. + :vartype vm_managed_disks: + list[~azure.mgmt.recoveryservicessiterecovery.models.A2AProtectionIntentManagedDiskInputDetails] + :ivar recovery_resource_group_id: The recovery resource group id. + :vartype recovery_resource_group_id: str + :ivar protection_profile: The protection profile custom details. + :vartype protection_profile: + ~azure.mgmt.recoveryservicessiterecovery.models.ProtectionProfileCustomDetails + :ivar primary_staging_storage_account: The primary staging storage account details. + :vartype primary_staging_storage_account: + ~azure.mgmt.recoveryservicessiterecovery.models.StorageAccountCustomDetails + :ivar recovery_availability_set: The recovery availability set details. + :vartype recovery_availability_set: + ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryAvailabilitySetCustomDetails + :ivar recovery_virtual_network: The recovery virtual network details. + :vartype recovery_virtual_network: + ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryVirtualNetworkCustomDetails + :ivar recovery_proximity_placement_group: The recovery proximity placement group custom + details. + :vartype recovery_proximity_placement_group: + ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryProximityPlacementGroupCustomDetails + :ivar auto_protection_of_data_disk: A value indicating whether the auto protection is enabled. + Known values are: "Disabled" and "Enabled". + :vartype auto_protection_of_data_disk: str or + ~azure.mgmt.recoveryservicessiterecovery.models.AutoProtectionOfDataDisk + :ivar multi_vm_group_name: The multi vm group name. + :vartype multi_vm_group_name: str + :ivar multi_vm_group_id: The multi vm group id. + :vartype multi_vm_group_id: str + :ivar recovery_boot_diag_storage_account: The boot diagnostic storage account. + :vartype recovery_boot_diag_storage_account: + ~azure.mgmt.recoveryservicessiterecovery.models.StorageAccountCustomDetails + :ivar disk_encryption_info: The recovery disk encryption information (for two pass flows). + :vartype disk_encryption_info: + ~azure.mgmt.recoveryservicessiterecovery.models.DiskEncryptionInfo + :ivar recovery_availability_zone: The recovery availability zone. + :vartype recovery_availability_zone: str + :ivar recovery_availability_type: The recovery availability type of the virtual machine. + Required. + :vartype recovery_availability_type: str + :ivar agent_auto_update_status: A value indicating whether the auto update is enabled. Known + values are: "Disabled" and "Enabled". + :vartype agent_auto_update_status: str or + ~azure.mgmt.recoveryservicessiterecovery.models.AgentAutoUpdateStatus + :ivar automation_account_arm_id: The automation account arm id. + :vartype automation_account_arm_id: str + :ivar automation_account_authentication_type: A value indicating the type authentication to use + for automation Account. Known values are: "RunAsAccount" and "SystemAssignedIdentity". + :vartype automation_account_authentication_type: str or + ~azure.mgmt.recoveryservicessiterecovery.models.AutomationAccountAuthenticationType + :ivar instance_type: Gets the Instance type. Required. Default value is "A2A". + :vartype instance_type: str + """ + + fabric_object_id: Optional[str] = rest_field( + name="fabricObjectId", visibility=["read", "create", "update", "delete", "query"] + ) + """The fabric specific object Id of the virtual machine.""" + primary_location: Optional[str] = rest_field( + name="primaryLocation", visibility=["read", "create", "update", "delete", "query"] + ) + """The primary location for the virtual machine.""" + recovery_location: Optional[str] = rest_field( + name="recoveryLocation", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery location for the virtual machine.""" + recovery_subscription_id: Optional[str] = rest_field( + name="recoverySubscriptionId", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery subscription Id of the virtual machine.""" + vm_disks: Optional[list["_models.A2AProtectionIntentDiskInputDetails"]] = rest_field( + name="vmDisks", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of vm disk details.""" + vm_managed_disks: Optional[list["_models.A2AProtectionIntentManagedDiskInputDetails"]] = rest_field( + name="vmManagedDisks", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of vm managed disk details.""" + recovery_resource_group_id: Optional[str] = rest_field( + name="recoveryResourceGroupId", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery resource group id.""" + protection_profile: Optional["_models.ProtectionProfileCustomDetails"] = rest_field( + name="protectionProfile", visibility=["read", "create", "update", "delete", "query"] + ) + """The protection profile custom details.""" + primary_staging_storage_account: Optional["_models.StorageAccountCustomDetails"] = rest_field( + name="primaryStagingStorageAccount", visibility=["read", "create", "update", "delete", "query"] + ) + """The primary staging storage account details.""" + recovery_availability_set: Optional["_models.RecoveryAvailabilitySetCustomDetails"] = rest_field( + name="recoveryAvailabilitySet", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery availability set details.""" + recovery_virtual_network: Optional["_models.RecoveryVirtualNetworkCustomDetails"] = rest_field( + name="recoveryVirtualNetwork", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery virtual network details.""" + recovery_proximity_placement_group: Optional["_models.RecoveryProximityPlacementGroupCustomDetails"] = rest_field( + name="recoveryProximityPlacementGroup", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery proximity placement group custom details.""" + auto_protection_of_data_disk: Optional[Union[str, "_models.AutoProtectionOfDataDisk"]] = rest_field( + name="autoProtectionOfDataDisk", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether the auto protection is enabled. Known values are: \"Disabled\" and + \"Enabled\".""" + multi_vm_group_name: Optional[str] = rest_field( + name="multiVmGroupName", visibility=["read", "create", "update", "delete", "query"] + ) + """The multi vm group name.""" + multi_vm_group_id: Optional[str] = rest_field( + name="multiVmGroupId", visibility=["read", "create", "update", "delete", "query"] + ) + """The multi vm group id.""" + recovery_boot_diag_storage_account: Optional["_models.StorageAccountCustomDetails"] = rest_field( + name="recoveryBootDiagStorageAccount", visibility=["read", "create", "update", "delete", "query"] + ) + """The boot diagnostic storage account.""" + disk_encryption_info: Optional["_models.DiskEncryptionInfo"] = rest_field( + name="diskEncryptionInfo", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery disk encryption information (for two pass flows).""" + recovery_availability_zone: Optional[str] = rest_field( + name="recoveryAvailabilityZone", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery availability zone.""" + recovery_availability_type: str = rest_field( + name="recoveryAvailabilityType", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery availability type of the virtual machine. Required.""" + agent_auto_update_status: Optional[Union[str, "_models.AgentAutoUpdateStatus"]] = rest_field( + name="agentAutoUpdateStatus", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether the auto update is enabled. Known values are: \"Disabled\" and + \"Enabled\".""" + automation_account_arm_id: Optional[str] = rest_field( + name="automationAccountArmId", visibility=["read", "create", "update", "delete", "query"] + ) + """The automation account arm id.""" + automation_account_authentication_type: Optional[Union[str, "_models.AutomationAccountAuthenticationType"]] = ( + rest_field( + name="automationAccountAuthenticationType", visibility=["read", "create", "update", "delete", "query"] + ) + ) + """A value indicating the type authentication to use for automation Account. Known values are: + \"RunAsAccount\" and \"SystemAssignedIdentity\".""" + instance_type: Literal["A2A"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets the Instance type. Required. Default value is \"A2A\".""" + + @overload + def __init__( + self, + *, + recovery_availability_type: str, + fabric_object_id: Optional[str] = None, + primary_location: Optional[str] = None, + recovery_location: Optional[str] = None, + recovery_subscription_id: Optional[str] = None, + vm_disks: Optional[list["_models.A2AProtectionIntentDiskInputDetails"]] = None, + vm_managed_disks: Optional[list["_models.A2AProtectionIntentManagedDiskInputDetails"]] = None, + recovery_resource_group_id: Optional[str] = None, + protection_profile: Optional["_models.ProtectionProfileCustomDetails"] = None, + primary_staging_storage_account: Optional["_models.StorageAccountCustomDetails"] = None, + recovery_availability_set: Optional["_models.RecoveryAvailabilitySetCustomDetails"] = None, + recovery_virtual_network: Optional["_models.RecoveryVirtualNetworkCustomDetails"] = None, + recovery_proximity_placement_group: Optional["_models.RecoveryProximityPlacementGroupCustomDetails"] = None, + auto_protection_of_data_disk: Optional[Union[str, "_models.AutoProtectionOfDataDisk"]] = None, + multi_vm_group_name: Optional[str] = None, + multi_vm_group_id: Optional[str] = None, + recovery_boot_diag_storage_account: Optional["_models.StorageAccountCustomDetails"] = None, + disk_encryption_info: Optional["_models.DiskEncryptionInfo"] = None, + recovery_availability_zone: Optional[str] = None, + agent_auto_update_status: Optional[Union[str, "_models.AgentAutoUpdateStatus"]] = None, + automation_account_arm_id: Optional[str] = None, + automation_account_authentication_type: Optional[ + Union[str, "_models.AutomationAccountAuthenticationType"] + ] = 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) + self.instance_type = "A2A" # type: ignore + + +class ReplicationClusterProviderSpecificSettings(_Model): # pylint: disable=name-too-long + """Replication cluster provider specific settings. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + A2AReplicationProtectionClusterDetails + + :ivar instance_type: Gets the Instance type. Required. Default value is None. + :vartype instance_type: str + """ + + __mapping__: dict[str, _Model] = {} + instance_type: str = rest_discriminator( + name="instanceType", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets the Instance type. Required. Default value is None.""" + + @overload + def __init__( + self, + *, + instance_type: str, + ) -> 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 A2AReplicationProtectionClusterDetails(ReplicationClusterProviderSpecificSettings, discriminator="A2A"): + """A2A provider specific settings. + + :ivar multi_vm_group_id: The multi vm group Id. + :vartype multi_vm_group_id: str + :ivar multi_vm_group_name: The multi vm group name. + :vartype multi_vm_group_name: str + :ivar multi_vm_group_create_option: Whether Multi VM group is auto created or specified by + user. Known values are: "AutoCreated" and "UserSpecified". + :vartype multi_vm_group_create_option: str or + ~azure.mgmt.recoveryservicessiterecovery.models.MultiVmGroupCreateOption + :ivar primary_fabric_location: Primary fabric location. + :vartype primary_fabric_location: str + :ivar recovery_fabric_location: The recovery fabric location. + :vartype recovery_fabric_location: str + :ivar failover_recovery_point_id: The recovery point Id to which the cluster was failed over. + :vartype failover_recovery_point_id: str + :ivar cluster_management_id: The cluster management Id. + :vartype cluster_management_id: str + :ivar rpo_in_seconds: The last RPO value in seconds. + :vartype rpo_in_seconds: int + :ivar last_rpo_calculated_time: The time (in UTC) when the last RPO value was calculated by + Protection Service. + :vartype last_rpo_calculated_time: ~datetime.datetime + :ivar initial_primary_zone: The initial primary availability zone. + :vartype initial_primary_zone: str + :ivar initial_primary_fabric_location: The initial primary fabric location. + :vartype initial_primary_fabric_location: str + :ivar initial_recovery_zone: The initial recovery availability zone. + :vartype initial_recovery_zone: str + :ivar initial_recovery_fabric_location: The initial recovery fabric location. + :vartype initial_recovery_fabric_location: str + :ivar initial_primary_extended_location: The initial primary extended location. + :vartype initial_primary_extended_location: + ~azure.mgmt.recoveryservicessiterecovery.models.ExtendedLocation + :ivar initial_recovery_extended_location: The initial recovery extended location. + :vartype initial_recovery_extended_location: + ~azure.mgmt.recoveryservicessiterecovery.models.ExtendedLocation + :ivar primary_availability_zone: The primary availability zone. + :vartype primary_availability_zone: str + :ivar recovery_availability_zone: The recovery availability zone. + :vartype recovery_availability_zone: str + :ivar primary_extended_location: The primary Extended Location. + :vartype primary_extended_location: + ~azure.mgmt.recoveryservicessiterecovery.models.ExtendedLocation + :ivar recovery_extended_location: The recovery Extended Location. + :vartype recovery_extended_location: + ~azure.mgmt.recoveryservicessiterecovery.models.ExtendedLocation + :ivar lifecycle_id: An id that survives actions like switch protection which change the backing + PE/CPE objects internally.The lifecycle id gets carried forward to have a link/continuity in + being able to have an Id that denotes the "same" protected cluster even though other internal + Ids/ARM Id might be changing. + :vartype lifecycle_id: str + :ivar instance_type: Gets the Instance type. Required. Default value is "A2A". + :vartype instance_type: str + """ + + multi_vm_group_id: Optional[str] = rest_field( + name="multiVmGroupId", visibility=["read", "create", "update", "delete", "query"] + ) + """The multi vm group Id.""" + multi_vm_group_name: Optional[str] = rest_field( + name="multiVmGroupName", visibility=["read", "create", "update", "delete", "query"] + ) + """The multi vm group name.""" + multi_vm_group_create_option: Optional[Union[str, "_models.MultiVmGroupCreateOption"]] = rest_field( + name="multiVmGroupCreateOption", visibility=["read", "create", "update", "delete", "query"] + ) + """Whether Multi VM group is auto created or specified by user. Known values are: \"AutoCreated\" + and \"UserSpecified\".""" + primary_fabric_location: Optional[str] = rest_field( + name="primaryFabricLocation", visibility=["read", "create", "update", "delete", "query"] + ) + """Primary fabric location.""" + recovery_fabric_location: Optional[str] = rest_field( + name="recoveryFabricLocation", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery fabric location.""" + failover_recovery_point_id: Optional[str] = rest_field( + name="failoverRecoveryPointId", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery point Id to which the cluster was failed over.""" + cluster_management_id: Optional[str] = rest_field( + name="clusterManagementId", visibility=["read", "create", "update", "delete", "query"] + ) + """The cluster management Id.""" + rpo_in_seconds: Optional[int] = rest_field( + name="rpoInSeconds", visibility=["read", "create", "update", "delete", "query"] + ) + """The last RPO value in seconds.""" + last_rpo_calculated_time: Optional[datetime.datetime] = rest_field( + name="lastRpoCalculatedTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The time (in UTC) when the last RPO value was calculated by Protection Service.""" + initial_primary_zone: Optional[str] = rest_field( + name="initialPrimaryZone", visibility=["read", "create", "update", "delete", "query"] + ) + """The initial primary availability zone.""" + initial_primary_fabric_location: Optional[str] = rest_field( + name="initialPrimaryFabricLocation", visibility=["read", "create", "update", "delete", "query"] + ) + """The initial primary fabric location.""" + initial_recovery_zone: Optional[str] = rest_field( + name="initialRecoveryZone", visibility=["read", "create", "update", "delete", "query"] + ) + """The initial recovery availability zone.""" + initial_recovery_fabric_location: Optional[str] = rest_field( + name="initialRecoveryFabricLocation", visibility=["read", "create", "update", "delete", "query"] + ) + """The initial recovery fabric location.""" + initial_primary_extended_location: Optional["_models.ExtendedLocation"] = rest_field( + name="initialPrimaryExtendedLocation", visibility=["read", "create", "update", "delete", "query"] + ) + """The initial primary extended location.""" + initial_recovery_extended_location: Optional["_models.ExtendedLocation"] = rest_field( + name="initialRecoveryExtendedLocation", visibility=["read", "create", "update", "delete", "query"] + ) + """The initial recovery extended location.""" + primary_availability_zone: Optional[str] = rest_field( + name="primaryAvailabilityZone", visibility=["read", "create", "update", "delete", "query"] + ) + """The primary availability zone.""" + recovery_availability_zone: Optional[str] = rest_field( + name="recoveryAvailabilityZone", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery availability zone.""" + primary_extended_location: Optional["_models.ExtendedLocation"] = rest_field( + name="primaryExtendedLocation", visibility=["read", "create", "update", "delete", "query"] + ) + """The primary Extended Location.""" + recovery_extended_location: Optional["_models.ExtendedLocation"] = rest_field( + name="recoveryExtendedLocation", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery Extended Location.""" + lifecycle_id: Optional[str] = rest_field( + name="lifecycleId", visibility=["read", "create", "update", "delete", "query"] + ) + """An id that survives actions like switch protection which change the backing PE/CPE objects + internally.The lifecycle id gets carried forward to have a link/continuity in being able to + have an Id that denotes the \"same\" protected cluster even though other internal Ids/ARM Id + might be changing.""" + instance_type: Literal["A2A"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets the Instance type. Required. Default value is \"A2A\".""" + + @overload + def __init__( + self, + *, + multi_vm_group_id: Optional[str] = None, + multi_vm_group_name: Optional[str] = None, + multi_vm_group_create_option: Optional[Union[str, "_models.MultiVmGroupCreateOption"]] = None, + primary_fabric_location: Optional[str] = None, + recovery_fabric_location: Optional[str] = None, + failover_recovery_point_id: Optional[str] = None, + cluster_management_id: Optional[str] = None, + rpo_in_seconds: Optional[int] = None, + last_rpo_calculated_time: Optional[datetime.datetime] = None, + initial_primary_zone: Optional[str] = None, + initial_primary_fabric_location: Optional[str] = None, + initial_recovery_zone: Optional[str] = None, + initial_recovery_fabric_location: Optional[str] = None, + initial_primary_extended_location: Optional["_models.ExtendedLocation"] = None, + initial_recovery_extended_location: Optional["_models.ExtendedLocation"] = None, + primary_availability_zone: Optional[str] = None, + recovery_availability_zone: Optional[str] = None, + primary_extended_location: Optional["_models.ExtendedLocation"] = None, + recovery_extended_location: Optional["_models.ExtendedLocation"] = None, + lifecycle_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) + self.instance_type = "A2A" # type: ignore + + +class ReverseReplicationProviderSpecificInput(_Model): + """Provider specific reverse replication input. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + A2AReprotectInput, HyperVReplicaAzureReprotectInput, InMageReprotectInput, + InMageAzureV2ReprotectInput, InMageRcmReprotectInput, InMageRcmFailbackReprotectInput + + :ivar instance_type: The class type. Required. Default value is None. + :vartype instance_type: str + """ + + __mapping__: dict[str, _Model] = {} + instance_type: str = rest_discriminator( + name="instanceType", visibility=["read", "create", "update", "delete", "query"] + ) + """The class type. Required. Default value is None.""" + + @overload + def __init__( + self, + *, + instance_type: str, + ) -> 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 A2AReprotectInput(ReverseReplicationProviderSpecificInput, discriminator="A2A"): + """Azure specific reprotect input. + + :ivar recovery_container_id: The recovery container Id. + :vartype recovery_container_id: str + :ivar vm_disks: The list of vm disk details. + :vartype vm_disks: list[~azure.mgmt.recoveryservicessiterecovery.models.A2AVmDiskInputDetails] + :ivar recovery_resource_group_id: The recovery resource group Id. Valid for V2 scenarios. + :vartype recovery_resource_group_id: str + :ivar recovery_cloud_service_id: The recovery cloud service Id. Valid for V1 scenarios. + :vartype recovery_cloud_service_id: str + :ivar recovery_availability_set_id: The recovery availability set. + :vartype recovery_availability_set_id: str + :ivar policy_id: The Policy Id. + :vartype policy_id: str + :ivar instance_type: The class type. Required. Default value is "A2A". + :vartype instance_type: str + """ + + recovery_container_id: Optional[str] = rest_field( + name="recoveryContainerId", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery container Id.""" + vm_disks: Optional[list["_models.A2AVmDiskInputDetails"]] = rest_field( + name="vmDisks", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of vm disk details.""" + recovery_resource_group_id: Optional[str] = rest_field( + name="recoveryResourceGroupId", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery resource group Id. Valid for V2 scenarios.""" + recovery_cloud_service_id: Optional[str] = rest_field( + name="recoveryCloudServiceId", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery cloud service Id. Valid for V1 scenarios.""" + recovery_availability_set_id: Optional[str] = rest_field( + name="recoveryAvailabilitySetId", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery availability set.""" + policy_id: Optional[str] = rest_field(name="policyId", visibility=["read", "create", "update", "delete", "query"]) + """The Policy Id.""" + instance_type: Literal["A2A"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The class type. Required. Default value is \"A2A\".""" + + @overload + def __init__( + self, + *, + recovery_container_id: Optional[str] = None, + vm_disks: Optional[list["_models.A2AVmDiskInputDetails"]] = None, + recovery_resource_group_id: Optional[str] = None, + recovery_cloud_service_id: Optional[str] = None, + recovery_availability_set_id: Optional[str] = None, + policy_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) + self.instance_type = "A2A" # type: ignore + + +class A2ASharedDiskIRErrorDetails(_Model): + """Extended location of the resource. + + :ivar error_code: The error code. + :vartype error_code: str + :ivar error_code_enum: The error code enum. + :vartype error_code_enum: str + :ivar error_message: The error message. + :vartype error_message: str + :ivar possible_causes: The possible causes. + :vartype possible_causes: str + :ivar recommended_action: The recommended action. + :vartype recommended_action: str + """ + + error_code: Optional[str] = rest_field(name="errorCode", visibility=["read"]) + """The error code.""" + error_code_enum: Optional[str] = rest_field(name="errorCodeEnum", visibility=["read"]) + """The error code enum.""" + error_message: Optional[str] = rest_field(name="errorMessage", visibility=["read"]) + """The error message.""" + possible_causes: Optional[str] = rest_field(name="possibleCauses", visibility=["read"]) + """The possible causes.""" + recommended_action: Optional[str] = rest_field(name="recommendedAction", visibility=["read"]) + """The recommended action.""" + + +class SharedDiskReplicationProviderSpecificSettings(_Model): # pylint: disable=name-too-long + """Replication provider specific settings. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + A2ASharedDiskReplicationDetails + + :ivar instance_type: Gets the Instance type. Required. Default value is None. + :vartype instance_type: str + """ + + __mapping__: dict[str, _Model] = {} + instance_type: str = rest_discriminator( + name="instanceType", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets the Instance type. Required. Default value is None.""" + + @overload + def __init__( + self, + *, + instance_type: str, + ) -> 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 A2ASharedDiskReplicationDetails(SharedDiskReplicationProviderSpecificSettings, discriminator="A2A"): + """A2A provider specific settings. + + :ivar management_id: The management Id. + :vartype management_id: str + :ivar unprotected_disks: The list of unprotected disks. + :vartype unprotected_disks: + list[~azure.mgmt.recoveryservicessiterecovery.models.A2AUnprotectedDiskDetails] + :ivar protected_managed_disks: The list of protected managed disks. + :vartype protected_managed_disks: + list[~azure.mgmt.recoveryservicessiterecovery.models.A2AProtectedManagedDiskDetails] + :ivar primary_fabric_location: Primary fabric location. + :vartype primary_fabric_location: str + :ivar recovery_fabric_location: The recovery fabric location. + :vartype recovery_fabric_location: str + :ivar failover_recovery_point_id: The recovery point id to which the Virtual node was failed + over. + :vartype failover_recovery_point_id: str + :ivar monitoring_percentage_completion: The percentage of the monitoring job. The type of the + monitoring job is defined by MonitoringJobType property. + :vartype monitoring_percentage_completion: int + :ivar monitoring_job_type: The type of the monitoring job. The progress is contained in + MonitoringPercentageCompletion property. + :vartype monitoring_job_type: str + :ivar rpo_in_seconds: The last RPO value in seconds. + :vartype rpo_in_seconds: int + :ivar last_rpo_calculated_time: The time (in UTC) when the last RPO value was calculated by + Protection Service. + :vartype last_rpo_calculated_time: ~datetime.datetime + :ivar shared_disk_ir_errors: The IR Errors. + :vartype shared_disk_ir_errors: + list[~azure.mgmt.recoveryservicessiterecovery.models.A2ASharedDiskIRErrorDetails] + :ivar instance_type: Gets the Instance type. Required. Default value is "A2A". + :vartype instance_type: str + """ + + management_id: Optional[str] = rest_field( + name="managementId", visibility=["read", "create", "update", "delete", "query"] + ) + """The management Id.""" + unprotected_disks: Optional[list["_models.A2AUnprotectedDiskDetails"]] = rest_field( + name="unprotectedDisks", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of unprotected disks.""" + protected_managed_disks: Optional[list["_models.A2AProtectedManagedDiskDetails"]] = rest_field( + name="protectedManagedDisks", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of protected managed disks.""" + primary_fabric_location: Optional[str] = rest_field( + name="primaryFabricLocation", visibility=["read", "create", "update", "delete", "query"] + ) + """Primary fabric location.""" + recovery_fabric_location: Optional[str] = rest_field( + name="recoveryFabricLocation", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery fabric location.""" + failover_recovery_point_id: Optional[str] = rest_field( + name="failoverRecoveryPointId", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery point id to which the Virtual node was failed over.""" + monitoring_percentage_completion: Optional[int] = rest_field( + name="monitoringPercentageCompletion", visibility=["read", "create", "update", "delete", "query"] + ) + """The percentage of the monitoring job. The type of the monitoring job is defined by + MonitoringJobType property.""" + monitoring_job_type: Optional[str] = rest_field( + name="monitoringJobType", visibility=["read", "create", "update", "delete", "query"] + ) + """The type of the monitoring job. The progress is contained in MonitoringPercentageCompletion + property.""" + rpo_in_seconds: Optional[int] = rest_field( + name="rpoInSeconds", visibility=["read", "create", "update", "delete", "query"] + ) + """The last RPO value in seconds.""" + last_rpo_calculated_time: Optional[datetime.datetime] = rest_field( + name="lastRpoCalculatedTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The time (in UTC) when the last RPO value was calculated by Protection Service.""" + shared_disk_ir_errors: Optional[list["_models.A2ASharedDiskIRErrorDetails"]] = rest_field( + name="sharedDiskIRErrors", visibility=["read", "create", "update", "delete", "query"] + ) + """The IR Errors.""" + instance_type: Literal["A2A"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets the Instance type. Required. Default value is \"A2A\".""" + + @overload + def __init__( + self, + *, + management_id: Optional[str] = None, + unprotected_disks: Optional[list["_models.A2AUnprotectedDiskDetails"]] = None, + protected_managed_disks: Optional[list["_models.A2AProtectedManagedDiskDetails"]] = None, + primary_fabric_location: Optional[str] = None, + recovery_fabric_location: Optional[str] = None, + failover_recovery_point_id: Optional[str] = None, + monitoring_percentage_completion: Optional[int] = None, + monitoring_job_type: Optional[str] = None, + rpo_in_seconds: Optional[int] = None, + last_rpo_calculated_time: Optional[datetime.datetime] = None, + shared_disk_ir_errors: Optional[list["_models.A2ASharedDiskIRErrorDetails"]] = 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) + self.instance_type = "A2A" # type: ignore + + +class SwitchClusterProtectionProviderSpecificInput(_Model): # pylint: disable=name-too-long + """Provider specific switch cluster protection input. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + A2ASwitchClusterProtectionInput + + :ivar instance_type: Gets the Instance type. Required. Default value is None. + :vartype instance_type: str + """ + + __mapping__: dict[str, _Model] = {} + instance_type: str = rest_discriminator( + name="instanceType", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets the Instance type. Required. Default value is None.""" + + @overload + def __init__( + self, + *, + instance_type: str, + ) -> 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 A2ASwitchClusterProtectionInput(SwitchClusterProtectionProviderSpecificInput, discriminator="A2A"): + """A2A specific switch cluster protection input. + + :ivar recovery_container_id: The recovery container Id. + :vartype recovery_container_id: str + :ivar policy_id: The Policy Id. + :vartype policy_id: str + :ivar protected_items_detail: + :vartype protected_items_detail: + list[~azure.mgmt.recoveryservicessiterecovery.models.A2AProtectedItemDetail] + :ivar instance_type: Gets the Instance type. Required. Default value is "A2A". + :vartype instance_type: str + """ + + recovery_container_id: Optional[str] = rest_field( + name="recoveryContainerId", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery container Id.""" + policy_id: Optional[str] = rest_field(name="policyId", visibility=["read", "create", "update", "delete", "query"]) + """The Policy Id.""" + protected_items_detail: Optional[list["_models.A2AProtectedItemDetail"]] = rest_field( + name="protectedItemsDetail", visibility=["read", "create", "update", "delete", "query"] + ) + instance_type: Literal["A2A"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets the Instance type. Required. Default value is \"A2A\".""" + + @overload + def __init__( + self, + *, + recovery_container_id: Optional[str] = None, + policy_id: Optional[str] = None, + protected_items_detail: Optional[list["_models.A2AProtectedItemDetail"]] = 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) + self.instance_type = "A2A" # type: ignore + + +class SwitchProtectionProviderSpecificInput(_Model): + """Provider specific switch protection input. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + A2ASwitchProtectionInput + + :ivar instance_type: Gets the Instance type. Required. Default value is None. + :vartype instance_type: str + """ + + __mapping__: dict[str, _Model] = {} + instance_type: str = rest_discriminator( + name="instanceType", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets the Instance type. Required. Default value is None.""" + + @overload + def __init__( + self, + *, + instance_type: str, + ) -> 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 A2ASwitchProtectionInput(SwitchProtectionProviderSpecificInput, discriminator="A2A"): + """A2A specific switch protection input. + + :ivar recovery_container_id: The recovery container Id. + :vartype recovery_container_id: str + :ivar vm_disks: The list of vm disk details. + :vartype vm_disks: list[~azure.mgmt.recoveryservicessiterecovery.models.A2AVmDiskInputDetails] + :ivar vm_managed_disks: The list of vm managed disk details. + :vartype vm_managed_disks: + list[~azure.mgmt.recoveryservicessiterecovery.models.A2AVmManagedDiskInputDetails] + :ivar recovery_resource_group_id: The recovery resource group Id. Valid for V2 scenarios. + :vartype recovery_resource_group_id: str + :ivar recovery_cloud_service_id: The recovery cloud service Id. Valid for V1 scenarios. + :vartype recovery_cloud_service_id: str + :ivar recovery_availability_set_id: The recovery availability set. + :vartype recovery_availability_set_id: str + :ivar policy_id: The Policy Id. + :vartype policy_id: str + :ivar recovery_boot_diag_storage_account_id: The boot diagnostic storage account. + :vartype recovery_boot_diag_storage_account_id: str + :ivar recovery_availability_zone: The recovery availability zone. + :vartype recovery_availability_zone: str + :ivar recovery_proximity_placement_group_id: The recovery proximity placement group Id. + :vartype recovery_proximity_placement_group_id: str + :ivar recovery_virtual_machine_scale_set_id: The virtual machine scale set id. + :vartype recovery_virtual_machine_scale_set_id: str + :ivar recovery_capacity_reservation_group_id: The recovery capacity reservation group Id. + :vartype recovery_capacity_reservation_group_id: str + :ivar platform_fault_domain: the platform fault domain. + :vartype platform_fault_domain: int + :ivar disk_encryption_info: The recovery disk encryption information. + :vartype disk_encryption_info: + ~azure.mgmt.recoveryservicessiterecovery.models.DiskEncryptionInfo + :ivar instance_type: Gets the Instance type. Required. Default value is "A2A". + :vartype instance_type: str + """ + + recovery_container_id: Optional[str] = rest_field( + name="recoveryContainerId", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery container Id.""" + vm_disks: Optional[list["_models.A2AVmDiskInputDetails"]] = rest_field( + name="vmDisks", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of vm disk details.""" + vm_managed_disks: Optional[list["_models.A2AVmManagedDiskInputDetails"]] = rest_field( + name="vmManagedDisks", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of vm managed disk details.""" + recovery_resource_group_id: Optional[str] = rest_field( + name="recoveryResourceGroupId", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery resource group Id. Valid for V2 scenarios.""" + recovery_cloud_service_id: Optional[str] = rest_field( + name="recoveryCloudServiceId", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery cloud service Id. Valid for V1 scenarios.""" + recovery_availability_set_id: Optional[str] = rest_field( + name="recoveryAvailabilitySetId", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery availability set.""" + policy_id: Optional[str] = rest_field(name="policyId", visibility=["read", "create", "update", "delete", "query"]) + """The Policy Id.""" + recovery_boot_diag_storage_account_id: Optional[str] = rest_field( + name="recoveryBootDiagStorageAccountId", visibility=["read", "create", "update", "delete", "query"] + ) + """The boot diagnostic storage account.""" + recovery_availability_zone: Optional[str] = rest_field( + name="recoveryAvailabilityZone", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery availability zone.""" + recovery_proximity_placement_group_id: Optional[str] = rest_field( + name="recoveryProximityPlacementGroupId", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery proximity placement group Id.""" + recovery_virtual_machine_scale_set_id: Optional[str] = rest_field( + name="recoveryVirtualMachineScaleSetId", visibility=["read", "create", "update", "delete", "query"] + ) + """The virtual machine scale set id.""" + recovery_capacity_reservation_group_id: Optional[str] = rest_field( + name="recoveryCapacityReservationGroupId", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery capacity reservation group Id.""" + platform_fault_domain: Optional[int] = rest_field( + name="platformFaultDomain", visibility=["read", "create", "update", "delete", "query"] + ) + """the platform fault domain.""" + disk_encryption_info: Optional["_models.DiskEncryptionInfo"] = rest_field( + name="diskEncryptionInfo", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery disk encryption information.""" + instance_type: Literal["A2A"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets the Instance type. Required. Default value is \"A2A\".""" + + @overload + def __init__( + self, + *, + recovery_container_id: Optional[str] = None, + vm_disks: Optional[list["_models.A2AVmDiskInputDetails"]] = None, + vm_managed_disks: Optional[list["_models.A2AVmManagedDiskInputDetails"]] = None, + recovery_resource_group_id: Optional[str] = None, + recovery_cloud_service_id: Optional[str] = None, + recovery_availability_set_id: Optional[str] = None, + policy_id: Optional[str] = None, + recovery_boot_diag_storage_account_id: Optional[str] = None, + recovery_availability_zone: Optional[str] = None, + recovery_proximity_placement_group_id: Optional[str] = None, + recovery_virtual_machine_scale_set_id: Optional[str] = None, + recovery_capacity_reservation_group_id: Optional[str] = None, + platform_fault_domain: Optional[int] = None, + disk_encryption_info: Optional["_models.DiskEncryptionInfo"] = 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) + self.instance_type = "A2A" # type: ignore + + +class TestFailoverProviderSpecificInput(_Model): + """Provider specific test failover input. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + A2ATestFailoverInput, HyperVReplicaAzureTestFailoverInput, InMageTestFailoverInput, + InMageAzureV2TestFailoverInput, InMageRcmTestFailoverInput + + :ivar instance_type: The class type. Required. Default value is None. + :vartype instance_type: str + """ + + __mapping__: dict[str, _Model] = {} + instance_type: str = rest_discriminator( + name="instanceType", visibility=["read", "create", "update", "delete", "query"] + ) + """The class type. Required. Default value is None.""" + + @overload + def __init__( + self, + *, + instance_type: str, + ) -> 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 A2ATestFailoverInput(TestFailoverProviderSpecificInput, discriminator="A2A"): + """A2A provider specific input for test failover. + + :ivar recovery_point_id: The recovery point id to be passed to test failover to a particular + recovery point. In case of latest recovery point, null should be passed. + :vartype recovery_point_id: str + :ivar cloud_service_creation_option: A value indicating whether to use recovery cloud service + for TFO or not. + :vartype cloud_service_creation_option: str + :ivar instance_type: The class type. Required. Default value is "A2A". + :vartype instance_type: str + """ + + recovery_point_id: Optional[str] = rest_field( + name="recoveryPointId", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery point id to be passed to test failover to a particular recovery point. In case of + latest recovery point, null should be passed.""" + cloud_service_creation_option: Optional[str] = rest_field( + name="cloudServiceCreationOption", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether to use recovery cloud service for TFO or not.""" + instance_type: Literal["A2A"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The class type. Required. Default value is \"A2A\".""" + + @overload + def __init__( + self, + *, + recovery_point_id: Optional[str] = None, + cloud_service_creation_option: 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) + self.instance_type = "A2A" # type: ignore + + +class UnplannedFailoverProviderSpecificInput(_Model): + """Provider specific unplanned failover input. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + A2AUnplannedFailoverInput, HyperVReplicaAzureUnplannedFailoverInput, + InMageUnplannedFailoverInput, InMageAzureV2UnplannedFailoverInput, + InMageRcmUnplannedFailoverInput + + :ivar instance_type: The class type. Required. Default value is None. + :vartype instance_type: str + """ + + __mapping__: dict[str, _Model] = {} + instance_type: str = rest_discriminator( + name="instanceType", visibility=["read", "create", "update", "delete", "query"] + ) + """The class type. Required. Default value is None.""" + + @overload + def __init__( + self, + *, + instance_type: str, + ) -> 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 A2AUnplannedFailoverInput(UnplannedFailoverProviderSpecificInput, discriminator="A2A"): + """A2A provider specific input for unplanned failover. + + :ivar recovery_point_id: The recovery point id to be passed to failover to a particular + recovery point. In case of latest recovery point, null should be passed. + :vartype recovery_point_id: str + :ivar cloud_service_creation_option: A value indicating whether to use recovery cloud service + for failover or not. + :vartype cloud_service_creation_option: str + :ivar instance_type: The class type. Required. Default value is "A2A". + :vartype instance_type: str + """ + + recovery_point_id: Optional[str] = rest_field( + name="recoveryPointId", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery point id to be passed to failover to a particular recovery point. In case of + latest recovery point, null should be passed.""" + cloud_service_creation_option: Optional[str] = rest_field( + name="cloudServiceCreationOption", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether to use recovery cloud service for failover or not.""" + instance_type: Literal["A2A"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The class type. Required. Default value is \"A2A\".""" + + @overload + def __init__( + self, + *, + recovery_point_id: Optional[str] = None, + cloud_service_creation_option: 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) + self.instance_type = "A2A" # type: ignore + + +class A2AUnprotectedDiskDetails(_Model): + """A2A unprotected disk details. + + :ivar disk_lun_id: The source lun Id for the data disk. + :vartype disk_lun_id: int + :ivar disk_auto_protection_status: A value indicating whether the disk auto protection is + enabled. Known values are: "Disabled" and "Enabled". + :vartype disk_auto_protection_status: str or + ~azure.mgmt.recoveryservicessiterecovery.models.AutoProtectionOfDataDisk + """ + + disk_lun_id: Optional[int] = rest_field( + name="diskLunId", visibility=["read", "create", "update", "delete", "query"] + ) + """The source lun Id for the data disk.""" + disk_auto_protection_status: Optional[Union[str, "_models.AutoProtectionOfDataDisk"]] = rest_field( + name="diskAutoProtectionStatus", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether the disk auto protection is enabled. Known values are: \"Disabled\" + and \"Enabled\".""" + + @overload + def __init__( + self, + *, + disk_lun_id: Optional[int] = None, + disk_auto_protection_status: Optional[Union[str, "_models.AutoProtectionOfDataDisk"]] = 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 ReplicationProviderSpecificUpdateContainerMappingInput(_Model): # pylint: disable=name-too-long + """Provider specific input for update pairing operations. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + A2AUpdateContainerMappingInput, InMageRcmUpdateContainerMappingInput + + :ivar instance_type: The class type. Required. Default value is None. + :vartype instance_type: str + """ + + __mapping__: dict[str, _Model] = {} + instance_type: str = rest_discriminator( + name="instanceType", visibility=["read", "create", "update", "delete", "query"] + ) + """The class type. Required. Default value is None.""" + + @overload + def __init__( + self, + *, + instance_type: str, + ) -> 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 A2AUpdateContainerMappingInput(ReplicationProviderSpecificUpdateContainerMappingInput, discriminator="A2A"): + """A2A update protection container mapping. + + :ivar agent_auto_update_status: A value indicating whether the auto update is enabled. Known + values are: "Disabled" and "Enabled". + :vartype agent_auto_update_status: str or + ~azure.mgmt.recoveryservicessiterecovery.models.AgentAutoUpdateStatus + :ivar automation_account_arm_id: The automation account arm id. + :vartype automation_account_arm_id: str + :ivar automation_account_authentication_type: A value indicating the type authentication to use + for automation Account. Known values are: "RunAsAccount" and "SystemAssignedIdentity". + :vartype automation_account_authentication_type: str or + ~azure.mgmt.recoveryservicessiterecovery.models.AutomationAccountAuthenticationType + :ivar instance_type: The class type. Required. Default value is "A2A". + :vartype instance_type: str + """ + + agent_auto_update_status: Optional[Union[str, "_models.AgentAutoUpdateStatus"]] = rest_field( + name="agentAutoUpdateStatus", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether the auto update is enabled. Known values are: \"Disabled\" and + \"Enabled\".""" + automation_account_arm_id: Optional[str] = rest_field( + name="automationAccountArmId", visibility=["read", "create", "update", "delete", "query"] + ) + """The automation account arm id.""" + automation_account_authentication_type: Optional[Union[str, "_models.AutomationAccountAuthenticationType"]] = ( + rest_field( + name="automationAccountAuthenticationType", visibility=["read", "create", "update", "delete", "query"] + ) + ) + """A value indicating the type authentication to use for automation Account. Known values are: + \"RunAsAccount\" and \"SystemAssignedIdentity\".""" + instance_type: Literal["A2A"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The class type. Required. Default value is \"A2A\".""" + + @overload + def __init__( + self, + *, + agent_auto_update_status: Optional[Union[str, "_models.AgentAutoUpdateStatus"]] = None, + automation_account_arm_id: Optional[str] = None, + automation_account_authentication_type: Optional[ + Union[str, "_models.AutomationAccountAuthenticationType"] + ] = 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) + self.instance_type = "A2A" # type: ignore + + +class UpdateReplicationProtectedItemProviderInput(_Model): # pylint: disable=name-too-long + """Update replication protected item provider specific input. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + A2AUpdateReplicationProtectedItemInput, HyperVReplicaAzureUpdateReplicationProtectedItemInput, + InMageAzureV2UpdateReplicationProtectedItemInput, InMageRcmUpdateReplicationProtectedItemInput + + :ivar instance_type: The class type. Required. Default value is None. + :vartype instance_type: str + """ + + __mapping__: dict[str, _Model] = {} + instance_type: str = rest_discriminator( + name="instanceType", visibility=["read", "create", "update", "delete", "query"] + ) + """The class type. Required. Default value is None.""" + + @overload + def __init__( + self, + *, + instance_type: str, + ) -> 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 A2AUpdateReplicationProtectedItemInput(UpdateReplicationProtectedItemProviderInput, discriminator="A2A"): + """InMage Azure V2 input to update replication protected item. + + :ivar recovery_cloud_service_id: The target cloud service ARM Id (for V1). + :vartype recovery_cloud_service_id: str + :ivar recovery_resource_group_id: The target resource group ARM Id (for V2). + :vartype recovery_resource_group_id: str + :ivar managed_disk_update_details: Managed disk update details. + :vartype managed_disk_update_details: + list[~azure.mgmt.recoveryservicessiterecovery.models.A2AVmManagedDiskUpdateDetails] + :ivar recovery_boot_diag_storage_account_id: The boot diagnostic storage account. + :vartype recovery_boot_diag_storage_account_id: str + :ivar disk_encryption_info: The recovery os disk encryption information. + :vartype disk_encryption_info: + ~azure.mgmt.recoveryservicessiterecovery.models.DiskEncryptionInfo + :ivar tfo_azure_vm_name: The user given name for Test Failover VM. + :vartype tfo_azure_vm_name: str + :ivar recovery_proximity_placement_group_id: The recovery proximity placement group Id. + :vartype recovery_proximity_placement_group_id: str + :ivar recovery_virtual_machine_scale_set_id: The recovery virtual machine scale set Id. + :vartype recovery_virtual_machine_scale_set_id: str + :ivar recovery_capacity_reservation_group_id: The recovery capacity reservation group Id. + :vartype recovery_capacity_reservation_group_id: str + :ivar recovery_availability_zone: The recovery availability zone. + :vartype recovery_availability_zone: str + :ivar platform_fault_domain: The platform fault domain. + :vartype platform_fault_domain: int + :ivar instance_type: The class type. Required. Default value is "A2A". + :vartype instance_type: str + """ + + recovery_cloud_service_id: Optional[str] = rest_field( + name="recoveryCloudServiceId", visibility=["read", "create", "update", "delete", "query"] + ) + """The target cloud service ARM Id (for V1).""" + recovery_resource_group_id: Optional[str] = rest_field( + name="recoveryResourceGroupId", visibility=["read", "create", "update", "delete", "query"] + ) + """The target resource group ARM Id (for V2).""" + managed_disk_update_details: Optional[list["_models.A2AVmManagedDiskUpdateDetails"]] = rest_field( + name="managedDiskUpdateDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """Managed disk update details.""" + recovery_boot_diag_storage_account_id: Optional[str] = rest_field( + name="recoveryBootDiagStorageAccountId", visibility=["read", "create", "update", "delete", "query"] + ) + """The boot diagnostic storage account.""" + disk_encryption_info: Optional["_models.DiskEncryptionInfo"] = rest_field( + name="diskEncryptionInfo", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery os disk encryption information.""" + tfo_azure_vm_name: Optional[str] = rest_field( + name="tfoAzureVMName", visibility=["read", "create", "update", "delete", "query"] + ) + """The user given name for Test Failover VM.""" + recovery_proximity_placement_group_id: Optional[str] = rest_field( + name="recoveryProximityPlacementGroupId", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery proximity placement group Id.""" + recovery_virtual_machine_scale_set_id: Optional[str] = rest_field( + name="recoveryVirtualMachineScaleSetId", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery virtual machine scale set Id.""" + recovery_capacity_reservation_group_id: Optional[str] = rest_field( + name="recoveryCapacityReservationGroupId", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery capacity reservation group Id.""" + recovery_availability_zone: Optional[str] = rest_field( + name="recoveryAvailabilityZone", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery availability zone.""" + platform_fault_domain: Optional[int] = rest_field( + name="platformFaultDomain", visibility=["read", "create", "update", "delete", "query"] + ) + """The platform fault domain.""" + instance_type: Literal["A2A"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The class type. Required. Default value is \"A2A\".""" + + @overload + def __init__( + self, + *, + recovery_cloud_service_id: Optional[str] = None, + recovery_resource_group_id: Optional[str] = None, + managed_disk_update_details: Optional[list["_models.A2AVmManagedDiskUpdateDetails"]] = None, + recovery_boot_diag_storage_account_id: Optional[str] = None, + disk_encryption_info: Optional["_models.DiskEncryptionInfo"] = None, + tfo_azure_vm_name: Optional[str] = None, + recovery_proximity_placement_group_id: Optional[str] = None, + recovery_virtual_machine_scale_set_id: Optional[str] = None, + recovery_capacity_reservation_group_id: Optional[str] = None, + recovery_availability_zone: Optional[str] = None, + platform_fault_domain: 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) + self.instance_type = "A2A" # type: ignore + + +class A2AVmDiskInputDetails(_Model): + """A2A disk input details. + + :ivar disk_uri: The disk Uri. Required. + :vartype disk_uri: str + :ivar recovery_azure_storage_account_id: The recovery VHD storage account Id. Required. + :vartype recovery_azure_storage_account_id: str + :ivar primary_staging_azure_storage_account_id: The primary staging storage account Id. + Required. + :vartype primary_staging_azure_storage_account_id: str + """ + + disk_uri: str = rest_field(name="diskUri", visibility=["read", "create", "update", "delete", "query"]) + """The disk Uri. Required.""" + recovery_azure_storage_account_id: str = rest_field( + name="recoveryAzureStorageAccountId", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery VHD storage account Id. Required.""" + primary_staging_azure_storage_account_id: str = rest_field( + name="primaryStagingAzureStorageAccountId", visibility=["read", "create", "update", "delete", "query"] + ) + """The primary staging storage account Id. Required.""" + + @overload + def __init__( + self, + *, + disk_uri: str, + recovery_azure_storage_account_id: str, + primary_staging_azure_storage_account_id: str, + ) -> 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 A2AVmManagedDiskInputDetails(_Model): + """A2A managed disk input details. + + :ivar disk_id: The disk Id. Required. + :vartype disk_id: str + :ivar primary_staging_azure_storage_account_id: The primary staging storage account Arm Id. + Required. + :vartype primary_staging_azure_storage_account_id: str + :ivar recovery_resource_group_id: The target resource group Arm Id. Required. + :vartype recovery_resource_group_id: str + :ivar recovery_replica_disk_account_type: The replica disk type. Its an optional value and will + be same as source disk type if not user provided. + :vartype recovery_replica_disk_account_type: str + :ivar recovery_target_disk_account_type: The target disk type after failover. Its an optional + value and will be same as source disk type if not user provided. + :vartype recovery_target_disk_account_type: str + :ivar recovery_disk_encryption_set_id: The recovery disk encryption set Id. + :vartype recovery_disk_encryption_set_id: str + :ivar disk_encryption_info: The recovery disk encryption information (for one / single pass + flows). + :vartype disk_encryption_info: + ~azure.mgmt.recoveryservicessiterecovery.models.DiskEncryptionInfo + """ + + disk_id: str = rest_field(name="diskId", visibility=["read", "create", "update", "delete", "query"]) + """The disk Id. Required.""" + primary_staging_azure_storage_account_id: str = rest_field( + name="primaryStagingAzureStorageAccountId", visibility=["read", "create", "update", "delete", "query"] + ) + """The primary staging storage account Arm Id. Required.""" + recovery_resource_group_id: str = rest_field( + name="recoveryResourceGroupId", visibility=["read", "create", "update", "delete", "query"] + ) + """The target resource group Arm Id. Required.""" + recovery_replica_disk_account_type: Optional[str] = rest_field( + name="recoveryReplicaDiskAccountType", visibility=["read", "create", "update", "delete", "query"] + ) + """The replica disk type. Its an optional value and will be same as source disk type if not user + provided.""" + recovery_target_disk_account_type: Optional[str] = rest_field( + name="recoveryTargetDiskAccountType", visibility=["read", "create", "update", "delete", "query"] + ) + """The target disk type after failover. Its an optional value and will be same as source disk type + if not user provided.""" + recovery_disk_encryption_set_id: Optional[str] = rest_field( + name="recoveryDiskEncryptionSetId", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery disk encryption set Id.""" + disk_encryption_info: Optional["_models.DiskEncryptionInfo"] = rest_field( + name="diskEncryptionInfo", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery disk encryption information (for one / single pass flows).""" + + @overload + def __init__( + self, + *, + disk_id: str, + primary_staging_azure_storage_account_id: str, + recovery_resource_group_id: str, + recovery_replica_disk_account_type: Optional[str] = None, + recovery_target_disk_account_type: Optional[str] = None, + recovery_disk_encryption_set_id: Optional[str] = None, + disk_encryption_info: Optional["_models.DiskEncryptionInfo"] = 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 A2AVmManagedDiskUpdateDetails(_Model): + """A2A Vm managed disk update details. + + :ivar disk_id: The disk Id. + :vartype disk_id: str + :ivar recovery_target_disk_account_type: The target disk type before failover. + :vartype recovery_target_disk_account_type: str + :ivar recovery_replica_disk_account_type: The replica disk type before failover. + :vartype recovery_replica_disk_account_type: str + :ivar disk_encryption_info: The recovery os disk encryption information. + :vartype disk_encryption_info: + ~azure.mgmt.recoveryservicessiterecovery.models.DiskEncryptionInfo + :ivar failover_disk_name: The target disk name for unplanned failover operation. + :vartype failover_disk_name: str + :ivar tfo_disk_name: The target disk name for test failover operation. + :vartype tfo_disk_name: str + """ + + disk_id: Optional[str] = rest_field(name="diskId", visibility=["read", "create", "update", "delete", "query"]) + """The disk Id.""" + recovery_target_disk_account_type: Optional[str] = rest_field( + name="recoveryTargetDiskAccountType", visibility=["read", "create", "update", "delete", "query"] + ) + """The target disk type before failover.""" + recovery_replica_disk_account_type: Optional[str] = rest_field( + name="recoveryReplicaDiskAccountType", visibility=["read", "create", "update", "delete", "query"] + ) + """The replica disk type before failover.""" + disk_encryption_info: Optional["_models.DiskEncryptionInfo"] = rest_field( + name="diskEncryptionInfo", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery os disk encryption information.""" + failover_disk_name: Optional[str] = rest_field( + name="failoverDiskName", visibility=["read", "create", "update", "delete", "query"] + ) + """The target disk name for unplanned failover operation.""" + tfo_disk_name: Optional[str] = rest_field( + name="tfoDiskName", visibility=["read", "create", "update", "delete", "query"] + ) + """The target disk name for test failover operation.""" + + @overload + def __init__( + self, + *, + disk_id: Optional[str] = None, + recovery_target_disk_account_type: Optional[str] = None, + recovery_replica_disk_account_type: Optional[str] = None, + disk_encryption_info: Optional["_models.DiskEncryptionInfo"] = None, + failover_disk_name: Optional[str] = None, + tfo_disk_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 A2AZoneDetails(_Model): + """Zone details data. + + :ivar source: Source zone info. + :vartype source: str + :ivar target: The target zone info. + :vartype target: str + """ + + source: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Source zone info.""" + target: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The target zone info.""" + + @overload + def __init__( + self, + *, + source: Optional[str] = None, + target: 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 AddDisksInput(_Model): + """Input for add disk(s) operation. + + :ivar properties: Add disks input properties. + :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.AddDisksInputProperties + """ + + properties: Optional["_models.AddDisksInputProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Add disks input properties.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.AddDisksInputProperties"] = 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 AddDisksInputProperties(_Model): + """Add Disks input properties. + + :ivar provider_specific_details: The ReplicationProviderInput. For HyperVReplicaAzure provider, + it will be AzureEnableProtectionInput object. For San provider, it will be + SanEnableProtectionInput object. For HyperVReplicaAzure provider, it can be null. Required. + :vartype provider_specific_details: + ~azure.mgmt.recoveryservicessiterecovery.models.AddDisksProviderSpecificInput + """ + + provider_specific_details: "_models.AddDisksProviderSpecificInput" = rest_field( + name="providerSpecificDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """The ReplicationProviderInput. For HyperVReplicaAzure provider, it will be + AzureEnableProtectionInput object. For San provider, it will be SanEnableProtectionInput + object. For HyperVReplicaAzure provider, it can be null. Required.""" + + @overload + def __init__( + self, + *, + provider_specific_details: "_models.AddDisksProviderSpecificInput", + ) -> 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 AddRecoveryServicesProviderInput(_Model): + """Input required to add a provider. + + :ivar properties: The properties of an add provider request. Required. + :vartype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.AddRecoveryServicesProviderInputProperties + """ + + properties: "_models.AddRecoveryServicesProviderInputProperties" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The properties of an add provider request. Required.""" + + @overload + def __init__( + self, + *, + properties: "_models.AddRecoveryServicesProviderInputProperties", + ) -> 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 AddRecoveryServicesProviderInputProperties(_Model): # pylint: disable=name-too-long + """The properties of an add provider request. + + :ivar machine_name: The name of the machine where the provider is getting added. Required. + :vartype machine_name: str + :ivar machine_id: The Id of the machine where the provider is getting added. + :vartype machine_id: str + :ivar bios_id: The Bios Id of the machine. + :vartype bios_id: str + :ivar authentication_identity_input: The identity provider input for DRA authentication. + Required. + :vartype authentication_identity_input: + ~azure.mgmt.recoveryservicessiterecovery.models.IdentityProviderInput + :ivar resource_access_identity_input: The identity provider input for resource access. + Required. + :vartype resource_access_identity_input: + ~azure.mgmt.recoveryservicessiterecovery.models.IdentityProviderInput + :ivar data_plane_authentication_identity_input: The identity provider input for data plane + authentication. + :vartype data_plane_authentication_identity_input: + ~azure.mgmt.recoveryservicessiterecovery.models.IdentityProviderInput + """ + + machine_name: str = rest_field(name="machineName", visibility=["read", "create", "update", "delete", "query"]) + """The name of the machine where the provider is getting added. Required.""" + machine_id: Optional[str] = rest_field(name="machineId", visibility=["read", "create", "update", "delete", "query"]) + """The Id of the machine where the provider is getting added.""" + bios_id: Optional[str] = rest_field(name="biosId", visibility=["read", "create", "update", "delete", "query"]) + """The Bios Id of the machine.""" + authentication_identity_input: "_models.IdentityProviderInput" = rest_field( + name="authenticationIdentityInput", visibility=["read", "create", "update", "delete", "query"] + ) + """The identity provider input for DRA authentication. Required.""" + resource_access_identity_input: "_models.IdentityProviderInput" = rest_field( + name="resourceAccessIdentityInput", visibility=["read", "create", "update", "delete", "query"] + ) + """The identity provider input for resource access. Required.""" + data_plane_authentication_identity_input: Optional["_models.IdentityProviderInput"] = rest_field( + name="dataPlaneAuthenticationIdentityInput", visibility=["read", "create", "update", "delete", "query"] + ) + """The identity provider input for data plane authentication.""" + + @overload + def __init__( + self, + *, + machine_name: str, + authentication_identity_input: "_models.IdentityProviderInput", + resource_access_identity_input: "_models.IdentityProviderInput", + machine_id: Optional[str] = None, + bios_id: Optional[str] = None, + data_plane_authentication_identity_input: Optional["_models.IdentityProviderInput"] = 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 AddVCenterRequest(_Model): + """Input required to add vCenter. + + :ivar properties: The properties of an add vCenter request. + :vartype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.AddVCenterRequestProperties + """ + + properties: Optional["_models.AddVCenterRequestProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The properties of an add vCenter request.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.AddVCenterRequestProperties"] = 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 AddVCenterRequestProperties(_Model): + """The properties of an add vCenter request. + + :ivar friendly_name: The friendly name of the vCenter. + :vartype friendly_name: str + :ivar ip_address: The IP address of the vCenter to be discovered. + :vartype ip_address: str + :ivar process_server_id: The process server Id from where the discovery is orchestrated. + :vartype process_server_id: str + :ivar port: The port number for discovery. + :vartype port: str + :ivar run_as_account_id: The account Id which has privileges to discover the vCenter. + :vartype run_as_account_id: str + """ + + friendly_name: Optional[str] = rest_field( + name="friendlyName", visibility=["read", "create", "update", "delete", "query"] + ) + """The friendly name of the vCenter.""" + ip_address: Optional[str] = rest_field(name="ipAddress", visibility=["read", "create", "update", "delete", "query"]) + """The IP address of the vCenter to be discovered.""" + process_server_id: Optional[str] = rest_field( + name="processServerId", visibility=["read", "create", "update", "delete", "query"] + ) + """The process server Id from where the discovery is orchestrated.""" + port: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The port number for discovery.""" + run_as_account_id: Optional[str] = rest_field( + name="runAsAccountId", visibility=["read", "create", "update", "delete", "query"] + ) + """The account Id which has privileges to discover the vCenter.""" + + @overload + def __init__( + self, + *, + friendly_name: Optional[str] = None, + ip_address: Optional[str] = None, + process_server_id: Optional[str] = None, + port: Optional[str] = None, + run_as_account_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 AgentDetails(_Model): + """Agent details. + + :ivar agent_id: The Id of the agent running on the server. + :vartype agent_id: str + :ivar machine_id: The Id of the machine to which the agent is registered. + :vartype machine_id: str + :ivar bios_id: The machine BIOS Id. + :vartype bios_id: str + :ivar fqdn: The machine FQDN. + :vartype fqdn: str + :ivar disks: The disks. + :vartype disks: list[~azure.mgmt.recoveryservicessiterecovery.models.AgentDiskDetails] + """ + + agent_id: Optional[str] = rest_field(name="agentId", visibility=["read"]) + """The Id of the agent running on the server.""" + machine_id: Optional[str] = rest_field(name="machineId", visibility=["read"]) + """The Id of the machine to which the agent is registered.""" + bios_id: Optional[str] = rest_field(name="biosId", visibility=["read"]) + """The machine BIOS Id.""" + fqdn: Optional[str] = rest_field(visibility=["read"]) + """The machine FQDN.""" + disks: Optional[list["_models.AgentDiskDetails"]] = rest_field(visibility=["read"]) + """The disks.""" + + +class AgentDiskDetails(_Model): + """Agent disk details. + + :ivar disk_id: The disk Id. + :vartype disk_id: str + :ivar disk_name: The disk name. + :vartype disk_name: str + :ivar is_os_disk: A value indicating whether the disk is the OS disk. + :vartype is_os_disk: str + :ivar capacity_in_bytes: The disk capacity in bytes. + :vartype capacity_in_bytes: int + :ivar lun_id: The lun of disk. + :vartype lun_id: int + """ + + disk_id: Optional[str] = rest_field(name="diskId", visibility=["read"]) + """The disk Id.""" + disk_name: Optional[str] = rest_field(name="diskName", visibility=["read"]) + """The disk name.""" + is_os_disk: Optional[str] = rest_field(name="isOSDisk", visibility=["read"]) + """A value indicating whether the disk is the OS disk.""" + capacity_in_bytes: Optional[int] = rest_field(name="capacityInBytes", visibility=["read"]) + """The disk capacity in bytes.""" + lun_id: Optional[int] = rest_field(name="lunId", visibility=["read"]) + """The lun of disk.""" + + +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.recoveryservicessiterecovery.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.recoveryservicessiterecovery.models.SystemData + """ + + +class Alert(ProxyResource): + """Implements the Alert class. + + :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.recoveryservicessiterecovery.models.SystemData + :ivar properties: Alert related data. + :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.AlertProperties + :ivar location: Resource Location. + :vartype location: str + """ + + properties: Optional["_models.AlertProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Alert related data.""" + location: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource Location.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.AlertProperties"] = None, + location: 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 AlertProperties(_Model): + """The properties of an alert. + + :ivar send_to_owners: A value indicating whether to send email to subscription administrator. + :vartype send_to_owners: str + :ivar custom_email_addresses: The custom email address for sending emails. + :vartype custom_email_addresses: list[str] + :ivar locale: The locale for the email notification. + :vartype locale: str + """ + + send_to_owners: Optional[str] = rest_field( + name="sendToOwners", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether to send email to subscription administrator.""" + custom_email_addresses: Optional[list[str]] = rest_field( + name="customEmailAddresses", visibility=["read", "create", "update", "delete", "query"] + ) + """The custom email address for sending emails.""" + locale: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The locale for the email notification.""" + + @overload + def __init__( + self, + *, + send_to_owners: Optional[str] = None, + custom_email_addresses: Optional[list[str]] = None, + locale: 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 ApplianceMonitoringDetails(_Model): + """Appliance details of the migration item. + + :ivar cpu_details: The appliance CPU details. + :vartype cpu_details: ~azure.mgmt.recoveryservicessiterecovery.models.ApplianceResourceDetails + :ivar ram_details: The appliance RAM details. + :vartype ram_details: ~azure.mgmt.recoveryservicessiterecovery.models.ApplianceResourceDetails + :ivar datastore_snapshot: The appliance datastore snapshot details. + :vartype datastore_snapshot: + list[~azure.mgmt.recoveryservicessiterecovery.models.DataStoreUtilizationDetails] + :ivar disks_replication_details: The disk replication details. + :vartype disks_replication_details: + ~azure.mgmt.recoveryservicessiterecovery.models.ApplianceResourceDetails + :ivar esxi_nfc_buffer: The ESXi NFC buffer details. + :vartype esxi_nfc_buffer: + ~azure.mgmt.recoveryservicessiterecovery.models.ApplianceResourceDetails + :ivar network_bandwidth: The appliance network bandwidth details. + :vartype network_bandwidth: + ~azure.mgmt.recoveryservicessiterecovery.models.ApplianceResourceDetails + """ + + cpu_details: Optional["_models.ApplianceResourceDetails"] = rest_field(name="cpuDetails", visibility=["read"]) + """The appliance CPU details.""" + ram_details: Optional["_models.ApplianceResourceDetails"] = rest_field(name="ramDetails", visibility=["read"]) + """The appliance RAM details.""" + datastore_snapshot: Optional[list["_models.DataStoreUtilizationDetails"]] = rest_field( + name="datastoreSnapshot", visibility=["read"] + ) + """The appliance datastore snapshot details.""" + disks_replication_details: Optional["_models.ApplianceResourceDetails"] = rest_field( + name="disksReplicationDetails", visibility=["read"] + ) + """The disk replication details.""" + esxi_nfc_buffer: Optional["_models.ApplianceResourceDetails"] = rest_field( + name="esxiNfcBuffer", visibility=["read"] + ) + """The ESXi NFC buffer details.""" + network_bandwidth: Optional["_models.ApplianceResourceDetails"] = rest_field( + name="networkBandwidth", visibility=["read"] + ) + """The appliance network bandwidth details.""" + + +class ApplianceResourceDetails(_Model): + """Details of the appliance resource. + + :ivar capacity: A value indicating the total capacity of appliance resource. + :vartype capacity: int + :ivar process_utilization: A value indicating the utilization percentage by gateway agent on + appliance. + :vartype process_utilization: float + :ivar total_utilization: A value indicating the total utilization percentage for all processes + on the appliance. + :vartype total_utilization: float + :ivar status: A value indicating the status of appliance resource. + :vartype status: str + """ + + capacity: Optional[int] = rest_field(visibility=["read"]) + """A value indicating the total capacity of appliance resource.""" + process_utilization: Optional[float] = rest_field(name="processUtilization", visibility=["read"]) + """A value indicating the utilization percentage by gateway agent on appliance.""" + total_utilization: Optional[float] = rest_field(name="totalUtilization", visibility=["read"]) + """A value indicating the total utilization percentage for all processes on the appliance.""" + status: Optional[str] = rest_field(visibility=["read"]) + """A value indicating the status of appliance resource.""" + + +class ApplianceSpecificDetails(_Model): + """Appliance specific details. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + InMageRcmApplianceSpecificDetails + + :ivar instance_type: Gets the class type. Overridden in derived classes. Required. Default + value is None. + :vartype instance_type: str + """ + + __mapping__: dict[str, _Model] = {} + instance_type: str = rest_discriminator( + name="instanceType", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets the class type. Overridden in derived classes. Required. Default value is None.""" + + @overload + def __init__( + self, + *, + instance_type: str, + ) -> 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 ApplyClusterRecoveryPointInput(_Model): + """Input definition for apply cluster recovery point. + + :ivar properties: The properties to apply cluster recovery point input. Required. + :vartype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.ApplyClusterRecoveryPointInputProperties + """ + + properties: "_models.ApplyClusterRecoveryPointInputProperties" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The properties to apply cluster recovery point input. Required.""" + + @overload + def __init__( + self, + *, + properties: "_models.ApplyClusterRecoveryPointInputProperties", + ) -> 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 ApplyClusterRecoveryPointInputProperties(_Model): + """Input definition for apply cluster recovery point properties. + + :ivar cluster_recovery_point_id: The cluster recovery point id to be passed to failover to a + particular recovery point. + :vartype cluster_recovery_point_id: str + :ivar individual_node_recovery_points: The list of individual node recovery points. + :vartype individual_node_recovery_points: list[str] + :ivar provider_specific_details: The provider specific input for applying cluster recovery + point. Required. + :vartype provider_specific_details: + ~azure.mgmt.recoveryservicessiterecovery.models.ApplyClusterRecoveryPointProviderSpecificInput + """ + + cluster_recovery_point_id: Optional[str] = rest_field( + name="clusterRecoveryPointId", visibility=["read", "create", "update", "delete", "query"] + ) + """The cluster recovery point id to be passed to failover to a particular recovery point.""" + individual_node_recovery_points: Optional[list[str]] = rest_field( + name="individualNodeRecoveryPoints", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of individual node recovery points.""" + provider_specific_details: "_models.ApplyClusterRecoveryPointProviderSpecificInput" = rest_field( + name="providerSpecificDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """The provider specific input for applying cluster recovery point. Required.""" + + @overload + def __init__( + self, + *, + provider_specific_details: "_models.ApplyClusterRecoveryPointProviderSpecificInput", + cluster_recovery_point_id: Optional[str] = None, + individual_node_recovery_points: 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 ApplyRecoveryPointInput(_Model): + """Input to apply recovery point. + + :ivar properties: The input properties to apply recovery point. Required. + :vartype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.ApplyRecoveryPointInputProperties + """ + + properties: "_models.ApplyRecoveryPointInputProperties" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The input properties to apply recovery point. Required.""" + + @overload + def __init__( + self, + *, + properties: "_models.ApplyRecoveryPointInputProperties", + ) -> 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 ApplyRecoveryPointInputProperties(_Model): + """Input properties to apply recovery point. + + :ivar recovery_point_id: The recovery point Id. + :vartype recovery_point_id: str + :ivar provider_specific_details: Provider specific input for applying recovery point. Required. + :vartype provider_specific_details: + ~azure.mgmt.recoveryservicessiterecovery.models.ApplyRecoveryPointProviderSpecificInput + """ + + recovery_point_id: Optional[str] = rest_field( + name="recoveryPointId", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery point Id.""" + provider_specific_details: "_models.ApplyRecoveryPointProviderSpecificInput" = rest_field( + name="providerSpecificDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """Provider specific input for applying recovery point. Required.""" + + @overload + def __init__( + self, + *, + provider_specific_details: "_models.ApplyRecoveryPointProviderSpecificInput", + recovery_point_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 JobDetails(_Model): + """Job details based on specific job type. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AsrJobDetails, ClusterFailoverJobDetails, ClusterSwitchProtectionJobDetails, + ClusterTestFailoverJobDetails, ExportJobDetails, FailoverJobDetails, + SwitchProtectionJobDetails, TestFailoverJobDetails + + :ivar instance_type: Gets the type of job details (see JobDetailsTypes enum for possible + values). Required. Default value is None. + :vartype instance_type: str + :ivar affected_object_details: The affected object properties like source server, source cloud, + target server, target cloud etc. based on the workflow object details. + :vartype affected_object_details: dict[str, str] + """ + + __mapping__: dict[str, _Model] = {} + instance_type: str = rest_discriminator( + name="instanceType", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets the type of job details (see JobDetailsTypes enum for possible values). Required. Default + value is None.""" + affected_object_details: Optional[dict[str, str]] = rest_field( + name="affectedObjectDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """The affected object properties like source server, source cloud, target server, target cloud + etc. based on the workflow object details.""" + + @overload + def __init__( + self, + *, + instance_type: str, + affected_object_details: 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 AsrJobDetails(JobDetails, discriminator="AsrJobDetails"): + """This class represents job details based on specific job type. + + :ivar affected_object_details: The affected object properties like source server, source cloud, + target server, target cloud etc. based on the workflow object details. + :vartype affected_object_details: dict[str, str] + :ivar instance_type: Gets the type of job details (see JobDetailsTypes enum for possible + values). Required. Default value is "AsrJobDetails". + :vartype instance_type: str + """ + + instance_type: Literal["AsrJobDetails"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets the type of job details (see JobDetailsTypes enum for possible values). Required. Default + value is \"AsrJobDetails\".""" + + @overload + def __init__( + self, + *, + affected_object_details: 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) + self.instance_type = "AsrJobDetails" # type: ignore + + +class ASRTask(_Model): + """Task of the Job. + + :ivar task_id: The Id. + :vartype task_id: str + :ivar name: The unique Task name. + :vartype name: str + :ivar start_time: The start time. + :vartype start_time: ~datetime.datetime + :ivar end_time: The end time. + :vartype end_time: ~datetime.datetime + :ivar allowed_actions: The state/actions applicable on this task. + :vartype allowed_actions: list[str] + :ivar friendly_name: The name. + :vartype friendly_name: str + :ivar state: The State. It is one of these values - NotStarted, InProgress, Succeeded, Failed, + Cancelled, Suspended or Other. + :vartype state: str + :ivar state_description: The description of the task state. For example - For Succeeded state, + description can be Completed, PartiallySucceeded, CompletedWithInformation or Skipped. + :vartype state_description: str + :ivar task_type: The type of task. Details in CustomDetails property depend on this type. + :vartype task_type: str + :ivar custom_details: The custom task details based on the task type. + :vartype custom_details: ~azure.mgmt.recoveryservicessiterecovery.models.TaskTypeDetails + :ivar group_task_custom_details: The custom task details based on the task type, if the task + type is GroupTaskDetails or one of the types derived from it. + :vartype group_task_custom_details: + ~azure.mgmt.recoveryservicessiterecovery.models.GroupTaskDetails + :ivar errors: The task error details. + :vartype errors: list[~azure.mgmt.recoveryservicessiterecovery.models.JobErrorDetails] + """ + + task_id: Optional[str] = rest_field(name="taskId", visibility=["read", "create", "update", "delete", "query"]) + """The Id.""" + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The unique Task name.""" + start_time: Optional[datetime.datetime] = rest_field( + name="startTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The start time.""" + end_time: Optional[datetime.datetime] = rest_field( + name="endTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The end time.""" + allowed_actions: Optional[list[str]] = rest_field( + name="allowedActions", visibility=["read", "create", "update", "delete", "query"] + ) + """The state/actions applicable on this task.""" + friendly_name: Optional[str] = rest_field( + name="friendlyName", visibility=["read", "create", "update", "delete", "query"] + ) + """The name.""" + state: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The State. It is one of these values - NotStarted, InProgress, Succeeded, Failed, Cancelled, + Suspended or Other.""" + state_description: Optional[str] = rest_field( + name="stateDescription", visibility=["read", "create", "update", "delete", "query"] + ) + """The description of the task state. For example - For Succeeded state, description can be + Completed, PartiallySucceeded, CompletedWithInformation or Skipped.""" + task_type: Optional[str] = rest_field(name="taskType", visibility=["read", "create", "update", "delete", "query"]) + """The type of task. Details in CustomDetails property depend on this type.""" + custom_details: Optional["_models.TaskTypeDetails"] = rest_field( + name="customDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """The custom task details based on the task type.""" + group_task_custom_details: Optional["_models.GroupTaskDetails"] = rest_field( + name="groupTaskCustomDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """The custom task details based on the task type, if the task type is GroupTaskDetails or one of + the types derived from it.""" + errors: Optional[list["_models.JobErrorDetails"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The task error details.""" + + @overload + def __init__( + self, + *, + task_id: Optional[str] = None, + name: Optional[str] = None, + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + allowed_actions: Optional[list[str]] = None, + friendly_name: Optional[str] = None, + state: Optional[str] = None, + state_description: Optional[str] = None, + task_type: Optional[str] = None, + custom_details: Optional["_models.TaskTypeDetails"] = None, + group_task_custom_details: Optional["_models.GroupTaskDetails"] = None, + errors: Optional[list["_models.JobErrorDetails"]] = 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 TaskTypeDetails(_Model): + """Task details based on specific task type. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AutomationRunbookTaskDetails, ConsistencyCheckTaskDetails, FabricReplicationGroupTaskDetails, + JobTaskDetails, ManualActionTaskDetails, ScriptActionTaskDetails, VirtualMachineTaskDetails, + VmNicUpdatesTaskDetails + + :ivar instance_type: The type of task details. Required. Default value is None. + :vartype instance_type: str + """ + + __mapping__: dict[str, _Model] = {} + instance_type: str = rest_discriminator( + name="instanceType", visibility=["read", "create", "update", "delete", "query"] + ) + """The type of task details. Required. Default value is None.""" + + @overload + def __init__( + self, + *, + instance_type: str, + ) -> 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 AutomationRunbookTaskDetails(TaskTypeDetails, discriminator="AutomationRunbookTaskDetails"): + """This class represents the task details for an automation runbook. + + :ivar name: The recovery plan task name. + :vartype name: str + :ivar cloud_service_name: The cloud service of the automation runbook account. + :vartype cloud_service_name: str + :ivar subscription_id: The subscription Id of the automation runbook account. + :vartype subscription_id: str + :ivar account_name: The automation account name of the runbook. + :vartype account_name: str + :ivar runbook_id: The runbook Id. + :vartype runbook_id: str + :ivar runbook_name: The runbook name. + :vartype runbook_name: str + :ivar job_id: The job Id of the runbook execution. + :vartype job_id: str + :ivar job_output: The execution output of the runbook. + :vartype job_output: str + :ivar is_primary_side_script: A value indicating whether it is a primary side script or not. + :vartype is_primary_side_script: bool + :ivar instance_type: The type of task details. Required. Default value is + "AutomationRunbookTaskDetails". + :vartype instance_type: str + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The recovery plan task name.""" + cloud_service_name: Optional[str] = rest_field( + name="cloudServiceName", visibility=["read", "create", "update", "delete", "query"] + ) + """The cloud service of the automation runbook account.""" + subscription_id: Optional[str] = rest_field( + name="subscriptionId", visibility=["read", "create", "update", "delete", "query"] + ) + """The subscription Id of the automation runbook account.""" + account_name: Optional[str] = rest_field( + name="accountName", visibility=["read", "create", "update", "delete", "query"] + ) + """The automation account name of the runbook.""" + runbook_id: Optional[str] = rest_field(name="runbookId", visibility=["read", "create", "update", "delete", "query"]) + """The runbook Id.""" + runbook_name: Optional[str] = rest_field( + name="runbookName", visibility=["read", "create", "update", "delete", "query"] + ) + """The runbook name.""" + job_id: Optional[str] = rest_field(name="jobId", visibility=["read", "create", "update", "delete", "query"]) + """The job Id of the runbook execution.""" + job_output: Optional[str] = rest_field(name="jobOutput", visibility=["read", "create", "update", "delete", "query"]) + """The execution output of the runbook.""" + is_primary_side_script: Optional[bool] = rest_field( + name="isPrimarySideScript", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether it is a primary side script or not.""" + instance_type: Literal["AutomationRunbookTaskDetails"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The type of task details. Required. Default value is \"AutomationRunbookTaskDetails\".""" + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + cloud_service_name: Optional[str] = None, + subscription_id: Optional[str] = None, + account_name: Optional[str] = None, + runbook_id: Optional[str] = None, + runbook_name: Optional[str] = None, + job_id: Optional[str] = None, + job_output: Optional[str] = None, + is_primary_side_script: 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) + self.instance_type = "AutomationRunbookTaskDetails" # type: ignore + + +class FabricSpecificCreationInput(_Model): + """Fabric provider specific settings. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AzureFabricCreationInput, InMageRcmFabricCreationInput, VMwareV2FabricCreationInput + + :ivar instance_type: Gets the class type. Required. Default value is None. + :vartype instance_type: str + """ + + __mapping__: dict[str, _Model] = {} + instance_type: str = rest_discriminator( + name="instanceType", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets the class type. Required. Default value is None.""" + + @overload + def __init__( + self, + *, + instance_type: str, + ) -> 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 AzureFabricCreationInput(FabricSpecificCreationInput, discriminator="Azure"): + """Fabric provider specific settings. + + :ivar location: The Location. + :vartype location: str + :ivar instance_type: Gets the class type. Required. Default value is "Azure". + :vartype instance_type: str + """ + + location: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The Location.""" + instance_type: Literal["Azure"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets the class type. Required. Default value is \"Azure\".""" + + @overload + def __init__( + self, + *, + location: 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) + self.instance_type = "Azure" # type: ignore + + +class FabricSpecificDetails(_Model): + """Fabric specific details. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AzureFabricSpecificDetails, HyperVSiteDetails, InMageRcmFabricSpecificDetails, VmmDetails, + VMwareDetails, VMwareV2FabricSpecificDetails + + :ivar instance_type: Gets the class type. Overridden in derived classes. Required. Default + value is None. + :vartype instance_type: str + """ + + __mapping__: dict[str, _Model] = {} + instance_type: str = rest_discriminator( + name="instanceType", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets the class type. Overridden in derived classes. Required. Default value is None.""" + + @overload + def __init__( + self, + *, + instance_type: str, + ) -> 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 AzureFabricSpecificDetails(FabricSpecificDetails, discriminator="Azure"): + """Azure Fabric Specific Details. + + :ivar location: The Location for the Azure fabric. + :vartype location: str + :ivar container_ids: The container Ids for the Azure fabric. + :vartype container_ids: list[str] + :ivar zones: The zones. + :vartype zones: list[~azure.mgmt.recoveryservicessiterecovery.models.A2AZoneDetails] + :ivar extended_locations: The ExtendedLocations. + :vartype extended_locations: + list[~azure.mgmt.recoveryservicessiterecovery.models.A2AExtendedLocationDetails] + :ivar location_details: The location details. + :vartype location_details: + list[~azure.mgmt.recoveryservicessiterecovery.models.A2AFabricSpecificLocationDetails] + :ivar instance_type: Gets the class type. Overridden in derived classes. Required. Default + value is "Azure". + :vartype instance_type: str + """ + + location: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The Location for the Azure fabric.""" + container_ids: Optional[list[str]] = rest_field( + name="containerIds", visibility=["read", "create", "update", "delete", "query"] + ) + """The container Ids for the Azure fabric.""" + zones: Optional[list["_models.A2AZoneDetails"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The zones.""" + extended_locations: Optional[list["_models.A2AExtendedLocationDetails"]] = rest_field( + name="extendedLocations", visibility=["read", "create", "update", "delete", "query"] + ) + """The ExtendedLocations.""" + location_details: Optional[list["_models.A2AFabricSpecificLocationDetails"]] = rest_field( + name="locationDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """The location details.""" + instance_type: Literal["Azure"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets the class type. Overridden in derived classes. Required. Default value is \"Azure\".""" + + @overload + def __init__( + self, + *, + location: Optional[str] = None, + container_ids: Optional[list[str]] = None, + zones: Optional[list["_models.A2AZoneDetails"]] = None, + extended_locations: Optional[list["_models.A2AExtendedLocationDetails"]] = None, + location_details: Optional[list["_models.A2AFabricSpecificLocationDetails"]] = 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) + self.instance_type = "Azure" # type: ignore + + +class FabricSpecificCreateNetworkMappingInput(_Model): + """Input details specific to fabrics during Network Mapping. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AzureToAzureCreateNetworkMappingInput, VmmToAzureCreateNetworkMappingInput, + VmmToVmmCreateNetworkMappingInput + + :ivar instance_type: The instance type. Required. Default value is None. + :vartype instance_type: str + """ + + __mapping__: dict[str, _Model] = {} + instance_type: str = rest_discriminator( + name="instanceType", visibility=["read", "create", "update", "delete", "query"] + ) + """The instance type. Required. Default value is None.""" + + @overload + def __init__( + self, + *, + instance_type: str, + ) -> 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 AzureToAzureCreateNetworkMappingInput(FabricSpecificCreateNetworkMappingInput, discriminator="AzureToAzure"): + """Create network mappings input properties/behavior specific to Azure to Azure Network mapping. + + :ivar primary_network_id: The primary azure vnet Id. Required. + :vartype primary_network_id: str + :ivar instance_type: The instance type. Required. Default value is "AzureToAzure". + :vartype instance_type: str + """ + + primary_network_id: str = rest_field( + name="primaryNetworkId", visibility=["read", "create", "update", "delete", "query"] + ) + """The primary azure vnet Id. Required.""" + instance_type: Literal["AzureToAzure"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The instance type. Required. Default value is \"AzureToAzure\".""" + + @overload + def __init__( + self, + *, + primary_network_id: str, + ) -> 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) + self.instance_type = "AzureToAzure" # type: ignore + + +class NetworkMappingFabricSpecificSettings(_Model): + """Network Mapping fabric specific settings. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AzureToAzureNetworkMappingSettings, VmmToAzureNetworkMappingSettings, + VmmToVmmNetworkMappingSettings + + :ivar instance_type: Gets the Instance type. Required. Default value is None. + :vartype instance_type: str + """ + + __mapping__: dict[str, _Model] = {} + instance_type: str = rest_discriminator( + name="instanceType", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets the Instance type. Required. Default value is None.""" + + @overload + def __init__( + self, + *, + instance_type: str, + ) -> 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 AzureToAzureNetworkMappingSettings(NetworkMappingFabricSpecificSettings, discriminator="AzureToAzure"): + """A2A Network Mapping fabric specific settings. + + :ivar primary_fabric_location: The primary fabric location. + :vartype primary_fabric_location: str + :ivar recovery_fabric_location: The recovery fabric location. + :vartype recovery_fabric_location: str + :ivar instance_type: Gets the Instance type. Required. Default value is "AzureToAzure". + :vartype instance_type: str + """ + + primary_fabric_location: Optional[str] = rest_field( + name="primaryFabricLocation", visibility=["read", "create", "update", "delete", "query"] + ) + """The primary fabric location.""" + recovery_fabric_location: Optional[str] = rest_field( + name="recoveryFabricLocation", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery fabric location.""" + instance_type: Literal["AzureToAzure"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets the Instance type. Required. Default value is \"AzureToAzure\".""" + + @overload + def __init__( + self, + *, + primary_fabric_location: Optional[str] = None, + recovery_fabric_location: 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) + self.instance_type = "AzureToAzure" # type: ignore + + +class FabricSpecificUpdateNetworkMappingInput(_Model): + """Input details specific to fabrics during Network Mapping. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AzureToAzureUpdateNetworkMappingInput, VmmToAzureUpdateNetworkMappingInput, + VmmToVmmUpdateNetworkMappingInput + + :ivar instance_type: The instance type. Required. Default value is None. + :vartype instance_type: str + """ + + __mapping__: dict[str, _Model] = {} + instance_type: str = rest_discriminator( + name="instanceType", visibility=["read", "create", "update", "delete", "query"] + ) + """The instance type. Required. Default value is None.""" + + @overload + def __init__( + self, + *, + instance_type: str, + ) -> 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 AzureToAzureUpdateNetworkMappingInput(FabricSpecificUpdateNetworkMappingInput, discriminator="AzureToAzure"): + """Updates network mappings input. + + :ivar primary_network_id: The primary azure vnet Id. + :vartype primary_network_id: str + :ivar instance_type: The instance type. Required. Default value is "AzureToAzure". + :vartype instance_type: str + """ + + primary_network_id: Optional[str] = rest_field( + name="primaryNetworkId", visibility=["read", "create", "update", "delete", "query"] + ) + """The primary azure vnet Id.""" + instance_type: Literal["AzureToAzure"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The instance type. Required. Default value is \"AzureToAzure\".""" + + @overload + def __init__( + self, + *, + primary_network_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) + self.instance_type = "AzureToAzure" # type: ignore + + +class AzureToAzureVmSyncedConfigDetails(_Model): + """Azure to Azure VM synced configuration details. + + :ivar tags: The Azure VM tags. + :vartype tags: dict[str, str] + :ivar input_endpoints: The Azure VM input endpoints. + :vartype input_endpoints: list[~azure.mgmt.recoveryservicessiterecovery.models.InputEndpoint] + """ + + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The Azure VM tags.""" + input_endpoints: Optional[list["_models.InputEndpoint"]] = rest_field( + name="inputEndpoints", visibility=["read", "create", "update", "delete", "query"] + ) + """The Azure VM input endpoints.""" + + @overload + def __init__( + self, + *, + tags: Optional[dict[str, str]] = None, + input_endpoints: Optional[list["_models.InputEndpoint"]] = 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 AzureVmDiskDetails(_Model): + """Disk details for E2A provider. + + :ivar vhd_type: VHD type. + :vartype vhd_type: str + :ivar vhd_id: The VHD id. + :vartype vhd_id: str + :ivar disk_id: The disk resource id. + :vartype disk_id: str + :ivar vhd_name: VHD name. + :vartype vhd_name: str + :ivar max_size_mb: Max side in MB. + :vartype max_size_mb: str + :ivar target_disk_location: Blob uri of the Azure disk. + :vartype target_disk_location: str + :ivar target_disk_name: The target Azure disk name. + :vartype target_disk_name: str + :ivar lun_id: Ordinal\\LunId of the disk for the Azure VM. + :vartype lun_id: str + :ivar disk_encryption_set_id: The DiskEncryptionSet ARM ID. + :vartype disk_encryption_set_id: str + :ivar custom_target_disk_name: The custom target Azure disk name. + :vartype custom_target_disk_name: str + """ + + vhd_type: Optional[str] = rest_field(name="vhdType", visibility=["read", "create", "update", "delete", "query"]) + """VHD type.""" + vhd_id: Optional[str] = rest_field(name="vhdId", visibility=["read", "create", "update", "delete", "query"]) + """The VHD id.""" + disk_id: Optional[str] = rest_field(name="diskId", visibility=["read", "create", "update", "delete", "query"]) + """The disk resource id.""" + vhd_name: Optional[str] = rest_field(name="vhdName", visibility=["read", "create", "update", "delete", "query"]) + """VHD name.""" + max_size_mb: Optional[str] = rest_field( + name="maxSizeMB", visibility=["read", "create", "update", "delete", "query"] + ) + """Max side in MB.""" + target_disk_location: Optional[str] = rest_field( + name="targetDiskLocation", visibility=["read", "create", "update", "delete", "query"] + ) + """Blob uri of the Azure disk.""" + target_disk_name: Optional[str] = rest_field( + name="targetDiskName", visibility=["read", "create", "update", "delete", "query"] + ) + """The target Azure disk name.""" + lun_id: Optional[str] = rest_field(name="lunId", visibility=["read", "create", "update", "delete", "query"]) + """Ordinal\LunId of the disk for the Azure VM.""" + disk_encryption_set_id: Optional[str] = rest_field( + name="diskEncryptionSetId", visibility=["read", "create", "update", "delete", "query"] + ) + """The DiskEncryptionSet ARM ID.""" + custom_target_disk_name: Optional[str] = rest_field( + name="customTargetDiskName", visibility=["read", "create", "update", "delete", "query"] + ) + """The custom target Azure disk name.""" + + @overload + def __init__( + self, + *, + vhd_type: Optional[str] = None, + vhd_id: Optional[str] = None, + disk_id: Optional[str] = None, + vhd_name: Optional[str] = None, + max_size_mb: Optional[str] = None, + target_disk_location: Optional[str] = None, + target_disk_name: Optional[str] = None, + lun_id: Optional[str] = None, + disk_encryption_set_id: Optional[str] = None, + custom_target_disk_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 ClusterFailoverJobDetails(JobDetails, discriminator="ClusterFailoverJobDetails"): + """This class represents the details for a failover job of cluster. + + :ivar affected_object_details: The affected object properties like source server, source cloud, + target server, target cloud etc. based on the workflow object details. + :vartype affected_object_details: dict[str, str] + :ivar protected_item_details: The test VM details. + :vartype protected_item_details: + list[~azure.mgmt.recoveryservicessiterecovery.models.FailoverReplicationProtectedItemDetails] + :ivar instance_type: Gets the type of job details (see JobDetailsTypes enum for possible + values). Required. Default value is "ClusterFailoverJobDetails". + :vartype instance_type: str + """ + + protected_item_details: Optional[list["_models.FailoverReplicationProtectedItemDetails"]] = rest_field( + name="protectedItemDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """The test VM details.""" + instance_type: Literal["ClusterFailoverJobDetails"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets the type of job details (see JobDetailsTypes enum for possible values). Required. Default + value is \"ClusterFailoverJobDetails\".""" + + @overload + def __init__( + self, + *, + affected_object_details: Optional[dict[str, str]] = None, + protected_item_details: Optional[list["_models.FailoverReplicationProtectedItemDetails"]] = 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) + self.instance_type = "ClusterFailoverJobDetails" # type: ignore + + +class ClusterRecoveryPoint(_Model): + """Recovery point. + + :ivar id: The recovery point Id. + :vartype id: str + :ivar name: The recovery point name. + :vartype name: str + :ivar type: The resource type. + :vartype type: str + :ivar properties: The recovery point properties. + :vartype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.ClusterRecoveryPointProperties + """ + + id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The recovery point Id.""" + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The recovery point name.""" + type: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The resource type.""" + properties: Optional["_models.ClusterRecoveryPointProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery point properties.""" + + @overload + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + type: Optional[str] = None, + properties: Optional["_models.ClusterRecoveryPointProperties"] = 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 ClusterRecoveryPointProperties(_Model): + """Cluster recovery point properties. + + :ivar recovery_point_time: The recovery point time. + :vartype recovery_point_time: ~datetime.datetime + :ivar recovery_point_type: The recovery point type. Known values are: "NotSpecified", + "ApplicationConsistent", and "CrashConsistent". + :vartype recovery_point_type: str or + ~azure.mgmt.recoveryservicessiterecovery.models.ClusterRecoveryPointType + :ivar provider_specific_details: The provider specific details for the recovery point. + :vartype provider_specific_details: + ~azure.mgmt.recoveryservicessiterecovery.models.ClusterProviderSpecificRecoveryPointDetails + """ + + recovery_point_time: Optional[datetime.datetime] = rest_field( + name="recoveryPointTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The recovery point time.""" + recovery_point_type: Optional[Union[str, "_models.ClusterRecoveryPointType"]] = rest_field( + name="recoveryPointType", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery point type. Known values are: \"NotSpecified\", \"ApplicationConsistent\", and + \"CrashConsistent\".""" + provider_specific_details: Optional["_models.ClusterProviderSpecificRecoveryPointDetails"] = rest_field( + name="providerSpecificDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """The provider specific details for the recovery point.""" + + @overload + def __init__( + self, + *, + recovery_point_time: Optional[datetime.datetime] = None, + recovery_point_type: Optional[Union[str, "_models.ClusterRecoveryPointType"]] = None, + provider_specific_details: Optional["_models.ClusterProviderSpecificRecoveryPointDetails"] = 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 ClusterSwitchProtectionJobDetails(JobDetails, discriminator="ClusterSwitchProtectionJobDetails"): + """This class represents details for switch cluster protection job. + + :ivar affected_object_details: The affected object properties like source server, source cloud, + target server, target cloud etc. based on the workflow object details. + :vartype affected_object_details: dict[str, str] + :ivar new_replication_protection_cluster_id: ARM Id of the new replication protection cluster. + :vartype new_replication_protection_cluster_id: str + :ivar instance_type: Gets the type of job details (see JobDetailsTypes enum for possible + values). Required. Default value is "ClusterSwitchProtectionJobDetails". + :vartype instance_type: str + """ + + new_replication_protection_cluster_id: Optional[str] = rest_field( + name="newReplicationProtectionClusterId", visibility=["read", "create", "update", "delete", "query"] + ) + """ARM Id of the new replication protection cluster.""" + instance_type: Literal["ClusterSwitchProtectionJobDetails"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets the type of job details (see JobDetailsTypes enum for possible values). Required. Default + value is \"ClusterSwitchProtectionJobDetails\".""" + + @overload + def __init__( + self, + *, + affected_object_details: Optional[dict[str, str]] = None, + new_replication_protection_cluster_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) + self.instance_type = "ClusterSwitchProtectionJobDetails" # type: ignore + + +class ClusterTestFailoverCleanupInput(_Model): + """Input definition for test failover cleanup for cluster. + + :ivar properties: Test failover cleanup input properties. Required. + :vartype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.ClusterTestFailoverCleanupInputProperties + """ + + properties: "_models.ClusterTestFailoverCleanupInputProperties" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Test failover cleanup input properties. Required.""" + + @overload + def __init__( + self, + *, + properties: "_models.ClusterTestFailoverCleanupInputProperties", + ) -> 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 ClusterTestFailoverCleanupInputProperties(_Model): # pylint: disable=name-too-long + """Input definition for test failover cleanup input properties. + + :ivar comments: Test failover cleanup comments. + :vartype comments: str + """ + + comments: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Test failover cleanup comments.""" + + @overload + def __init__( + self, + *, + comments: 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 ClusterTestFailoverInput(_Model): + """Input definition for test cluster failover. + + :ivar properties: Test failover input properties. Required. + :vartype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.ClusterTestFailoverInputProperties + """ + + properties: "_models.ClusterTestFailoverInputProperties" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Test failover input properties. Required.""" + + @overload + def __init__( + self, + *, + properties: "_models.ClusterTestFailoverInputProperties", + ) -> 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 ClusterTestFailoverInputProperties(_Model): + """Input definition for test failover input properties. + + :ivar failover_direction: Failover direction. Known values are: "PrimaryToRecovery" and + "RecoveryToPrimary". + :vartype failover_direction: str or + ~azure.mgmt.recoveryservicessiterecovery.models.FailoverDirection + :ivar network_type: Network type to be used for test failover. + :vartype network_type: str + :ivar network_id: The id of the network to be used for test failover. + :vartype network_id: str + :ivar provider_specific_details: Provider specific settings. + :vartype provider_specific_details: + ~azure.mgmt.recoveryservicessiterecovery.models.ClusterTestFailoverProviderSpecificInput + """ + + failover_direction: Optional[Union[str, "_models.FailoverDirection"]] = rest_field( + name="failoverDirection", visibility=["read", "create", "update", "delete", "query"] + ) + """Failover direction. Known values are: \"PrimaryToRecovery\" and \"RecoveryToPrimary\".""" + network_type: Optional[str] = rest_field( + name="networkType", visibility=["read", "create", "update", "delete", "query"] + ) + """Network type to be used for test failover.""" + network_id: Optional[str] = rest_field(name="networkId", visibility=["read", "create", "update", "delete", "query"]) + """The id of the network to be used for test failover.""" + provider_specific_details: Optional["_models.ClusterTestFailoverProviderSpecificInput"] = rest_field( + name="providerSpecificDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """Provider specific settings.""" + + @overload + def __init__( + self, + *, + failover_direction: Optional[Union[str, "_models.FailoverDirection"]] = None, + network_type: Optional[str] = None, + network_id: Optional[str] = None, + provider_specific_details: Optional["_models.ClusterTestFailoverProviderSpecificInput"] = 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 ClusterTestFailoverJobDetails(JobDetails, discriminator="ClusterTestFailoverJobDetails"): + """This class represents the details for a test failover job of cluster. + + :ivar affected_object_details: The affected object properties like source server, source cloud, + target server, target cloud etc. based on the workflow object details. + :vartype affected_object_details: dict[str, str] + :ivar test_failover_status: The test failover status. + :vartype test_failover_status: str + :ivar comments: The test failover comments. + :vartype comments: str + :ivar network_name: The test network name. + :vartype network_name: str + :ivar network_friendly_name: The test network friendly name. + :vartype network_friendly_name: str + :ivar network_type: The test network type (see TestFailoverInput enum for possible values). + :vartype network_type: str + :ivar protected_item_details: The test VM details. + :vartype protected_item_details: + list[~azure.mgmt.recoveryservicessiterecovery.models.FailoverReplicationProtectedItemDetails] + :ivar instance_type: Gets the type of job details (see JobDetailsTypes enum for possible + values). Required. Default value is "ClusterTestFailoverJobDetails". + :vartype instance_type: str + """ + + test_failover_status: Optional[str] = rest_field( + name="testFailoverStatus", visibility=["read", "create", "update", "delete", "query"] + ) + """The test failover status.""" + comments: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The test failover comments.""" + network_name: Optional[str] = rest_field( + name="networkName", visibility=["read", "create", "update", "delete", "query"] + ) + """The test network name.""" + network_friendly_name: Optional[str] = rest_field( + name="networkFriendlyName", visibility=["read", "create", "update", "delete", "query"] + ) + """The test network friendly name.""" + network_type: Optional[str] = rest_field( + name="networkType", visibility=["read", "create", "update", "delete", "query"] + ) + """The test network type (see TestFailoverInput enum for possible values).""" + protected_item_details: Optional[list["_models.FailoverReplicationProtectedItemDetails"]] = rest_field( + name="protectedItemDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """The test VM details.""" + instance_type: Literal["ClusterTestFailoverJobDetails"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets the type of job details (see JobDetailsTypes enum for possible values). Required. Default + value is \"ClusterTestFailoverJobDetails\".""" + + @overload + def __init__( + self, + *, + affected_object_details: Optional[dict[str, str]] = None, + test_failover_status: Optional[str] = None, + comments: Optional[str] = None, + network_name: Optional[str] = None, + network_friendly_name: Optional[str] = None, + network_type: Optional[str] = None, + protected_item_details: Optional[list["_models.FailoverReplicationProtectedItemDetails"]] = 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) + self.instance_type = "ClusterTestFailoverJobDetails" # type: ignore + + +class ClusterUnplannedFailoverInput(_Model): + """Input definition for unplanned cluster failover. + + :ivar properties: Unplanned failover input properties. Required. + :vartype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.ClusterUnplannedFailoverInputProperties + """ + + properties: "_models.ClusterUnplannedFailoverInputProperties" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Unplanned failover input properties. Required.""" + + @overload + def __init__( + self, + *, + properties: "_models.ClusterUnplannedFailoverInputProperties", + ) -> 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 ClusterUnplannedFailoverInputProperties(_Model): + """Input definition for unplanned failover input properties. + + :ivar failover_direction: Failover direction. + :vartype failover_direction: str + :ivar source_site_operations: Source site operations status. + :vartype source_site_operations: str + :ivar provider_specific_details: Provider specific settings. + :vartype provider_specific_details: + ~azure.mgmt.recoveryservicessiterecovery.models.ClusterUnplannedFailoverProviderSpecificInput + """ + + failover_direction: Optional[str] = rest_field( + name="failoverDirection", visibility=["read", "create", "update", "delete", "query"] + ) + """Failover direction.""" + source_site_operations: Optional[str] = rest_field( + name="sourceSiteOperations", visibility=["read", "create", "update", "delete", "query"] + ) + """Source site operations status.""" + provider_specific_details: Optional["_models.ClusterUnplannedFailoverProviderSpecificInput"] = rest_field( + name="providerSpecificDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """Provider specific settings.""" + + @overload + def __init__( + self, + *, + failover_direction: Optional[str] = None, + source_site_operations: Optional[str] = None, + provider_specific_details: Optional["_models.ClusterUnplannedFailoverProviderSpecificInput"] = 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 ComputeSizeErrorDetails(_Model): + """Represents the error used to indicate why the target compute size is not applicable. + + :ivar message: The error message. + :vartype message: str + :ivar severity: The severity of the error. + :vartype severity: str + """ + + message: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The error message.""" + severity: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The severity of the error.""" + + @overload + def __init__( + self, + *, + message: Optional[str] = None, + severity: 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 ConfigurationSettings(_Model): + """Replication provider specific settings. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + HyperVVirtualMachineDetails, ReplicationGroupDetails, VMwareVirtualMachineDetails, + VmmVirtualMachineDetails + + :ivar instance_type: Gets the class type. Overridden in derived classes. Required. Default + value is None. + :vartype instance_type: str + """ + + __mapping__: dict[str, _Model] = {} + instance_type: str = rest_discriminator( + name="instanceType", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets the class type. Overridden in derived classes. Required. Default value is None.""" + + @overload + def __init__( + self, + *, + instance_type: str, + ) -> 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 ConfigureAlertRequest(_Model): + """Request to configure alerts for the system. + + :ivar properties: The properties of a configure alert request. + :vartype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.ConfigureAlertRequestProperties + """ + + properties: Optional["_models.ConfigureAlertRequestProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The properties of a configure alert request.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.ConfigureAlertRequestProperties"] = 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 ConfigureAlertRequestProperties(_Model): + """Properties of a configure alert request. + + :ivar send_to_owners: A value indicating whether to send email to subscription administrator. + :vartype send_to_owners: str + :ivar custom_email_addresses: The custom email address for sending emails. + :vartype custom_email_addresses: list[str] + :ivar locale: The locale for the email notification. + :vartype locale: str + """ + + send_to_owners: Optional[str] = rest_field( + name="sendToOwners", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether to send email to subscription administrator.""" + custom_email_addresses: Optional[list[str]] = rest_field( + name="customEmailAddresses", visibility=["read", "create", "update", "delete", "query"] + ) + """The custom email address for sending emails.""" + locale: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The locale for the email notification.""" + + @overload + def __init__( + self, + *, + send_to_owners: Optional[str] = None, + custom_email_addresses: Optional[list[str]] = None, + locale: 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 ConsistencyCheckTaskDetails(TaskTypeDetails, discriminator="ConsistencyCheckTaskDetails"): + """This class contains monitoring details of all the inconsistent Protected Entities in Vmm. + + :ivar vm_details: The list of inconsistent Vm details. + :vartype vm_details: + list[~azure.mgmt.recoveryservicessiterecovery.models.InconsistentVmDetails] + :ivar instance_type: The type of task details. Required. Default value is + "ConsistencyCheckTaskDetails". + :vartype instance_type: str + """ + + vm_details: Optional[list["_models.InconsistentVmDetails"]] = rest_field( + name="vmDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of inconsistent Vm details.""" + instance_type: Literal["ConsistencyCheckTaskDetails"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The type of task details. Required. Default value is \"ConsistencyCheckTaskDetails\".""" + + @overload + def __init__( + self, + *, + vm_details: Optional[list["_models.InconsistentVmDetails"]] = 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) + self.instance_type = "ConsistencyCheckTaskDetails" # type: ignore + + +class CreateNetworkMappingInput(_Model): + """Create network mappings input. + + :ivar properties: Input properties for creating network mapping. Required. + :vartype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.CreateNetworkMappingInputProperties + """ + + properties: "_models.CreateNetworkMappingInputProperties" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Input properties for creating network mapping. Required.""" + + @overload + def __init__( + self, + *, + properties: "_models.CreateNetworkMappingInputProperties", + ) -> 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 CreateNetworkMappingInputProperties(_Model): + """Common input details for network mapping operation. + + :ivar recovery_fabric_name: Recovery fabric Name. + :vartype recovery_fabric_name: str + :ivar recovery_network_id: Recovery network Id. Required. + :vartype recovery_network_id: str + :ivar fabric_specific_details: Fabric specific input properties. + :vartype fabric_specific_details: + ~azure.mgmt.recoveryservicessiterecovery.models.FabricSpecificCreateNetworkMappingInput + """ + + recovery_fabric_name: Optional[str] = rest_field( + name="recoveryFabricName", visibility=["read", "create", "update", "delete", "query"] + ) + """Recovery fabric Name.""" + recovery_network_id: str = rest_field( + name="recoveryNetworkId", visibility=["read", "create", "update", "delete", "query"] + ) + """Recovery network Id. Required.""" + fabric_specific_details: Optional["_models.FabricSpecificCreateNetworkMappingInput"] = rest_field( + name="fabricSpecificDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """Fabric specific input properties.""" + + @overload + def __init__( + self, + *, + recovery_network_id: str, + recovery_fabric_name: Optional[str] = None, + fabric_specific_details: Optional["_models.FabricSpecificCreateNetworkMappingInput"] = 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 CreatePolicyInput(_Model): + """Protection Policy input. + + :ivar properties: Policy creation properties. + :vartype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.CreatePolicyInputProperties + """ + + properties: Optional["_models.CreatePolicyInputProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Policy creation properties.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.CreatePolicyInputProperties"] = 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 CreatePolicyInputProperties(_Model): + """Policy creation properties. + + :ivar provider_specific_input: The ReplicationProviderSettings. + :vartype provider_specific_input: + ~azure.mgmt.recoveryservicessiterecovery.models.PolicyProviderSpecificInput + """ + + provider_specific_input: Optional["_models.PolicyProviderSpecificInput"] = rest_field( + name="providerSpecificInput", visibility=["read", "create", "update", "delete", "query"] + ) + """The ReplicationProviderSettings.""" + + @overload + def __init__( + self, + *, + provider_specific_input: Optional["_models.PolicyProviderSpecificInput"] = 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 CreateProtectionContainerInput(_Model): + """Create protection container input. + + :ivar properties: Create protection container input properties. + :vartype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.CreateProtectionContainerInputProperties + """ + + properties: Optional["_models.CreateProtectionContainerInputProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Create protection container input properties.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.CreateProtectionContainerInputProperties"] = 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 CreateProtectionContainerInputProperties(_Model): + """Create protection container input properties. + + :ivar provider_specific_input: Provider specific inputs for container creation. + :vartype provider_specific_input: + list[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProviderSpecificContainerCreationInput] + """ + + provider_specific_input: Optional[list["_models.ReplicationProviderSpecificContainerCreationInput"]] = rest_field( + name="providerSpecificInput", visibility=["read", "create", "update", "delete", "query"] + ) + """Provider specific inputs for container creation.""" + + @overload + def __init__( + self, + *, + provider_specific_input: Optional[list["_models.ReplicationProviderSpecificContainerCreationInput"]] = 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 CreateProtectionContainerMappingInput(_Model): + """Configure pairing input. + + :ivar properties: Configure protection input properties. + :vartype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.CreateProtectionContainerMappingInputProperties + """ + + properties: Optional["_models.CreateProtectionContainerMappingInputProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Configure protection input properties.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.CreateProtectionContainerMappingInputProperties"] = 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 CreateProtectionContainerMappingInputProperties(_Model): # pylint: disable=name-too-long + """Configure pairing input properties. + + :ivar target_protection_container_id: The target unique protection container name. + :vartype target_protection_container_id: str + :ivar policy_id: Applicable policy. + :vartype policy_id: str + :ivar provider_specific_input: Provider specific input for pairing. + :vartype provider_specific_input: + ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProviderSpecificContainerMappingInput + """ + + target_protection_container_id: Optional[str] = rest_field( + name="targetProtectionContainerId", visibility=["read", "create", "update", "delete", "query"] + ) + """The target unique protection container name.""" + policy_id: Optional[str] = rest_field(name="policyId", visibility=["read", "create", "update", "delete", "query"]) + """Applicable policy.""" + provider_specific_input: Optional["_models.ReplicationProviderSpecificContainerMappingInput"] = rest_field( + name="providerSpecificInput", visibility=["read", "create", "update", "delete", "query"] + ) + """Provider specific input for pairing.""" + + @overload + def __init__( + self, + *, + target_protection_container_id: Optional[str] = None, + policy_id: Optional[str] = None, + provider_specific_input: Optional["_models.ReplicationProviderSpecificContainerMappingInput"] = 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 CreateProtectionIntentInput(_Model): + """Create protection intent input. + + :ivar properties: Create protection intent input properties. + :vartype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.CreateProtectionIntentProperties + """ + + properties: Optional["_models.CreateProtectionIntentProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Create protection intent input properties.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.CreateProtectionIntentProperties"] = 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 CreateProtectionIntentProperties(_Model): + """Create protection intent input properties. + + :ivar provider_specific_details: The ReplicationProviderInput. For A2A provider, it will be + A2ACreateProtectionIntentInput object. + :vartype provider_specific_details: + ~azure.mgmt.recoveryservicessiterecovery.models.CreateProtectionIntentProviderSpecificDetails + """ + + provider_specific_details: Optional["_models.CreateProtectionIntentProviderSpecificDetails"] = rest_field( + name="providerSpecificDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """The ReplicationProviderInput. For A2A provider, it will be A2ACreateProtectionIntentInput + object.""" + + @overload + def __init__( + self, + *, + provider_specific_details: Optional["_models.CreateProtectionIntentProviderSpecificDetails"] = 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 CreateRecoveryPlanInput(_Model): + """Create recovery plan input class. + + :ivar properties: Recovery plan creation properties. Required. + :vartype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.CreateRecoveryPlanInputProperties + """ + + properties: "_models.CreateRecoveryPlanInputProperties" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Recovery plan creation properties. Required.""" + + @overload + def __init__( + self, + *, + properties: "_models.CreateRecoveryPlanInputProperties", + ) -> 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 CreateRecoveryPlanInputProperties(_Model): + """Recovery plan creation properties. + + :ivar primary_fabric_id: The primary fabric Id. Required. + :vartype primary_fabric_id: str + :ivar recovery_fabric_id: The recovery fabric Id. Required. + :vartype recovery_fabric_id: str + :ivar failover_deployment_model: The failover deployment model. Known values are: + "NotApplicable", "Classic", and "ResourceManager". + :vartype failover_deployment_model: str or + ~azure.mgmt.recoveryservicessiterecovery.models.FailoverDeploymentModel + :ivar groups: The recovery plan groups. Required. + :vartype groups: list[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanGroup] + :ivar provider_specific_input: The provider specific input. + :vartype provider_specific_input: + list[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanProviderSpecificInput] + """ + + primary_fabric_id: str = rest_field( + name="primaryFabricId", visibility=["read", "create", "update", "delete", "query"] + ) + """The primary fabric Id. Required.""" + recovery_fabric_id: str = rest_field( + name="recoveryFabricId", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery fabric Id. Required.""" + failover_deployment_model: Optional[Union[str, "_models.FailoverDeploymentModel"]] = rest_field( + name="failoverDeploymentModel", visibility=["read", "create", "update", "delete", "query"] + ) + """The failover deployment model. Known values are: \"NotApplicable\", \"Classic\", and + \"ResourceManager\".""" + groups: list["_models.RecoveryPlanGroup"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The recovery plan groups. Required.""" + provider_specific_input: Optional[list["_models.RecoveryPlanProviderSpecificInput"]] = rest_field( + name="providerSpecificInput", visibility=["read", "create", "update", "delete", "query"] + ) + """The provider specific input.""" + + @overload + def __init__( + self, + *, + primary_fabric_id: str, + recovery_fabric_id: str, + groups: list["_models.RecoveryPlanGroup"], + failover_deployment_model: Optional[Union[str, "_models.FailoverDeploymentModel"]] = None, + provider_specific_input: Optional[list["_models.RecoveryPlanProviderSpecificInput"]] = 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 CriticalJobHistoryDetails(_Model): + """Critical past job details of the migration item. + + :ivar job_name: The job name. + :vartype job_name: str + :ivar job_id: The ARM Id of the job being executed. + :vartype job_id: str + :ivar start_time: The start time of the job. + :vartype start_time: ~datetime.datetime + :ivar job_status: The job state. + :vartype job_status: str + """ + + job_name: Optional[str] = rest_field(name="jobName", visibility=["read"]) + """The job name.""" + job_id: Optional[str] = rest_field(name="jobId", visibility=["read"]) + """The ARM Id of the job being executed.""" + start_time: Optional[datetime.datetime] = rest_field(name="startTime", visibility=["read"], format="rfc3339") + """The start time of the job.""" + job_status: Optional[str] = rest_field(name="jobStatus", visibility=["read"]) + """The job state.""" + + +class CurrentJobDetails(_Model): + """Current job details of the migration item. + + :ivar job_name: The job name. + :vartype job_name: str + :ivar job_id: The ARM Id of the job being executed. + :vartype job_id: str + :ivar start_time: The start time of the job. + :vartype start_time: ~datetime.datetime + """ + + job_name: Optional[str] = rest_field(name="jobName", visibility=["read"]) + """The job name.""" + job_id: Optional[str] = rest_field(name="jobId", visibility=["read"]) + """The ARM Id of the job being executed.""" + start_time: Optional[datetime.datetime] = rest_field(name="startTime", visibility=["read"], format="rfc3339") + """The start time of the job.""" + + +class CurrentScenarioDetails(_Model): + """Current scenario details of the protected entity. + + :ivar scenario_name: Scenario name. + :vartype scenario_name: str + :ivar job_id: ARM Id of the job being executed. + :vartype job_id: str + :ivar start_time: Start time of the workflow. + :vartype start_time: ~datetime.datetime + """ + + scenario_name: Optional[str] = rest_field( + name="scenarioName", visibility=["read", "create", "update", "delete", "query"] + ) + """Scenario name.""" + job_id: Optional[str] = rest_field(name="jobId", visibility=["read", "create", "update", "delete", "query"]) + """ARM Id of the job being executed.""" + start_time: Optional[datetime.datetime] = rest_field( + name="startTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """Start time of the workflow.""" + + @overload + def __init__( + self, + *, + scenario_name: Optional[str] = None, + job_id: Optional[str] = None, + start_time: 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 DataStore(_Model): + """The datastore details of the MT. + + :ivar symbolic_name: The symbolic name of data store. + :vartype symbolic_name: str + :ivar uuid: The uuid of data store. + :vartype uuid: str + :ivar capacity: The capacity of data store in GBs. + :vartype capacity: str + :ivar free_space: The free space of data store in GBs. + :vartype free_space: str + :ivar type: The type of data store. + :vartype type: str + """ + + symbolic_name: Optional[str] = rest_field( + name="symbolicName", visibility=["read", "create", "update", "delete", "query"] + ) + """The symbolic name of data store.""" + uuid: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The uuid of data store.""" + capacity: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The capacity of data store in GBs.""" + free_space: Optional[str] = rest_field(name="freeSpace", visibility=["read", "create", "update", "delete", "query"]) + """The free space of data store in GBs.""" + type: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The type of data store.""" + + @overload + def __init__( + self, + *, + symbolic_name: Optional[str] = None, + uuid: Optional[str] = None, + capacity: Optional[str] = None, + free_space: Optional[str] = None, + type: 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 DataStoreUtilizationDetails(_Model): + """Details of the appliance resource. + + :ivar total_snapshots_supported: The total count of snapshots supported by the datastore. + :vartype total_snapshots_supported: int + :ivar total_snapshots_created: The total snapshots created for server migration in the + datastore. + :vartype total_snapshots_created: int + :ivar data_store_name: The datastore name. + :vartype data_store_name: str + """ + + total_snapshots_supported: Optional[int] = rest_field(name="totalSnapshotsSupported", visibility=["read"]) + """The total count of snapshots supported by the datastore.""" + total_snapshots_created: Optional[int] = rest_field(name="totalSnapshotsCreated", visibility=["read"]) + """The total snapshots created for server migration in the datastore.""" + data_store_name: Optional[str] = rest_field(name="dataStoreName", visibility=["read"]) + """The datastore name.""" + + +class DisableProtectionInput(_Model): + """Disable protection input. + + :ivar properties: Disable protection input properties. Required. + :vartype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.DisableProtectionInputProperties + """ + + properties: "_models.DisableProtectionInputProperties" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Disable protection input properties. Required.""" + + @overload + def __init__( + self, + *, + properties: "_models.DisableProtectionInputProperties", + ) -> 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 DisableProtectionInputProperties(_Model): + """Disable protection input properties. + + :ivar disable_protection_reason: Disable protection reason. It can have values + NotSpecified/MigrationComplete. Known values are: "NotSpecified" and "MigrationComplete". + :vartype disable_protection_reason: str or + ~azure.mgmt.recoveryservicessiterecovery.models.DisableProtectionReason + :ivar replication_provider_input: Replication provider specific input. + :vartype replication_provider_input: + ~azure.mgmt.recoveryservicessiterecovery.models.DisableProtectionProviderSpecificInput + """ + + disable_protection_reason: Optional[Union[str, "_models.DisableProtectionReason"]] = rest_field( + name="disableProtectionReason", visibility=["read", "create", "update", "delete", "query"] + ) + """Disable protection reason. It can have values NotSpecified/MigrationComplete. Known values are: + \"NotSpecified\" and \"MigrationComplete\".""" + replication_provider_input: Optional["_models.DisableProtectionProviderSpecificInput"] = rest_field( + name="replicationProviderInput", visibility=["read", "create", "update", "delete", "query"] + ) + """Replication provider specific input.""" + + @overload + def __init__( + self, + *, + disable_protection_reason: Optional[Union[str, "_models.DisableProtectionReason"]] = None, + replication_provider_input: Optional["_models.DisableProtectionProviderSpecificInput"] = 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 DisableProtectionProviderSpecificInput(_Model): + """Disable protection provider specific input. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + InMageDisableProtectionProviderSpecificInput + + :ivar instance_type: The class type. Required. Default value is None. + :vartype instance_type: str + """ + + __mapping__: dict[str, _Model] = {} + instance_type: str = rest_discriminator( + name="instanceType", visibility=["read", "create", "update", "delete", "query"] + ) + """The class type. Required. Default value is None.""" + + @overload + def __init__( + self, + *, + instance_type: str, + ) -> 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 DiscoverProtectableItemRequest(_Model): + """Request to add a physical machine as a protectable item in a container. + + :ivar properties: The properties of a discover protectable item request. + :vartype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.DiscoverProtectableItemRequestProperties + """ + + properties: Optional["_models.DiscoverProtectableItemRequestProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The properties of a discover protectable item request.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.DiscoverProtectableItemRequestProperties"] = 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 DiscoverProtectableItemRequestProperties(_Model): + """Discover protectable item properties. + + :ivar friendly_name: The friendly name of the physical machine. + :vartype friendly_name: str + :ivar ip_address: The IP address of the physical machine to be discovered. + :vartype ip_address: str + :ivar os_type: The OS type on the physical machine. + :vartype os_type: str + """ + + friendly_name: Optional[str] = rest_field( + name="friendlyName", visibility=["read", "create", "update", "delete", "query"] + ) + """The friendly name of the physical machine.""" + ip_address: Optional[str] = rest_field(name="ipAddress", visibility=["read", "create", "update", "delete", "query"]) + """The IP address of the physical machine to be discovered.""" + os_type: Optional[str] = rest_field(name="osType", visibility=["read", "create", "update", "delete", "query"]) + """The OS type on the physical machine.""" + + @overload + def __init__( + self, + *, + friendly_name: Optional[str] = None, + ip_address: Optional[str] = None, + os_type: 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 DiskDetails(_Model): + """Onprem disk details data. + + :ivar max_size_mb: The hard disk max size in MB. + :vartype max_size_mb: int + :ivar vhd_type: The type of the volume. + :vartype vhd_type: str + :ivar vhd_id: The VHD Id. + :vartype vhd_id: str + :ivar vhd_name: The VHD name. + :vartype vhd_name: str + """ + + max_size_mb: Optional[int] = rest_field( + name="maxSizeMB", visibility=["read", "create", "update", "delete", "query"] + ) + """The hard disk max size in MB.""" + vhd_type: Optional[str] = rest_field(name="vhdType", visibility=["read", "create", "update", "delete", "query"]) + """The type of the volume.""" + vhd_id: Optional[str] = rest_field(name="vhdId", visibility=["read", "create", "update", "delete", "query"]) + """The VHD Id.""" + vhd_name: Optional[str] = rest_field(name="vhdName", visibility=["read", "create", "update", "delete", "query"]) + """The VHD name.""" + + @overload + def __init__( + self, + *, + max_size_mb: Optional[int] = None, + vhd_type: Optional[str] = None, + vhd_id: Optional[str] = None, + vhd_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 DiskEncryptionInfo(_Model): + """Recovery disk encryption info (BEK and KEK). + + :ivar disk_encryption_key_info: The recovery KeyVault reference for secret. + :vartype disk_encryption_key_info: + ~azure.mgmt.recoveryservicessiterecovery.models.DiskEncryptionKeyInfo + :ivar key_encryption_key_info: The recovery KeyVault reference for key. + :vartype key_encryption_key_info: + ~azure.mgmt.recoveryservicessiterecovery.models.KeyEncryptionKeyInfo + """ + + disk_encryption_key_info: Optional["_models.DiskEncryptionKeyInfo"] = rest_field( + name="diskEncryptionKeyInfo", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery KeyVault reference for secret.""" + key_encryption_key_info: Optional["_models.KeyEncryptionKeyInfo"] = rest_field( + name="keyEncryptionKeyInfo", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery KeyVault reference for key.""" + + @overload + def __init__( + self, + *, + disk_encryption_key_info: Optional["_models.DiskEncryptionKeyInfo"] = None, + key_encryption_key_info: Optional["_models.KeyEncryptionKeyInfo"] = 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 DiskEncryptionKeyInfo(_Model): + """Disk Encryption Key Information (BitLocker Encryption Key (BEK) on Windows). + + :ivar secret_identifier: The secret url / identifier. + :vartype secret_identifier: str + :ivar key_vault_resource_arm_id: The KeyVault resource ARM id for secret. + :vartype key_vault_resource_arm_id: str + """ + + secret_identifier: Optional[str] = rest_field( + name="secretIdentifier", visibility=["read", "create", "update", "delete", "query"] + ) + """The secret url / identifier.""" + key_vault_resource_arm_id: Optional[str] = rest_field( + name="keyVaultResourceArmId", visibility=["read", "create", "update", "delete", "query"] + ) + """The KeyVault resource ARM id for secret.""" + + @overload + def __init__( + self, + *, + secret_identifier: Optional[str] = None, + key_vault_resource_arm_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 DiskVolumeDetails(_Model): + """Volume details. + + :ivar label: The volume label. + :vartype label: str + :ivar name: The volume name. + :vartype name: str + """ + + label: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The volume label.""" + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The volume name.""" + + @overload + def __init__( + self, + *, + label: Optional[str] = None, + 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 Display(_Model): + """Contains the localized display information for this particular operation / action. These value + will be used by several clients for (1) custom role definitions for RBAC; (2) complex query + filters for the event service; and (3) audit history / records for management operations. + + :ivar provider: The provider. The localized friendly form of the resource provider name - it is + expected to also include the publisher/company responsible. It should use Title Casing and + begin with "Microsoft" for 1st party services. e.g. "Microsoft Monitoring Insights" or + "Microsoft Compute.". + :vartype provider: str + :ivar resource: The resource. The localized friendly form of the resource related to this + action/operation - it should match the public documentation for the resource provider. It + should use Title Casing. This value should be unique for a particular URL type (e.g. nested + types should *not* reuse their parent's display.resource field). e.g. "Virtual Machines" or + "Scheduler Job Collections", or "Virtual Machine VM Sizes" or "Scheduler Jobs". + :vartype resource: str + :ivar operation: The operation. The localized friendly name for the operation, as it should be + shown to the user. It should be concise (to fit in drop downs) but clear (i.e. + self-documenting). It should use Title Casing. Prescriptive guidance: Read Create or Update + Delete 'ActionName'. + :vartype operation: str + :ivar description: The description. The localized friendly description for the operation, as it + should be shown to the user. It should be thorough, yet concise - it will be used in tool tips + and detailed views. Prescriptive guidance for namespaces: Read any 'display.provider' resource + Create or Update any 'display.provider' resource Delete any 'display.provider' resource Perform + any other action on any 'display.provider' resource Prescriptive guidance for namespaces: Read + any 'display.resource' Create or Update any 'display.resource' Delete any 'display.resource' + 'ActionName' any 'display.resources'. + :vartype description: str + """ + + provider: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The provider. The localized friendly form of the resource provider name - it is expected to + also include the publisher/company responsible. It should use Title Casing and begin with + \"Microsoft\" for 1st party services. e.g. \"Microsoft Monitoring Insights\" or \"Microsoft + Compute.\".""" + resource: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The resource. The localized friendly form of the resource related to this action/operation - it + should match the public documentation for the resource provider. It should use Title Casing. + This value should be unique for a particular URL type (e.g. nested types should *not* reuse + their parent's display.resource field). e.g. \"Virtual Machines\" or \"Scheduler Job + Collections\", or \"Virtual Machine VM Sizes\" or \"Scheduler Jobs\".""" + operation: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The operation. The localized friendly name for the operation, as it should be shown to the + user. It should be concise (to fit in drop downs) but clear (i.e. self-documenting). It should + use Title Casing. Prescriptive guidance: Read Create or Update Delete 'ActionName'.""" + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The description. The localized friendly description for the operation, as it should be shown to + the user. It should be thorough, yet concise - it will be used in tool tips and detailed views. + Prescriptive guidance for namespaces: Read any 'display.provider' resource Create or Update any + 'display.provider' resource Delete any 'display.provider' resource Perform any other action on + any 'display.provider' resource Prescriptive guidance for namespaces: Read any + 'display.resource' Create or Update any 'display.resource' Delete any 'display.resource' + 'ActionName' any 'display.resources'.""" + + @overload + def __init__( + self, + *, + provider: Optional[str] = None, + resource: Optional[str] = None, + operation: Optional[str] = None, + description: 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 DraDetails(_Model): + """DRA details. + + :ivar id: The DRA Id. + :vartype id: str + :ivar name: The DRA name. + :vartype name: str + :ivar bios_id: The DRA Bios Id. + :vartype bios_id: str + :ivar version: The version. + :vartype version: str + :ivar last_heartbeat_utc: The last heartbeat received from the DRA. + :vartype last_heartbeat_utc: ~datetime.datetime + :ivar health: The health. Known values are: "None", "Normal", "Warning", and "Critical". + :vartype health: str or ~azure.mgmt.recoveryservicessiterecovery.models.ProtectionHealth + :ivar health_errors: The health errors. + :vartype health_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] + :ivar forward_protected_item_count: The count of protected items which are protected in forward + direction. + :vartype forward_protected_item_count: int + :ivar reverse_protected_item_count: The count of protected items which are protected in reverse + direction. + :vartype reverse_protected_item_count: int + """ + + id: Optional[str] = rest_field(visibility=["read"]) + """The DRA Id.""" + name: Optional[str] = rest_field(visibility=["read"]) + """The DRA name.""" + bios_id: Optional[str] = rest_field(name="biosId", visibility=["read"]) + """The DRA Bios Id.""" + version: Optional[str] = rest_field(visibility=["read"]) + """The version.""" + last_heartbeat_utc: Optional[datetime.datetime] = rest_field( + name="lastHeartbeatUtc", visibility=["read"], format="rfc3339" + ) + """The last heartbeat received from the DRA.""" + health: Optional[Union[str, "_models.ProtectionHealth"]] = rest_field(visibility=["read"]) + """The health. Known values are: \"None\", \"Normal\", \"Warning\", and \"Critical\".""" + health_errors: Optional[list["_models.HealthError"]] = rest_field(name="healthErrors", visibility=["read"]) + """The health errors.""" + forward_protected_item_count: Optional[int] = rest_field(name="forwardProtectedItemCount", visibility=["read"]) + """The count of protected items which are protected in forward direction.""" + reverse_protected_item_count: Optional[int] = rest_field(name="reverseProtectedItemCount", visibility=["read"]) + """The count of protected items which are protected in reverse direction.""" + + +class EnableMigrationInput(_Model): + """Enable migration input. + + :ivar properties: Enable migration input properties. Required. + :vartype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.EnableMigrationInputProperties + """ + + properties: "_models.EnableMigrationInputProperties" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Enable migration input properties. Required.""" + + @overload + def __init__( + self, + *, + properties: "_models.EnableMigrationInputProperties", + ) -> 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 EnableMigrationInputProperties(_Model): + """Enable migration input properties. + + :ivar policy_id: The policy Id. Required. + :vartype policy_id: str + :ivar provider_specific_details: The provider specific details. Required. + :vartype provider_specific_details: + ~azure.mgmt.recoveryservicessiterecovery.models.EnableMigrationProviderSpecificInput + """ + + policy_id: str = rest_field(name="policyId", visibility=["read", "create", "update", "delete", "query"]) + """The policy Id. Required.""" + provider_specific_details: "_models.EnableMigrationProviderSpecificInput" = rest_field( + name="providerSpecificDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """The provider specific details. Required.""" + + @overload + def __init__( + self, + *, + policy_id: str, + provider_specific_details: "_models.EnableMigrationProviderSpecificInput", + ) -> 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 EnableMigrationProviderSpecificInput(_Model): + """Enable migration provider specific input. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + VMwareCbtEnableMigrationInput + + :ivar instance_type: The class type. Required. Default value is None. + :vartype instance_type: str + """ + + __mapping__: dict[str, _Model] = {} + instance_type: str = rest_discriminator( + name="instanceType", visibility=["read", "create", "update", "delete", "query"] + ) + """The class type. Required. Default value is None.""" + + @overload + def __init__( + self, + *, + instance_type: str, + ) -> 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 EnableProtectionInput(_Model): + """Enable protection input. + + :ivar properties: Enable protection input properties. + :vartype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.EnableProtectionInputProperties + """ + + properties: Optional["_models.EnableProtectionInputProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Enable protection input properties.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.EnableProtectionInputProperties"] = 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 EnableProtectionInputProperties(_Model): + """Enable protection input properties. + + :ivar policy_id: The Policy Id. + :vartype policy_id: str + :ivar protectable_item_id: The protectable item Id. + :vartype protectable_item_id: str + :ivar provider_specific_details: The ReplicationProviderInput. For HyperVReplicaAzure provider, + it will be AzureEnableProtectionInput object. For San provider, it will be + SanEnableProtectionInput object. For HyperVReplicaAzure provider, it can be null. + :vartype provider_specific_details: + ~azure.mgmt.recoveryservicessiterecovery.models.EnableProtectionProviderSpecificInput + """ + + policy_id: Optional[str] = rest_field(name="policyId", visibility=["read", "create", "update", "delete", "query"]) + """The Policy Id.""" + protectable_item_id: Optional[str] = rest_field( + name="protectableItemId", visibility=["read", "create", "update", "delete", "query"] + ) + """The protectable item Id.""" + provider_specific_details: Optional["_models.EnableProtectionProviderSpecificInput"] = rest_field( + name="providerSpecificDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """The ReplicationProviderInput. For HyperVReplicaAzure provider, it will be + AzureEnableProtectionInput object. For San provider, it will be SanEnableProtectionInput + object. For HyperVReplicaAzure provider, it can be null.""" + + @overload + def __init__( + self, + *, + policy_id: Optional[str] = None, + protectable_item_id: Optional[str] = None, + provider_specific_details: Optional["_models.EnableProtectionProviderSpecificInput"] = 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 EncryptionDetails(_Model): + """Encryption details for the fabric. + + :ivar kek_state: The key encryption key state for the Vmm. + :vartype kek_state: str + :ivar kek_cert_thumbprint: The key encryption key certificate thumbprint. + :vartype kek_cert_thumbprint: str + :ivar kek_cert_expiry_date: The key encryption key certificate expiry date. + :vartype kek_cert_expiry_date: ~datetime.datetime + """ + + kek_state: Optional[str] = rest_field(name="kekState", visibility=["read", "create", "update", "delete", "query"]) + """The key encryption key state for the Vmm.""" + kek_cert_thumbprint: Optional[str] = rest_field( + name="kekCertThumbprint", visibility=["read", "create", "update", "delete", "query"] + ) + """The key encryption key certificate thumbprint.""" + kek_cert_expiry_date: Optional[datetime.datetime] = rest_field( + name="kekCertExpiryDate", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The key encryption key certificate expiry date.""" + + @overload + def __init__( + self, + *, + kek_state: Optional[str] = None, + kek_cert_thumbprint: Optional[str] = None, + kek_cert_expiry_date: 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 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.recoveryservicessiterecovery.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: + list[~azure.mgmt.recoveryservicessiterecovery.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.recoveryservicessiterecovery.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 Event(ProxyResource): + """Implements the Event class. + + :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.recoveryservicessiterecovery.models.SystemData + :ivar properties: Event related data. + :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.EventProperties + :ivar location: Resource Location. + :vartype location: str + """ + + properties: Optional["_models.EventProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Event related data.""" + location: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource Location.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.EventProperties"] = None, + location: 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 EventProperties(_Model): + """The properties of a monitoring event. + + :ivar event_code: The Id of the monitoring event. + :vartype event_code: str + :ivar description: The event name. + :vartype description: str + :ivar event_type: The type of the event. for example: VM Health, Server Health, Job Failure + etc. + :vartype event_type: str + :ivar affected_object_friendly_name: The friendly name of the source of the event on which it + is raised (for example, VM, VMM etc). + :vartype affected_object_friendly_name: str + :ivar affected_object_correlation_id: The affected object correlationId for the event. + :vartype affected_object_correlation_id: str + :ivar severity: The severity of the event. + :vartype severity: str + :ivar time_of_occurrence: The time of occurrence of the event. + :vartype time_of_occurrence: ~datetime.datetime + :ivar fabric_id: The ARM ID of the fabric. + :vartype fabric_id: str + :ivar provider_specific_details: The provider specific settings. + :vartype provider_specific_details: + ~azure.mgmt.recoveryservicessiterecovery.models.EventProviderSpecificDetails + :ivar event_specific_details: The event specific settings. + :vartype event_specific_details: + ~azure.mgmt.recoveryservicessiterecovery.models.EventSpecificDetails + :ivar health_errors: The list of errors / warnings capturing details associated with the + issue(s). + :vartype health_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] + """ + + event_code: Optional[str] = rest_field(name="eventCode", visibility=["read", "create", "update", "delete", "query"]) + """The Id of the monitoring event.""" + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The event name.""" + event_type: Optional[str] = rest_field(name="eventType", visibility=["read", "create", "update", "delete", "query"]) + """The type of the event. for example: VM Health, Server Health, Job Failure etc.""" + affected_object_friendly_name: Optional[str] = rest_field( + name="affectedObjectFriendlyName", visibility=["read", "create", "update", "delete", "query"] + ) + """The friendly name of the source of the event on which it is raised (for example, VM, VMM etc).""" + affected_object_correlation_id: Optional[str] = rest_field( + name="affectedObjectCorrelationId", visibility=["read", "create", "update", "delete", "query"] + ) + """The affected object correlationId for the event.""" + severity: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The severity of the event.""" + time_of_occurrence: Optional[datetime.datetime] = rest_field( + name="timeOfOccurrence", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The time of occurrence of the event.""" + fabric_id: Optional[str] = rest_field(name="fabricId", visibility=["read", "create", "update", "delete", "query"]) + """The ARM ID of the fabric.""" + provider_specific_details: Optional["_models.EventProviderSpecificDetails"] = rest_field( + name="providerSpecificDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """The provider specific settings.""" + event_specific_details: Optional["_models.EventSpecificDetails"] = rest_field( + name="eventSpecificDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """The event specific settings.""" + health_errors: Optional[list["_models.HealthError"]] = rest_field( + name="healthErrors", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of errors / warnings capturing details associated with the issue(s).""" + + @overload + def __init__( + self, + *, + event_code: Optional[str] = None, + description: Optional[str] = None, + event_type: Optional[str] = None, + affected_object_friendly_name: Optional[str] = None, + affected_object_correlation_id: Optional[str] = None, + severity: Optional[str] = None, + time_of_occurrence: Optional[datetime.datetime] = None, + fabric_id: Optional[str] = None, + provider_specific_details: Optional["_models.EventProviderSpecificDetails"] = None, + event_specific_details: Optional["_models.EventSpecificDetails"] = None, + health_errors: Optional[list["_models.HealthError"]] = 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 EventSpecificDetails(_Model): + """Model class for event specific details for an event. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + JobStatusEventDetails + + :ivar instance_type: Gets the class type. Overridden in derived classes. Required. Default + value is None. + :vartype instance_type: str + """ + + __mapping__: dict[str, _Model] = {} + instance_type: str = rest_discriminator( + name="instanceType", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets the class type. Overridden in derived classes. Required. Default value is None.""" + + @overload + def __init__( + self, + *, + instance_type: str, + ) -> 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 ProtectionProfileCustomDetails(_Model): + """Protection Profile custom input. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + ExistingProtectionProfile, NewProtectionProfile + + :ivar resource_type: The class type. Required. Default value is None. + :vartype resource_type: str + """ + + __mapping__: dict[str, _Model] = {} + resource_type: str = rest_discriminator( + name="resourceType", visibility=["read", "create", "update", "delete", "query"] + ) + """The class type. Required. Default value is None.""" + + @overload + def __init__( + self, + *, + resource_type: str, + ) -> 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 ExistingProtectionProfile(ProtectionProfileCustomDetails, discriminator="Existing"): + """Existing storage account input. + + :ivar protection_profile_id: The protection profile Arm Id. Throw error, if resource does not + exists. Required. + :vartype protection_profile_id: str + :ivar resource_type: The class type. Required. Default value is "Existing". + :vartype resource_type: str + """ + + protection_profile_id: str = rest_field( + name="protectionProfileId", visibility=["read", "create", "update", "delete", "query"] + ) + """The protection profile Arm Id. Throw error, if resource does not exists. Required.""" + resource_type: Literal["Existing"] = rest_discriminator(name="resourceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The class type. Required. Default value is \"Existing\".""" + + @overload + def __init__( + self, + *, + protection_profile_id: str, + ) -> 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) + self.resource_type = "Existing" # type: ignore + + +class RecoveryAvailabilitySetCustomDetails(_Model): + """Recovery Availability Set custom input. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + ExistingRecoveryAvailabilitySet + + :ivar resource_type: The class type. Required. Default value is None. + :vartype resource_type: str + """ + + __mapping__: dict[str, _Model] = {} + resource_type: str = rest_discriminator( + name="resourceType", visibility=["read", "create", "update", "delete", "query"] + ) + """The class type. Required. Default value is None.""" + + @overload + def __init__( + self, + *, + resource_type: str, + ) -> 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 ExistingRecoveryAvailabilitySet(RecoveryAvailabilitySetCustomDetails, discriminator="Existing"): + """Existing recovery availability set input. + + :ivar recovery_availability_set_id: The recovery availability set Id. Will throw error, if + resource does not exist. + :vartype recovery_availability_set_id: str + :ivar resource_type: The class type. Required. Default value is "Existing". + :vartype resource_type: str + """ + + recovery_availability_set_id: Optional[str] = rest_field( + name="recoveryAvailabilitySetId", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery availability set Id. Will throw error, if resource does not exist.""" + resource_type: Literal["Existing"] = rest_discriminator(name="resourceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The class type. Required. Default value is \"Existing\".""" + + @overload + def __init__( + self, + *, + recovery_availability_set_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) + self.resource_type = "Existing" # type: ignore + + +class RecoveryProximityPlacementGroupCustomDetails(_Model): # pylint: disable=name-too-long + """Recovery Proximity placement group custom input. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + ExistingRecoveryProximityPlacementGroup + + :ivar resource_type: The class type. Required. Default value is None. + :vartype resource_type: str + """ + + __mapping__: dict[str, _Model] = {} + resource_type: str = rest_discriminator( + name="resourceType", visibility=["read", "create", "update", "delete", "query"] + ) + """The class type. Required. Default value is None.""" + + @overload + def __init__( + self, + *, + resource_type: str, + ) -> 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 ExistingRecoveryProximityPlacementGroup(RecoveryProximityPlacementGroupCustomDetails, discriminator="Existing"): + """Existing recovery proximity placement group input. + + :ivar recovery_proximity_placement_group_id: The recovery proximity placement group Id. Will + throw error, if resource does not exist. + :vartype recovery_proximity_placement_group_id: str + :ivar resource_type: The class type. Required. Default value is "Existing". + :vartype resource_type: str + """ + + recovery_proximity_placement_group_id: Optional[str] = rest_field( + name="recoveryProximityPlacementGroupId", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery proximity placement group Id. Will throw error, if resource does not exist.""" + resource_type: Literal["Existing"] = rest_discriminator(name="resourceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The class type. Required. Default value is \"Existing\".""" + + @overload + def __init__( + self, + *, + recovery_proximity_placement_group_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) + self.resource_type = "Existing" # type: ignore + + +class RecoveryResourceGroupCustomDetails(_Model): + """Recovery Resource Group custom input. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + ExistingRecoveryResourceGroup + + :ivar resource_type: The class type. Required. Default value is None. + :vartype resource_type: str + """ + + __mapping__: dict[str, _Model] = {} + resource_type: str = rest_discriminator( + name="resourceType", visibility=["read", "create", "update", "delete", "query"] + ) + """The class type. Required. Default value is None.""" + + @overload + def __init__( + self, + *, + resource_type: str, + ) -> 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 ExistingRecoveryResourceGroup(RecoveryResourceGroupCustomDetails, discriminator="Existing"): + """Existing recovery resource group input. + + :ivar recovery_resource_group_id: The recovery resource group Id. Valid for V2 scenarios. + :vartype recovery_resource_group_id: str + :ivar resource_type: The class type. Required. Default value is "Existing". + :vartype resource_type: str + """ + + recovery_resource_group_id: Optional[str] = rest_field( + name="recoveryResourceGroupId", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery resource group Id. Valid for V2 scenarios.""" + resource_type: Literal["Existing"] = rest_discriminator(name="resourceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The class type. Required. Default value is \"Existing\".""" + + @overload + def __init__( + self, + *, + recovery_resource_group_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) + self.resource_type = "Existing" # type: ignore + + +class RecoveryVirtualNetworkCustomDetails(_Model): + """Recovery Virtual network custom input. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + ExistingRecoveryVirtualNetwork, NewRecoveryVirtualNetwork + + :ivar resource_type: The class type. Required. Default value is None. + :vartype resource_type: str + """ + + __mapping__: dict[str, _Model] = {} + resource_type: str = rest_discriminator( + name="resourceType", visibility=["read", "create", "update", "delete", "query"] + ) + """The class type. Required. Default value is None.""" + + @overload + def __init__( + self, + *, + resource_type: str, + ) -> 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 ExistingRecoveryVirtualNetwork(RecoveryVirtualNetworkCustomDetails, discriminator="Existing"): + """Existing recovery virtual network input. + + :ivar recovery_virtual_network_id: The recovery virtual network Id. Will throw error, if + resource does not exist. Required. + :vartype recovery_virtual_network_id: str + :ivar recovery_subnet_name: The recovery subnet name. + :vartype recovery_subnet_name: str + :ivar resource_type: The class type. Required. Default value is "Existing". + :vartype resource_type: str + """ + + recovery_virtual_network_id: str = rest_field( + name="recoveryVirtualNetworkId", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery virtual network Id. Will throw error, if resource does not exist. Required.""" + recovery_subnet_name: Optional[str] = rest_field( + name="recoverySubnetName", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery subnet name.""" + resource_type: Literal["Existing"] = rest_discriminator(name="resourceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The class type. Required. Default value is \"Existing\".""" + + @overload + def __init__( + self, + *, + recovery_virtual_network_id: str, + recovery_subnet_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) + self.resource_type = "Existing" # type: ignore + + +class StorageAccountCustomDetails(_Model): + """Storage account custom input. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + ExistingStorageAccount + + :ivar resource_type: The class type. Required. Default value is None. + :vartype resource_type: str + """ + + __mapping__: dict[str, _Model] = {} + resource_type: str = rest_discriminator( + name="resourceType", visibility=["read", "create", "update", "delete", "query"] + ) + """The class type. Required. Default value is None.""" + + @overload + def __init__( + self, + *, + resource_type: str, + ) -> 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 ExistingStorageAccount(StorageAccountCustomDetails, discriminator="Existing"): + """Existing storage account input. + + :ivar azure_storage_account_id: The storage account Arm Id. Throw error, if resource does not + exists. Required. + :vartype azure_storage_account_id: str + :ivar resource_type: The class type. Required. Default value is "Existing". + :vartype resource_type: str + """ + + azure_storage_account_id: str = rest_field( + name="azureStorageAccountId", visibility=["read", "create", "update", "delete", "query"] + ) + """The storage account Arm Id. Throw error, if resource does not exists. Required.""" + resource_type: Literal["Existing"] = rest_discriminator(name="resourceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The class type. Required. Default value is \"Existing\".""" + + @overload + def __init__( + self, + *, + azure_storage_account_id: str, + ) -> 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) + self.resource_type = "Existing" # type: ignore + + +class ExportJobDetails(JobDetails, discriminator="ExportJobDetails"): + """This class represents details for export jobs workflow. + + :ivar affected_object_details: The affected object properties like source server, source cloud, + target server, target cloud etc. based on the workflow object details. + :vartype affected_object_details: dict[str, str] + :ivar blob_uri: BlobUri of the exported jobs. + :vartype blob_uri: str + :ivar sas_token: The sas token to access blob. + :vartype sas_token: str + :ivar instance_type: Gets the type of job details (see JobDetailsTypes enum for possible + values). Required. Default value is "ExportJobDetails". + :vartype instance_type: str + """ + + blob_uri: Optional[str] = rest_field(name="blobUri", visibility=["read", "create", "update", "delete", "query"]) + """BlobUri of the exported jobs.""" + sas_token: Optional[str] = rest_field(name="sasToken", visibility=["read", "create", "update", "delete", "query"]) + """The sas token to access blob.""" + instance_type: Literal["ExportJobDetails"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets the type of job details (see JobDetailsTypes enum for possible values). Required. Default + value is \"ExportJobDetails\".""" + + @overload + def __init__( + self, + *, + affected_object_details: Optional[dict[str, str]] = None, + blob_uri: Optional[str] = None, + sas_token: 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) + self.instance_type = "ExportJobDetails" # type: ignore + + +class ExtendedLocation(_Model): + """Extended location of the resource. + + :ivar name: The name of the extended location. Required. + :vartype name: str + :ivar type: The extended location type. Required. "EdgeZone" + :vartype type: str or ~azure.mgmt.recoveryservicessiterecovery.models.ExtendedLocationType + """ + + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the extended location. Required.""" + type: Union[str, "_models.ExtendedLocationType"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The extended location type. Required. \"EdgeZone\"""" + + @overload + def __init__( + self, + *, + name: str, + type: Union[str, "_models.ExtendedLocationType"], + ) -> 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 Fabric(ProxyResource): + """Fabric definition. + + :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.recoveryservicessiterecovery.models.SystemData + :ivar properties: Fabric related data. + :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.FabricProperties + :ivar location: Resource Location. + :vartype location: str + """ + + properties: Optional["_models.FabricProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Fabric related data.""" + location: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource Location.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.FabricProperties"] = None, + location: 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 FabricCreationInput(_Model): + """Site details provided during the time of site creation. + + :ivar properties: Fabric creation input. + :vartype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.FabricCreationInputProperties + """ + + properties: Optional["_models.FabricCreationInputProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Fabric creation input.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.FabricCreationInputProperties"] = 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 FabricCreationInputProperties(_Model): + """Properties of site details provided during the time of site creation. + + :ivar custom_details: Fabric provider specific creation input. + :vartype custom_details: + ~azure.mgmt.recoveryservicessiterecovery.models.FabricSpecificCreationInput + """ + + custom_details: Optional["_models.FabricSpecificCreationInput"] = rest_field( + name="customDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """Fabric provider specific creation input.""" + + @overload + def __init__( + self, + *, + custom_details: Optional["_models.FabricSpecificCreationInput"] = 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 FabricProperties(_Model): + """Fabric properties. + + :ivar friendly_name: Friendly name of the fabric. + :vartype friendly_name: str + :ivar encryption_details: Encryption details for the fabric. + :vartype encryption_details: ~azure.mgmt.recoveryservicessiterecovery.models.EncryptionDetails + :ivar rollover_encryption_details: Rollover encryption details for the fabric. + :vartype rollover_encryption_details: + ~azure.mgmt.recoveryservicessiterecovery.models.EncryptionDetails + :ivar internal_identifier: Dra Registration Id. + :vartype internal_identifier: str + :ivar bcdr_state: BCDR state of the fabric. + :vartype bcdr_state: str + :ivar custom_details: Fabric specific settings. + :vartype custom_details: ~azure.mgmt.recoveryservicessiterecovery.models.FabricSpecificDetails + :ivar health_error_details: Fabric health error details. + :vartype health_error_details: + list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] + :ivar health: Health of fabric. + :vartype health: str + """ + + friendly_name: Optional[str] = rest_field( + name="friendlyName", visibility=["read", "create", "update", "delete", "query"] + ) + """Friendly name of the fabric.""" + encryption_details: Optional["_models.EncryptionDetails"] = rest_field( + name="encryptionDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """Encryption details for the fabric.""" + rollover_encryption_details: Optional["_models.EncryptionDetails"] = rest_field( + name="rolloverEncryptionDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """Rollover encryption details for the fabric.""" + internal_identifier: Optional[str] = rest_field( + name="internalIdentifier", visibility=["read", "create", "update", "delete", "query"] + ) + """Dra Registration Id.""" + bcdr_state: Optional[str] = rest_field(name="bcdrState", visibility=["read", "create", "update", "delete", "query"]) + """BCDR state of the fabric.""" + custom_details: Optional["_models.FabricSpecificDetails"] = rest_field( + name="customDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """Fabric specific settings.""" + health_error_details: Optional[list["_models.HealthError"]] = rest_field( + name="healthErrorDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """Fabric health error details.""" + health: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Health of fabric.""" + + @overload + def __init__( + self, + *, + friendly_name: Optional[str] = None, + encryption_details: Optional["_models.EncryptionDetails"] = None, + rollover_encryption_details: Optional["_models.EncryptionDetails"] = None, + internal_identifier: Optional[str] = None, + bcdr_state: Optional[str] = None, + custom_details: Optional["_models.FabricSpecificDetails"] = None, + health_error_details: Optional[list["_models.HealthError"]] = None, + health: 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 JobTaskDetails(TaskTypeDetails, discriminator="JobTaskDetails"): + """This class represents a task which is actually a workflow so that one can navigate to its + individual drill down. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + FabricReplicationGroupTaskDetails, VirtualMachineTaskDetails + + :ivar instance_type: Required. Default value is "JobTaskDetails". + :vartype instance_type: str + :ivar job_task: The job entity. + :vartype job_task: ~azure.mgmt.recoveryservicessiterecovery.models.JobEntity + """ + + __mapping__: dict[str, _Model] = {} + instance_type: Literal["JobTaskDetails"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Required. Default value is \"JobTaskDetails\".""" + job_task: Optional["_models.JobEntity"] = rest_field( + name="jobTask", visibility=["read", "create", "update", "delete", "query"] + ) + """The job entity.""" + + @overload + def __init__( + self, + *, + job_task: Optional["_models.JobEntity"] = 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) + self.instance_type = "JobTaskDetails" # type: ignore + + +class FabricReplicationGroupTaskDetails(JobTaskDetails, discriminator="FabricReplicationGroupTaskDetails"): + """This class represents the fabric replication group task details. + + :ivar job_task: The job entity. + :vartype job_task: ~azure.mgmt.recoveryservicessiterecovery.models.JobEntity + :ivar instance_type: The type of task details. Required. Default value is + "FabricReplicationGroupTaskDetails". + :vartype instance_type: str + :ivar skipped_reason: The skipped reason. + :vartype skipped_reason: str + :ivar skipped_reason_string: The skipped reason string. + :vartype skipped_reason_string: str + """ + + instance_type: Literal["FabricReplicationGroupTaskDetails"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The type of task details. Required. Default value is \"FabricReplicationGroupTaskDetails\".""" + skipped_reason: Optional[str] = rest_field( + name="skippedReason", visibility=["read", "create", "update", "delete", "query"] + ) + """The skipped reason.""" + skipped_reason_string: Optional[str] = rest_field( + name="skippedReasonString", visibility=["read", "create", "update", "delete", "query"] + ) + """The skipped reason string.""" + + @overload + def __init__( + self, + *, + job_task: Optional["_models.JobEntity"] = None, + skipped_reason: Optional[str] = None, + skipped_reason_string: 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) + self.instance_type = "FabricReplicationGroupTaskDetails" # type: ignore + + +class FailoverJobDetails(JobDetails, discriminator="FailoverJobDetails"): + """This class represents the details for a failover job. + + :ivar affected_object_details: The affected object properties like source server, source cloud, + target server, target cloud etc. based on the workflow object details. + :vartype affected_object_details: dict[str, str] + :ivar protected_item_details: The test VM details. + :vartype protected_item_details: + list[~azure.mgmt.recoveryservicessiterecovery.models.FailoverReplicationProtectedItemDetails] + :ivar instance_type: Gets the type of job details (see JobDetailsTypes enum for possible + values). Required. Default value is "FailoverJobDetails". + :vartype instance_type: str + """ + + protected_item_details: Optional[list["_models.FailoverReplicationProtectedItemDetails"]] = rest_field( + name="protectedItemDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """The test VM details.""" + instance_type: Literal["FailoverJobDetails"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets the type of job details (see JobDetailsTypes enum for possible values). Required. Default + value is \"FailoverJobDetails\".""" + + @overload + def __init__( + self, + *, + affected_object_details: Optional[dict[str, str]] = None, + protected_item_details: Optional[list["_models.FailoverReplicationProtectedItemDetails"]] = 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) + self.instance_type = "FailoverJobDetails" # type: ignore + + +class FailoverProcessServerRequest(_Model): + """Request to failover a process server. + + :ivar properties: The properties of the PS Failover request. + :vartype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.FailoverProcessServerRequestProperties + """ + + properties: Optional["_models.FailoverProcessServerRequestProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The properties of the PS Failover request.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.FailoverProcessServerRequestProperties"] = 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 FailoverProcessServerRequestProperties(_Model): + """The properties of the Failover Process Server request. + + :ivar container_name: The container identifier. + :vartype container_name: str + :ivar source_process_server_id: The source process server. + :vartype source_process_server_id: str + :ivar target_process_server_id: The new process server. + :vartype target_process_server_id: str + :ivar vms_to_migrate: The VMS to migrate. + :vartype vms_to_migrate: list[str] + :ivar update_type: A value for failover type. It can be systemlevel/serverlevel. + :vartype update_type: str + """ + + container_name: Optional[str] = rest_field( + name="containerName", visibility=["read", "create", "update", "delete", "query"] + ) + """The container identifier.""" + source_process_server_id: Optional[str] = rest_field( + name="sourceProcessServerId", visibility=["read", "create", "update", "delete", "query"] + ) + """The source process server.""" + target_process_server_id: Optional[str] = rest_field( + name="targetProcessServerId", visibility=["read", "create", "update", "delete", "query"] + ) + """The new process server.""" + vms_to_migrate: Optional[list[str]] = rest_field( + name="vmsToMigrate", visibility=["read", "create", "update", "delete", "query"] + ) + """The VMS to migrate.""" + update_type: Optional[str] = rest_field( + name="updateType", visibility=["read", "create", "update", "delete", "query"] + ) + """A value for failover type. It can be systemlevel/serverlevel.""" + + @overload + def __init__( + self, + *, + container_name: Optional[str] = None, + source_process_server_id: Optional[str] = None, + target_process_server_id: Optional[str] = None, + vms_to_migrate: Optional[list[str]] = None, + update_type: 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 FailoverReplicationProtectedItemDetails(_Model): + """Failover details for a replication protected item. + + :ivar name: The name. + :vartype name: str + :ivar friendly_name: The friendly name. + :vartype friendly_name: str + :ivar test_vm_name: The test Vm name. + :vartype test_vm_name: str + :ivar test_vm_friendly_name: The test Vm friendly name. + :vartype test_vm_friendly_name: str + :ivar network_connection_status: The network connection status. + :vartype network_connection_status: str + :ivar network_friendly_name: The network friendly name. + :vartype network_friendly_name: str + :ivar subnet: The network subnet. + :vartype subnet: str + :ivar recovery_point_id: The recovery point Id. + :vartype recovery_point_id: str + :ivar recovery_point_time: The recovery point time. + :vartype recovery_point_time: ~datetime.datetime + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name.""" + friendly_name: Optional[str] = rest_field( + name="friendlyName", visibility=["read", "create", "update", "delete", "query"] + ) + """The friendly name.""" + test_vm_name: Optional[str] = rest_field( + name="testVmName", visibility=["read", "create", "update", "delete", "query"] + ) + """The test Vm name.""" + test_vm_friendly_name: Optional[str] = rest_field( + name="testVmFriendlyName", visibility=["read", "create", "update", "delete", "query"] + ) + """The test Vm friendly name.""" + network_connection_status: Optional[str] = rest_field( + name="networkConnectionStatus", visibility=["read", "create", "update", "delete", "query"] + ) + """The network connection status.""" + network_friendly_name: Optional[str] = rest_field( + name="networkFriendlyName", visibility=["read", "create", "update", "delete", "query"] + ) + """The network friendly name.""" + subnet: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The network subnet.""" + recovery_point_id: Optional[str] = rest_field( + name="recoveryPointId", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery point Id.""" + recovery_point_time: Optional[datetime.datetime] = rest_field( + name="recoveryPointTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The recovery point time.""" + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + friendly_name: Optional[str] = None, + test_vm_name: Optional[str] = None, + test_vm_friendly_name: Optional[str] = None, + network_connection_status: Optional[str] = None, + network_friendly_name: Optional[str] = None, + subnet: Optional[str] = None, + recovery_point_id: Optional[str] = None, + recovery_point_time: 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 GatewayOperationDetails(_Model): + """Details of the gateway operation. + + :ivar state: A value indicating the state of gateway operation. + :vartype state: str + :ivar progress_percentage: A value indicating the progress percentage of gateway operation. + :vartype progress_percentage: int + :ivar time_elapsed: A value indicating the time elapsed for the operation in milliseconds. + :vartype time_elapsed: int + :ivar time_remaining: A value indicating the time remaining for the operation in milliseconds. + :vartype time_remaining: int + :ivar upload_speed: A value indicating the upload speed in bytes per second. + :vartype upload_speed: int + :ivar host_name: A value indicating the ESXi host name. + :vartype host_name: str + :ivar data_stores: A value indicating the datastore collection. + :vartype data_stores: list[str] + :ivar vmware_read_throughput: A value indicating the VMware read throughput in bytes per + second. + :vartype vmware_read_throughput: int + """ + + state: Optional[str] = rest_field(visibility=["read"]) + """A value indicating the state of gateway operation.""" + progress_percentage: Optional[int] = rest_field(name="progressPercentage", visibility=["read"]) + """A value indicating the progress percentage of gateway operation.""" + time_elapsed: Optional[int] = rest_field(name="timeElapsed", visibility=["read"]) + """A value indicating the time elapsed for the operation in milliseconds.""" + time_remaining: Optional[int] = rest_field(name="timeRemaining", visibility=["read"]) + """A value indicating the time remaining for the operation in milliseconds.""" + upload_speed: Optional[int] = rest_field(name="uploadSpeed", visibility=["read"]) + """A value indicating the upload speed in bytes per second.""" + host_name: Optional[str] = rest_field(name="hostName", visibility=["read"]) + """A value indicating the ESXi host name.""" + data_stores: Optional[list[str]] = rest_field(name="dataStores", visibility=["read"]) + """A value indicating the datastore collection.""" + vmware_read_throughput: Optional[int] = rest_field(name="vmwareReadThroughput", visibility=["read"]) + """A value indicating the VMware read throughput in bytes per second.""" + + +class GroupTaskDetails(_Model): + """This class represents the group task details when parent child relationship exists in the drill + down. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + InlineWorkflowTaskDetails, RecoveryPlanGroupTaskDetails, RecoveryPlanShutdownGroupTaskDetails + + :ivar instance_type: The type of task details. Required. Default value is None. + :vartype instance_type: str + :ivar child_tasks: The child tasks. + :vartype child_tasks: list[~azure.mgmt.recoveryservicessiterecovery.models.ASRTask] + """ + + __mapping__: dict[str, _Model] = {} + instance_type: str = rest_discriminator( + name="instanceType", visibility=["read", "create", "update", "delete", "query"] + ) + """The type of task details. Required. Default value is None.""" + child_tasks: Optional[list["_models.ASRTask"]] = rest_field( + name="childTasks", visibility=["read", "create", "update", "delete", "query"] + ) + """The child tasks.""" + + @overload + def __init__( + self, + *, + instance_type: str, + child_tasks: Optional[list["_models.ASRTask"]] = 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 HealthError(_Model): + """Health Error. + + :ivar inner_health_errors: The inner health errors. HealthError having a list of HealthError as + child errors is problematic. InnerHealthError is used because this will prevent an infinite + loop of structures when Hydra tries to auto-generate the contract. We are exposing the related + health errors as inner health errors and all API consumers can utilize this in the same fashion + as Exception -> InnerException. + :vartype inner_health_errors: + list[~azure.mgmt.recoveryservicessiterecovery.models.InnerHealthError] + :ivar error_source: Source of error. + :vartype error_source: str + :ivar error_type: Type of error. + :vartype error_type: str + :ivar error_level: Level of error. + :vartype error_level: str + :ivar error_category: Category of error. + :vartype error_category: str + :ivar error_code: Error code. + :vartype error_code: str + :ivar summary_message: Summary message of the entity. + :vartype summary_message: str + :ivar error_message: Error message. + :vartype error_message: str + :ivar possible_causes: Possible causes of error. + :vartype possible_causes: str + :ivar recommended_action: Recommended action to resolve error. + :vartype recommended_action: str + :ivar creation_time_utc: Error creation time (UTC). + :vartype creation_time_utc: ~datetime.datetime + :ivar recovery_provider_error_message: DRA error message. + :vartype recovery_provider_error_message: str + :ivar entity_id: ID of the entity. + :vartype entity_id: str + :ivar error_id: The health error unique id. + :vartype error_id: str + :ivar customer_resolvability: Value indicating whether the health error is customer resolvable. + Known values are: "Allowed" and "NotAllowed". + :vartype customer_resolvability: str or + ~azure.mgmt.recoveryservicessiterecovery.models.HealthErrorCustomerResolvability + """ + + inner_health_errors: Optional[list["_models.InnerHealthError"]] = rest_field( + name="innerHealthErrors", visibility=["read", "create", "update", "delete", "query"] + ) + """The inner health errors. HealthError having a list of HealthError as child errors is + problematic. InnerHealthError is used because this will prevent an infinite loop of structures + when Hydra tries to auto-generate the contract. We are exposing the related health errors as + inner health errors and all API consumers can utilize this in the same fashion as Exception + -> InnerException.""" + error_source: Optional[str] = rest_field( + name="errorSource", visibility=["read", "create", "update", "delete", "query"] + ) + """Source of error.""" + error_type: Optional[str] = rest_field(name="errorType", visibility=["read", "create", "update", "delete", "query"]) + """Type of error.""" + error_level: Optional[str] = rest_field( + name="errorLevel", visibility=["read", "create", "update", "delete", "query"] + ) + """Level of error.""" + error_category: Optional[str] = rest_field( + name="errorCategory", visibility=["read", "create", "update", "delete", "query"] + ) + """Category of error.""" + error_code: Optional[str] = rest_field(name="errorCode", visibility=["read", "create", "update", "delete", "query"]) + """Error code.""" + summary_message: Optional[str] = rest_field( + name="summaryMessage", visibility=["read", "create", "update", "delete", "query"] + ) + """Summary message of the entity.""" + error_message: Optional[str] = rest_field( + name="errorMessage", visibility=["read", "create", "update", "delete", "query"] + ) + """Error message.""" + possible_causes: Optional[str] = rest_field( + name="possibleCauses", visibility=["read", "create", "update", "delete", "query"] + ) + """Possible causes of error.""" + recommended_action: Optional[str] = rest_field( + name="recommendedAction", visibility=["read", "create", "update", "delete", "query"] + ) + """Recommended action to resolve error.""" + creation_time_utc: Optional[datetime.datetime] = rest_field( + name="creationTimeUtc", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """Error creation time (UTC).""" + recovery_provider_error_message: Optional[str] = rest_field( + name="recoveryProviderErrorMessage", visibility=["read", "create", "update", "delete", "query"] + ) + """DRA error message.""" + entity_id: Optional[str] = rest_field(name="entityId", visibility=["read", "create", "update", "delete", "query"]) + """ID of the entity.""" + error_id: Optional[str] = rest_field(name="errorId", visibility=["read", "create", "update", "delete", "query"]) + """The health error unique id.""" + customer_resolvability: Optional[Union[str, "_models.HealthErrorCustomerResolvability"]] = rest_field( + name="customerResolvability", visibility=["read", "create", "update", "delete", "query"] + ) + """Value indicating whether the health error is customer resolvable. Known values are: \"Allowed\" + and \"NotAllowed\".""" + + @overload + def __init__( + self, + *, + inner_health_errors: Optional[list["_models.InnerHealthError"]] = None, + error_source: Optional[str] = None, + error_type: Optional[str] = None, + error_level: Optional[str] = None, + error_category: Optional[str] = None, + error_code: Optional[str] = None, + summary_message: Optional[str] = None, + error_message: Optional[str] = None, + possible_causes: Optional[str] = None, + recommended_action: Optional[str] = None, + creation_time_utc: Optional[datetime.datetime] = None, + recovery_provider_error_message: Optional[str] = None, + entity_id: Optional[str] = None, + error_id: Optional[str] = None, + customer_resolvability: Optional[Union[str, "_models.HealthErrorCustomerResolvability"]] = 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 HealthErrorSummary(_Model): + """class to define the summary of the health error details. + + :ivar summary_code: The code of the health error. + :vartype summary_code: str + :ivar category: The category of the health error. Known values are: "None", "Replication", + "TestFailover", "Configuration", "FabricInfrastructure", "VersionExpiry", + "AgentAutoUpdateInfra", "AgentAutoUpdateArtifactDeleted", "AgentAutoUpdateRunAsAccount", + "AgentAutoUpdateRunAsAccountExpiry", and "AgentAutoUpdateRunAsAccountExpired". + :vartype category: str or ~azure.mgmt.recoveryservicessiterecovery.models.HealthErrorCategory + :ivar severity: Severity of error. Known values are: "NONE", "Warning", "Error", and "Info". + :vartype severity: str or ~azure.mgmt.recoveryservicessiterecovery.models.Severity + :ivar summary_message: The summary message of the health error. + :vartype summary_message: str + :ivar affected_resource_type: The type of affected ARM resource. + :vartype affected_resource_type: str + :ivar affected_resource_subtype: The sub type of any subcomponent within the ARM resource that + this might be applicable. Value remains null if not applicable. + :vartype affected_resource_subtype: str + :ivar affected_resource_correlation_ids: The list of affected resource correlation Ids. This + can be used to uniquely identify the count of items affected by a specific category and + severity as well as count of item affected by an specific issue. + :vartype affected_resource_correlation_ids: list[str] + """ + + summary_code: Optional[str] = rest_field( + name="summaryCode", visibility=["read", "create", "update", "delete", "query"] + ) + """The code of the health error.""" + category: Optional[Union[str, "_models.HealthErrorCategory"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The category of the health error. Known values are: \"None\", \"Replication\", + \"TestFailover\", \"Configuration\", \"FabricInfrastructure\", \"VersionExpiry\", + \"AgentAutoUpdateInfra\", \"AgentAutoUpdateArtifactDeleted\", \"AgentAutoUpdateRunAsAccount\", + \"AgentAutoUpdateRunAsAccountExpiry\", and \"AgentAutoUpdateRunAsAccountExpired\".""" + severity: Optional[Union[str, "_models.Severity"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Severity of error. Known values are: \"NONE\", \"Warning\", \"Error\", and \"Info\".""" + summary_message: Optional[str] = rest_field( + name="summaryMessage", visibility=["read", "create", "update", "delete", "query"] + ) + """The summary message of the health error.""" + affected_resource_type: Optional[str] = rest_field( + name="affectedResourceType", visibility=["read", "create", "update", "delete", "query"] + ) + """The type of affected ARM resource.""" + affected_resource_subtype: Optional[str] = rest_field( + name="affectedResourceSubtype", visibility=["read", "create", "update", "delete", "query"] + ) + """The sub type of any subcomponent within the ARM resource that this might be applicable. Value + remains null if not applicable.""" + affected_resource_correlation_ids: Optional[list[str]] = rest_field( + name="affectedResourceCorrelationIds", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of affected resource correlation Ids. This can be used to uniquely identify the count + of items affected by a specific category and severity as well as count of item affected by an + specific issue.""" + + @overload + def __init__( + self, + *, + summary_code: Optional[str] = None, + category: Optional[Union[str, "_models.HealthErrorCategory"]] = None, + severity: Optional[Union[str, "_models.Severity"]] = None, + summary_message: Optional[str] = None, + affected_resource_type: Optional[str] = None, + affected_resource_subtype: Optional[str] = None, + affected_resource_correlation_ids: 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 HyperVHostDetails(_Model): + """Hyper-V host details. + + :ivar id: The Hyper-V host Id. + :vartype id: str + :ivar name: The Hyper-V host name. + :vartype name: str + :ivar mars_agent_version: The Mars agent version. + :vartype mars_agent_version: str + """ + + id: Optional[str] = rest_field(visibility=["read"]) + """The Hyper-V host Id.""" + name: Optional[str] = rest_field(visibility=["read"]) + """The Hyper-V host name.""" + mars_agent_version: Optional[str] = rest_field(name="marsAgentVersion", visibility=["read"]) + """The Mars agent version.""" + + +class HyperVReplica2012EventDetails(EventProviderSpecificDetails, discriminator="HyperVReplica2012"): + """Model class for event details of a HyperVReplica E2E event. + + :ivar container_name: The container friendly name. + :vartype container_name: str + :ivar fabric_name: The fabric friendly name. + :vartype fabric_name: str + :ivar remote_container_name: The remote container name. + :vartype remote_container_name: str + :ivar remote_fabric_name: The remote fabric name. + :vartype remote_fabric_name: str + :ivar instance_type: Gets the class type. Overridden in derived classes. Required. Default + value is "HyperVReplica2012". + :vartype instance_type: str + """ + + container_name: Optional[str] = rest_field( + name="containerName", visibility=["read", "create", "update", "delete", "query"] + ) + """The container friendly name.""" + fabric_name: Optional[str] = rest_field( + name="fabricName", visibility=["read", "create", "update", "delete", "query"] + ) + """The fabric friendly name.""" + remote_container_name: Optional[str] = rest_field( + name="remoteContainerName", visibility=["read", "create", "update", "delete", "query"] + ) + """The remote container name.""" + remote_fabric_name: Optional[str] = rest_field( + name="remoteFabricName", visibility=["read", "create", "update", "delete", "query"] + ) + """The remote fabric name.""" + instance_type: Literal["HyperVReplica2012"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets the class type. Overridden in derived classes. Required. Default value is + \"HyperVReplica2012\".""" + + @overload + def __init__( + self, + *, + container_name: Optional[str] = None, + fabric_name: Optional[str] = None, + remote_container_name: Optional[str] = None, + remote_fabric_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) + self.instance_type = "HyperVReplica2012" # type: ignore + + +class HyperVReplica2012R2EventDetails(EventProviderSpecificDetails, discriminator="HyperVReplica2012R2"): + """Model class for event details of a HyperVReplica blue E2E event. + + :ivar container_name: The container friendly name. + :vartype container_name: str + :ivar fabric_name: The fabric friendly name. + :vartype fabric_name: str + :ivar remote_container_name: The remote container name. + :vartype remote_container_name: str + :ivar remote_fabric_name: The remote fabric name. + :vartype remote_fabric_name: str + :ivar instance_type: Gets the class type. Overridden in derived classes. Required. Default + value is "HyperVReplica2012R2". + :vartype instance_type: str + """ + + container_name: Optional[str] = rest_field( + name="containerName", visibility=["read", "create", "update", "delete", "query"] + ) + """The container friendly name.""" + fabric_name: Optional[str] = rest_field( + name="fabricName", visibility=["read", "create", "update", "delete", "query"] + ) + """The fabric friendly name.""" + remote_container_name: Optional[str] = rest_field( + name="remoteContainerName", visibility=["read", "create", "update", "delete", "query"] + ) + """The remote container name.""" + remote_fabric_name: Optional[str] = rest_field( + name="remoteFabricName", visibility=["read", "create", "update", "delete", "query"] + ) + """The remote fabric name.""" + instance_type: Literal["HyperVReplica2012R2"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets the class type. Overridden in derived classes. Required. Default value is + \"HyperVReplica2012R2\".""" + + @overload + def __init__( + self, + *, + container_name: Optional[str] = None, + fabric_name: Optional[str] = None, + remote_container_name: Optional[str] = None, + remote_fabric_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) + self.instance_type = "HyperVReplica2012R2" # type: ignore + + +class HyperVReplicaAzureApplyRecoveryPointInput( + ApplyRecoveryPointProviderSpecificInput, discriminator="HyperVReplicaAzure" +): # pylint: disable=name-too-long + """ApplyRecoveryPoint input specific to HyperVReplicaAzure provider. + + :ivar primary_kek_certificate_pfx: The primary kek certificate pfx. + :vartype primary_kek_certificate_pfx: str + :ivar secondary_kek_certificate_pfx: The secondary kek certificate pfx. + :vartype secondary_kek_certificate_pfx: str + :ivar instance_type: The class type. Required. Default value is "HyperVReplicaAzure". + :vartype instance_type: str + """ + + primary_kek_certificate_pfx: Optional[str] = rest_field( + name="primaryKekCertificatePfx", visibility=["read", "create", "update", "delete", "query"] + ) + """The primary kek certificate pfx.""" + secondary_kek_certificate_pfx: Optional[str] = rest_field( + name="secondaryKekCertificatePfx", visibility=["read", "create", "update", "delete", "query"] + ) + """The secondary kek certificate pfx.""" + instance_type: Literal["HyperVReplicaAzure"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The class type. Required. Default value is \"HyperVReplicaAzure\".""" + + @overload + def __init__( + self, + *, + primary_kek_certificate_pfx: Optional[str] = None, + secondary_kek_certificate_pfx: 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) + self.instance_type = "HyperVReplicaAzure" # type: ignore + + +class HyperVReplicaAzureDiskInputDetails(_Model): + """Disk input details. + + :ivar disk_id: The DiskId. + :vartype disk_id: str + :ivar log_storage_account_id: The LogStorageAccountId. + :vartype log_storage_account_id: str + :ivar disk_type: The disk type. Known values are: "Standard_LRS", "Premium_LRS", + "StandardSSD_LRS", "PremiumV2_LRS", "UltraSSD_LRS", "StandardSSD_ZRS", and "Premium_ZRS". + :vartype disk_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.DiskAccountType + :ivar disk_encryption_set_id: The DiskEncryptionSet ARM ID. + :vartype disk_encryption_set_id: str + :ivar sector_size_in_bytes: The logical sector size (in bytes), 512 by default. + :vartype sector_size_in_bytes: int + :ivar iops: The number of IOPS allowed for Premium V2 and Ultra disks. + :vartype iops: int + :ivar throughput_in_mbps: The total throughput in Mbps for Premium V2 and Ultra disks. + :vartype throughput_in_mbps: int + :ivar disk_size_in_gb: The target disk size in GB. + :vartype disk_size_in_gb: int + """ + + disk_id: Optional[str] = rest_field(name="diskId", visibility=["read", "create", "update", "delete", "query"]) + """The DiskId.""" + log_storage_account_id: Optional[str] = rest_field( + name="logStorageAccountId", visibility=["read", "create", "update", "delete", "query"] + ) + """The LogStorageAccountId.""" + disk_type: Optional[Union[str, "_models.DiskAccountType"]] = rest_field( + name="diskType", visibility=["read", "create", "update", "delete", "query"] + ) + """The disk type. Known values are: \"Standard_LRS\", \"Premium_LRS\", \"StandardSSD_LRS\", + \"PremiumV2_LRS\", \"UltraSSD_LRS\", \"StandardSSD_ZRS\", and \"Premium_ZRS\".""" + disk_encryption_set_id: Optional[str] = rest_field( + name="diskEncryptionSetId", visibility=["read", "create", "update", "delete", "query"] + ) + """The DiskEncryptionSet ARM ID.""" + sector_size_in_bytes: Optional[int] = rest_field( + name="sectorSizeInBytes", visibility=["read", "create", "update", "delete", "query"] + ) + """The logical sector size (in bytes), 512 by default.""" + iops: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The number of IOPS allowed for Premium V2 and Ultra disks.""" + throughput_in_mbps: Optional[int] = rest_field( + name="throughputInMbps", visibility=["read", "create", "update", "delete", "query"] + ) + """The total throughput in Mbps for Premium V2 and Ultra disks.""" + disk_size_in_gb: Optional[int] = rest_field( + name="diskSizeInGB", visibility=["read", "create", "update", "delete", "query"] + ) + """The target disk size in GB.""" + + @overload + def __init__( + self, + *, + disk_id: Optional[str] = None, + log_storage_account_id: Optional[str] = None, + disk_type: Optional[Union[str, "_models.DiskAccountType"]] = None, + disk_encryption_set_id: Optional[str] = None, + sector_size_in_bytes: Optional[int] = None, + iops: Optional[int] = None, + throughput_in_mbps: Optional[int] = None, + disk_size_in_gb: 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 HyperVReplicaAzureEnableProtectionInput( + EnableProtectionProviderSpecificInput, discriminator="HyperVReplicaAzure" +): + """HyperVReplicaAzure specific enable protection input. + + :ivar hv_host_vm_id: The Hyper-V host VM Id. + :vartype hv_host_vm_id: str + :ivar vm_name: The VM Name. + :vartype vm_name: str + :ivar os_type: The OS type associated with VM. + :vartype os_type: str + :ivar user_selected_os_name: The OS name selected by user. + :vartype user_selected_os_name: str + :ivar vhd_id: The OS disk VHD id associated with VM. + :vartype vhd_id: str + :ivar target_storage_account_id: The storage account Id. + :vartype target_storage_account_id: str + :ivar target_azure_network_id: The selected target Azure network Id. + :vartype target_azure_network_id: str + :ivar target_azure_subnet_id: The selected target Azure subnet Id. + :vartype target_azure_subnet_id: str + :ivar enable_rdp_on_target_option: The selected option to enable RDP\\SSH on target vm after + failover. String value of SrsDataContract.EnableRDPOnTargetOption enum. + :vartype enable_rdp_on_target_option: str + :ivar target_azure_vm_name: The target azure VM Name. + :vartype target_azure_vm_name: str + :ivar log_storage_account_id: The storage account to be used for logging during replication. + :vartype log_storage_account_id: str + :ivar disks_to_include: The list of VHD Ids of disks to be protected. + :vartype disks_to_include: list[str] + :ivar target_azure_v1_resource_group_id: The Id of the target resource group (for classic + deployment) in which the failover VM is to be created. + :vartype target_azure_v1_resource_group_id: str + :ivar target_azure_v2_resource_group_id: The Id of the target resource group (for resource + manager deployment) in which the failover VM is to be created. + :vartype target_azure_v2_resource_group_id: str + :ivar use_managed_disks: A value indicating whether managed disks should be used during + failover. + :vartype use_managed_disks: str + :ivar target_availability_set_id: The target availability set ARM Id for resource manager + deployment. + :vartype target_availability_set_id: str + :ivar target_availability_zone: The target availability zone. + :vartype target_availability_zone: str + :ivar license_type: License type. Known values are: "NotSpecified", "NoLicenseType", and + "WindowsServer". + :vartype license_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.LicenseType + :ivar sql_server_license_type: The SQL Server license type. Known values are: "NotSpecified", + "NoLicenseType", "PAYG", and "AHUB". + :vartype sql_server_license_type: str or + ~azure.mgmt.recoveryservicessiterecovery.models.SqlServerLicenseType + :ivar linux_license_type: The license type for Linux VM's. Known values are: "NotSpecified", + "NoLicenseType", and "LinuxServer". + :vartype linux_license_type: str or + ~azure.mgmt.recoveryservicessiterecovery.models.LinuxLicenseType + :ivar target_vm_security_profile: The target VM security profile. + :vartype target_vm_security_profile: + ~azure.mgmt.recoveryservicessiterecovery.models.SecurityProfileProperties + :ivar target_vm_size: The target VM size. + :vartype target_vm_size: str + :ivar target_proximity_placement_group_id: The proximity placement group ARM Id. + :vartype target_proximity_placement_group_id: str + :ivar use_managed_disks_for_replication: A value indicating whether managed disks should be + used during replication. + :vartype use_managed_disks_for_replication: str + :ivar disk_type: The disk type. Known values are: "Standard_LRS", "Premium_LRS", + "StandardSSD_LRS", "PremiumV2_LRS", "UltraSSD_LRS", "StandardSSD_ZRS", and "Premium_ZRS". + :vartype disk_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.DiskAccountType + :ivar disks_to_include_for_managed_disks: The disks to include list for managed disks. + :vartype disks_to_include_for_managed_disks: + list[~azure.mgmt.recoveryservicessiterecovery.models.HyperVReplicaAzureDiskInputDetails] + :ivar disk_encryption_set_id: The DiskEncryptionSet ARM Id. + :vartype disk_encryption_set_id: str + :ivar target_vm_tags: The target VM tags. + :vartype target_vm_tags: dict[str, str] + :ivar seed_managed_disk_tags: The tags for the seed managed disks. + :vartype seed_managed_disk_tags: dict[str, str] + :ivar target_managed_disk_tags: The tags for the target managed disks. + :vartype target_managed_disk_tags: dict[str, str] + :ivar target_nic_tags: The tags for the target NICs. + :vartype target_nic_tags: dict[str, str] + :ivar target_capacity_reservation_group_id: The target capacity reservation group ARM Id. + :vartype target_capacity_reservation_group_id: str + :ivar instance_type: The class type. Required. Default value is "HyperVReplicaAzure". + :vartype instance_type: str + """ + + hv_host_vm_id: Optional[str] = rest_field( + name="hvHostVmId", visibility=["read", "create", "update", "delete", "query"] + ) + """The Hyper-V host VM Id.""" + vm_name: Optional[str] = rest_field(name="vmName", visibility=["read", "create", "update", "delete", "query"]) + """The VM Name.""" + os_type: Optional[str] = rest_field(name="osType", visibility=["read", "create", "update", "delete", "query"]) + """The OS type associated with VM.""" + user_selected_os_name: Optional[str] = rest_field( + name="userSelectedOSName", visibility=["read", "create", "update", "delete", "query"] + ) + """The OS name selected by user.""" + vhd_id: Optional[str] = rest_field(name="vhdId", visibility=["read", "create", "update", "delete", "query"]) + """The OS disk VHD id associated with VM.""" + target_storage_account_id: Optional[str] = rest_field( + name="targetStorageAccountId", visibility=["read", "create", "update", "delete", "query"] + ) + """The storage account Id.""" + target_azure_network_id: Optional[str] = rest_field( + name="targetAzureNetworkId", visibility=["read", "create", "update", "delete", "query"] + ) + """The selected target Azure network Id.""" + target_azure_subnet_id: Optional[str] = rest_field( + name="targetAzureSubnetId", visibility=["read", "create", "update", "delete", "query"] + ) + """The selected target Azure subnet Id.""" + enable_rdp_on_target_option: Optional[str] = rest_field( + name="enableRdpOnTargetOption", visibility=["read", "create", "update", "delete", "query"] + ) + """The selected option to enable RDP\SSH on target vm after failover. String value of + SrsDataContract.EnableRDPOnTargetOption enum.""" + target_azure_vm_name: Optional[str] = rest_field( + name="targetAzureVmName", visibility=["read", "create", "update", "delete", "query"] + ) + """The target azure VM Name.""" + log_storage_account_id: Optional[str] = rest_field( + name="logStorageAccountId", visibility=["read", "create", "update", "delete", "query"] + ) + """The storage account to be used for logging during replication.""" + disks_to_include: Optional[list[str]] = rest_field( + name="disksToInclude", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of VHD Ids of disks to be protected.""" + target_azure_v1_resource_group_id: Optional[str] = rest_field( + name="targetAzureV1ResourceGroupId", visibility=["read", "create", "update", "delete", "query"] + ) + """The Id of the target resource group (for classic deployment) in which the failover VM is to be + created.""" + target_azure_v2_resource_group_id: Optional[str] = rest_field( + name="targetAzureV2ResourceGroupId", visibility=["read", "create", "update", "delete", "query"] + ) + """The Id of the target resource group (for resource manager deployment) in which the failover VM + is to be created.""" + use_managed_disks: Optional[str] = rest_field( + name="useManagedDisks", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether managed disks should be used during failover.""" + target_availability_set_id: Optional[str] = rest_field( + name="targetAvailabilitySetId", visibility=["read", "create", "update", "delete", "query"] + ) + """The target availability set ARM Id for resource manager deployment.""" + target_availability_zone: Optional[str] = rest_field( + name="targetAvailabilityZone", visibility=["read", "create", "update", "delete", "query"] + ) + """The target availability zone.""" + license_type: Optional[Union[str, "_models.LicenseType"]] = rest_field( + name="licenseType", visibility=["read", "create", "update", "delete", "query"] + ) + """License type. Known values are: \"NotSpecified\", \"NoLicenseType\", and \"WindowsServer\".""" + sql_server_license_type: Optional[Union[str, "_models.SqlServerLicenseType"]] = rest_field( + name="sqlServerLicenseType", visibility=["read", "create", "update", "delete", "query"] + ) + """The SQL Server license type. Known values are: \"NotSpecified\", \"NoLicenseType\", \"PAYG\", + and \"AHUB\".""" + linux_license_type: Optional[Union[str, "_models.LinuxLicenseType"]] = rest_field( + name="linuxLicenseType", visibility=["read", "create", "update", "delete", "query"] + ) + """The license type for Linux VM's. Known values are: \"NotSpecified\", \"NoLicenseType\", and + \"LinuxServer\".""" + target_vm_security_profile: Optional["_models.SecurityProfileProperties"] = rest_field( + name="targetVmSecurityProfile", visibility=["read", "create", "update", "delete", "query"] + ) + """The target VM security profile.""" + target_vm_size: Optional[str] = rest_field( + name="targetVmSize", visibility=["read", "create", "update", "delete", "query"] + ) + """The target VM size.""" + target_proximity_placement_group_id: Optional[str] = rest_field( + name="targetProximityPlacementGroupId", visibility=["read", "create", "update", "delete", "query"] + ) + """The proximity placement group ARM Id.""" + use_managed_disks_for_replication: Optional[str] = rest_field( + name="useManagedDisksForReplication", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether managed disks should be used during replication.""" + disk_type: Optional[Union[str, "_models.DiskAccountType"]] = rest_field( + name="diskType", visibility=["read", "create", "update", "delete", "query"] + ) + """The disk type. Known values are: \"Standard_LRS\", \"Premium_LRS\", \"StandardSSD_LRS\", + \"PremiumV2_LRS\", \"UltraSSD_LRS\", \"StandardSSD_ZRS\", and \"Premium_ZRS\".""" + disks_to_include_for_managed_disks: Optional[list["_models.HyperVReplicaAzureDiskInputDetails"]] = rest_field( + name="disksToIncludeForManagedDisks", visibility=["read", "create", "update", "delete", "query"] + ) + """The disks to include list for managed disks.""" + disk_encryption_set_id: Optional[str] = rest_field( + name="diskEncryptionSetId", visibility=["read", "create", "update", "delete", "query"] + ) + """The DiskEncryptionSet ARM Id.""" + target_vm_tags: Optional[dict[str, str]] = rest_field( + name="targetVmTags", visibility=["read", "create", "update", "delete", "query"] + ) + """The target VM tags.""" + seed_managed_disk_tags: Optional[dict[str, str]] = rest_field( + name="seedManagedDiskTags", visibility=["read", "create", "update", "delete", "query"] + ) + """The tags for the seed managed disks.""" + target_managed_disk_tags: Optional[dict[str, str]] = rest_field( + name="targetManagedDiskTags", visibility=["read", "create", "update", "delete", "query"] + ) + """The tags for the target managed disks.""" + target_nic_tags: Optional[dict[str, str]] = rest_field( + name="targetNicTags", visibility=["read", "create", "update", "delete", "query"] + ) + """The tags for the target NICs.""" + target_capacity_reservation_group_id: Optional[str] = rest_field( + name="targetCapacityReservationGroupId", visibility=["read", "create", "update", "delete", "query"] + ) + """The target capacity reservation group ARM Id.""" + instance_type: Literal["HyperVReplicaAzure"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The class type. Required. Default value is \"HyperVReplicaAzure\".""" + + @overload + def __init__( # pylint: disable=too-many-locals + self, + *, + hv_host_vm_id: Optional[str] = None, + vm_name: Optional[str] = None, + os_type: Optional[str] = None, + user_selected_os_name: Optional[str] = None, + vhd_id: Optional[str] = None, + target_storage_account_id: Optional[str] = None, + target_azure_network_id: Optional[str] = None, + target_azure_subnet_id: Optional[str] = None, + enable_rdp_on_target_option: Optional[str] = None, + target_azure_vm_name: Optional[str] = None, + log_storage_account_id: Optional[str] = None, + disks_to_include: Optional[list[str]] = None, + target_azure_v1_resource_group_id: Optional[str] = None, + target_azure_v2_resource_group_id: Optional[str] = None, + use_managed_disks: Optional[str] = None, + target_availability_set_id: Optional[str] = None, + target_availability_zone: Optional[str] = None, + license_type: Optional[Union[str, "_models.LicenseType"]] = None, + sql_server_license_type: Optional[Union[str, "_models.SqlServerLicenseType"]] = None, + linux_license_type: Optional[Union[str, "_models.LinuxLicenseType"]] = None, + target_vm_security_profile: Optional["_models.SecurityProfileProperties"] = None, + target_vm_size: Optional[str] = None, + target_proximity_placement_group_id: Optional[str] = None, + use_managed_disks_for_replication: Optional[str] = None, + disk_type: Optional[Union[str, "_models.DiskAccountType"]] = None, + disks_to_include_for_managed_disks: Optional[list["_models.HyperVReplicaAzureDiskInputDetails"]] = None, + disk_encryption_set_id: Optional[str] = None, + target_vm_tags: Optional[dict[str, str]] = None, + seed_managed_disk_tags: Optional[dict[str, str]] = None, + target_managed_disk_tags: Optional[dict[str, str]] = None, + target_nic_tags: Optional[dict[str, str]] = None, + target_capacity_reservation_group_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) + self.instance_type = "HyperVReplicaAzure" # type: ignore + + +class HyperVReplicaAzureEventDetails(EventProviderSpecificDetails, discriminator="HyperVReplicaAzure"): + """Model class for event details of a HyperVReplica E2A event. + + :ivar container_name: The container friendly name. + :vartype container_name: str + :ivar fabric_name: The fabric friendly name. + :vartype fabric_name: str + :ivar remote_container_name: The remote container name. + :vartype remote_container_name: str + :ivar instance_type: Gets the class type. Overridden in derived classes. Required. Default + value is "HyperVReplicaAzure". + :vartype instance_type: str + """ + + container_name: Optional[str] = rest_field( + name="containerName", visibility=["read", "create", "update", "delete", "query"] + ) + """The container friendly name.""" + fabric_name: Optional[str] = rest_field( + name="fabricName", visibility=["read", "create", "update", "delete", "query"] + ) + """The fabric friendly name.""" + remote_container_name: Optional[str] = rest_field( + name="remoteContainerName", visibility=["read", "create", "update", "delete", "query"] + ) + """The remote container name.""" + instance_type: Literal["HyperVReplicaAzure"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets the class type. Overridden in derived classes. Required. Default value is + \"HyperVReplicaAzure\".""" + + @overload + def __init__( + self, + *, + container_name: Optional[str] = None, + fabric_name: Optional[str] = None, + remote_container_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) + self.instance_type = "HyperVReplicaAzure" # type: ignore + + +class PlannedFailoverProviderSpecificFailoverInput(_Model): # pylint: disable=name-too-long + """Provider specific failover input. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + HyperVReplicaAzurePlannedFailoverProviderInput, HyperVReplicaAzureFailbackProviderInput, + InMageRcmFailbackPlannedFailoverProviderInput + + :ivar instance_type: The class type. Required. Default value is None. + :vartype instance_type: str + """ + + __mapping__: dict[str, _Model] = {} + instance_type: str = rest_discriminator( + name="instanceType", visibility=["read", "create", "update", "delete", "query"] + ) + """The class type. Required. Default value is None.""" + + @overload + def __init__( + self, + *, + instance_type: str, + ) -> 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 HyperVReplicaAzureFailbackProviderInput( + PlannedFailoverProviderSpecificFailoverInput, discriminator="HyperVReplicaAzureFailback" +): + """HyperVReplicaAzureFailback specific planned failover input. + + :ivar data_sync_option: Data sync option. + :vartype data_sync_option: str + :ivar recovery_vm_creation_option: ALR options to create alternate recovery. + :vartype recovery_vm_creation_option: str + :ivar provider_id_for_alternate_recovery: Provider Id for alternate location. + :vartype provider_id_for_alternate_recovery: str + :ivar instance_type: The class type. Required. Default value is "HyperVReplicaAzureFailback". + :vartype instance_type: str + """ + + data_sync_option: Optional[str] = rest_field( + name="dataSyncOption", visibility=["read", "create", "update", "delete", "query"] + ) + """Data sync option.""" + recovery_vm_creation_option: Optional[str] = rest_field( + name="recoveryVmCreationOption", visibility=["read", "create", "update", "delete", "query"] + ) + """ALR options to create alternate recovery.""" + provider_id_for_alternate_recovery: Optional[str] = rest_field( + name="providerIdForAlternateRecovery", visibility=["read", "create", "update", "delete", "query"] + ) + """Provider Id for alternate location.""" + instance_type: Literal["HyperVReplicaAzureFailback"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The class type. Required. Default value is \"HyperVReplicaAzureFailback\".""" + + @overload + def __init__( + self, + *, + data_sync_option: Optional[str] = None, + recovery_vm_creation_option: Optional[str] = None, + provider_id_for_alternate_recovery: 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) + self.instance_type = "HyperVReplicaAzureFailback" # type: ignore + + +class HyperVReplicaAzureManagedDiskDetails(_Model): + """Hyper-V Managed disk details. + + :ivar disk_id: The disk Id. + :vartype disk_id: str + :ivar seed_managed_disk_id: Seed managed disk Id. + :vartype seed_managed_disk_id: str + :ivar replica_disk_type: The replica disk type. + :vartype replica_disk_type: str + :ivar disk_encryption_set_id: The disk encryption set ARM Id. + :vartype disk_encryption_set_id: str + :ivar target_disk_account_type: The disk type. Known values are: "Standard_LRS", "Premium_LRS", + "StandardSSD_LRS", "PremiumV2_LRS", "UltraSSD_LRS", "StandardSSD_ZRS", and "Premium_ZRS". + :vartype target_disk_account_type: str or + ~azure.mgmt.recoveryservicessiterecovery.models.DiskAccountType + :ivar sector_size_in_bytes: The logical sector size (in bytes), 512 by default. + :vartype sector_size_in_bytes: int + :ivar iops: The number of IOPS allowed for Premium V2 and Ultra disks. + :vartype iops: int + :ivar throughput_in_mbps: The total throughput in Mbps for Premium V2 and Ultra disks. + :vartype throughput_in_mbps: int + :ivar disk_size_in_gb: The target disk size in GB. + :vartype disk_size_in_gb: int + """ + + disk_id: Optional[str] = rest_field(name="diskId", visibility=["read", "create", "update", "delete", "query"]) + """The disk Id.""" + seed_managed_disk_id: Optional[str] = rest_field( + name="seedManagedDiskId", visibility=["read", "create", "update", "delete", "query"] + ) + """Seed managed disk Id.""" + replica_disk_type: Optional[str] = rest_field( + name="replicaDiskType", visibility=["read", "create", "update", "delete", "query"] + ) + """The replica disk type.""" + disk_encryption_set_id: Optional[str] = rest_field( + name="diskEncryptionSetId", visibility=["read", "create", "update", "delete", "query"] + ) + """The disk encryption set ARM Id.""" + target_disk_account_type: Optional[Union[str, "_models.DiskAccountType"]] = rest_field( + name="targetDiskAccountType", visibility=["read", "create", "update", "delete", "query"] + ) + """The disk type. Known values are: \"Standard_LRS\", \"Premium_LRS\", \"StandardSSD_LRS\", + \"PremiumV2_LRS\", \"UltraSSD_LRS\", \"StandardSSD_ZRS\", and \"Premium_ZRS\".""" + sector_size_in_bytes: Optional[int] = rest_field( + name="sectorSizeInBytes", visibility=["read", "create", "update", "delete", "query"] + ) + """The logical sector size (in bytes), 512 by default.""" + iops: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The number of IOPS allowed for Premium V2 and Ultra disks.""" + throughput_in_mbps: Optional[int] = rest_field( + name="throughputInMbps", visibility=["read", "create", "update", "delete", "query"] + ) + """The total throughput in Mbps for Premium V2 and Ultra disks.""" + disk_size_in_gb: Optional[int] = rest_field( + name="diskSizeInGB", visibility=["read", "create", "update", "delete", "query"] + ) + """The target disk size in GB.""" + + @overload + def __init__( + self, + *, + disk_id: Optional[str] = None, + seed_managed_disk_id: Optional[str] = None, + replica_disk_type: Optional[str] = None, + disk_encryption_set_id: Optional[str] = None, + target_disk_account_type: Optional[Union[str, "_models.DiskAccountType"]] = None, + sector_size_in_bytes: Optional[int] = None, + iops: Optional[int] = None, + throughput_in_mbps: Optional[int] = None, + disk_size_in_gb: 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 HyperVReplicaAzurePlannedFailoverProviderInput( + PlannedFailoverProviderSpecificFailoverInput, discriminator="HyperVReplicaAzure" +): # pylint: disable=name-too-long + """HyperVReplicaAzure specific planned failover input. + + :ivar primary_kek_certificate_pfx: Primary kek certificate pfx. + :vartype primary_kek_certificate_pfx: str + :ivar secondary_kek_certificate_pfx: Secondary kek certificate pfx. + :vartype secondary_kek_certificate_pfx: str + :ivar recovery_point_id: The recovery point id to be passed to failover to a particular + recovery point. In case of latest recovery point, null should be passed. + :vartype recovery_point_id: str + :ivar os_upgrade_version: A value indicating the inplace OS Upgrade version. + :vartype os_upgrade_version: str + :ivar target_capacity_reservation_group_id: The target capacity reservation group ARM Id. + :vartype target_capacity_reservation_group_id: str + :ivar instance_type: The class type. Required. Default value is "HyperVReplicaAzure". + :vartype instance_type: str + """ + + primary_kek_certificate_pfx: Optional[str] = rest_field( + name="primaryKekCertificatePfx", visibility=["read", "create", "update", "delete", "query"] + ) + """Primary kek certificate pfx.""" + secondary_kek_certificate_pfx: Optional[str] = rest_field( + name="secondaryKekCertificatePfx", visibility=["read", "create", "update", "delete", "query"] + ) + """Secondary kek certificate pfx.""" + recovery_point_id: Optional[str] = rest_field( + name="recoveryPointId", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery point id to be passed to failover to a particular recovery point. In case of + latest recovery point, null should be passed.""" + os_upgrade_version: Optional[str] = rest_field( + name="osUpgradeVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating the inplace OS Upgrade version.""" + target_capacity_reservation_group_id: Optional[str] = rest_field( + name="targetCapacityReservationGroupId", visibility=["read", "create", "update", "delete", "query"] + ) + """The target capacity reservation group ARM Id.""" + instance_type: Literal["HyperVReplicaAzure"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The class type. Required. Default value is \"HyperVReplicaAzure\".""" + + @overload + def __init__( + self, + *, + primary_kek_certificate_pfx: Optional[str] = None, + secondary_kek_certificate_pfx: Optional[str] = None, + recovery_point_id: Optional[str] = None, + os_upgrade_version: Optional[str] = None, + target_capacity_reservation_group_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) + self.instance_type = "HyperVReplicaAzure" # type: ignore + + +class HyperVReplicaAzurePolicyDetails(PolicyProviderSpecificDetails, discriminator="HyperVReplicaAzure"): + """Hyper-V Replica Azure specific protection profile details. + + :ivar recovery_point_history_duration_in_hours: The duration (in hours) to which point the + recovery history needs to be maintained. + :vartype recovery_point_history_duration_in_hours: int + :ivar application_consistent_snapshot_frequency_in_hours: The interval (in hours) at which + Hyper-V Replica should create an application consistent snapshot within the VM. + :vartype application_consistent_snapshot_frequency_in_hours: int + :ivar replication_interval: The replication interval. + :vartype replication_interval: int + :ivar online_replication_start_time: The scheduled start time for the initial replication. If + this parameter is Null, the initial replication starts immediately. + :vartype online_replication_start_time: str + :ivar encryption: A value indicating whether encryption is enabled for virtual machines in this + cloud. + :vartype encryption: str + :ivar active_storage_account_id: The active storage account Id. + :vartype active_storage_account_id: str + :ivar instance_type: Gets the class type. Overridden in derived classes. Required. Default + value is "HyperVReplicaAzure". + :vartype instance_type: str + """ + + recovery_point_history_duration_in_hours: Optional[int] = rest_field( + name="recoveryPointHistoryDurationInHours", visibility=["read", "create", "update", "delete", "query"] + ) + """The duration (in hours) to which point the recovery history needs to be maintained.""" + application_consistent_snapshot_frequency_in_hours: Optional[int] = rest_field( + name="applicationConsistentSnapshotFrequencyInHours", visibility=["read", "create", "update", "delete", "query"] + ) + """The interval (in hours) at which Hyper-V Replica should create an application consistent + snapshot within the VM.""" + replication_interval: Optional[int] = rest_field( + name="replicationInterval", visibility=["read", "create", "update", "delete", "query"] + ) + """The replication interval.""" + online_replication_start_time: Optional[str] = rest_field( + name="onlineReplicationStartTime", visibility=["read", "create", "update", "delete", "query"] + ) + """The scheduled start time for the initial replication. If this parameter is Null, the initial + replication starts immediately.""" + encryption: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """A value indicating whether encryption is enabled for virtual machines in this cloud.""" + active_storage_account_id: Optional[str] = rest_field( + name="activeStorageAccountId", visibility=["read", "create", "update", "delete", "query"] + ) + """The active storage account Id.""" + instance_type: Literal["HyperVReplicaAzure"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets the class type. Overridden in derived classes. Required. Default value is + \"HyperVReplicaAzure\".""" + + @overload + def __init__( + self, + *, + recovery_point_history_duration_in_hours: Optional[int] = None, + application_consistent_snapshot_frequency_in_hours: Optional[int] = None, + replication_interval: Optional[int] = None, + online_replication_start_time: Optional[str] = None, + encryption: Optional[str] = None, + active_storage_account_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) + self.instance_type = "HyperVReplicaAzure" # type: ignore + + +class HyperVReplicaAzurePolicyInput(PolicyProviderSpecificInput, discriminator="HyperVReplicaAzure"): + """Hyper-V Replica Azure specific input for creating a protection profile. + + :ivar recovery_point_history_duration: The duration (in hours) to which point the recovery + history needs to be maintained. + :vartype recovery_point_history_duration: int + :ivar application_consistent_snapshot_frequency_in_hours: The interval (in hours) at which + Hyper-V Replica should create an application consistent snapshot within the VM. + :vartype application_consistent_snapshot_frequency_in_hours: int + :ivar replication_interval: The replication interval. + :vartype replication_interval: int + :ivar online_replication_start_time: The scheduled start time for the initial replication. If + this parameter is Null, the initial replication starts immediately. + :vartype online_replication_start_time: str + :ivar storage_accounts: The list of storage accounts to which the VMs in the primary cloud can + replicate to. + :vartype storage_accounts: list[str] + :ivar instance_type: The class type. Required. Default value is "HyperVReplicaAzure". + :vartype instance_type: str + """ + + recovery_point_history_duration: Optional[int] = rest_field( + name="recoveryPointHistoryDuration", visibility=["read", "create", "update", "delete", "query"] + ) + """The duration (in hours) to which point the recovery history needs to be maintained.""" + application_consistent_snapshot_frequency_in_hours: Optional[int] = rest_field( + name="applicationConsistentSnapshotFrequencyInHours", visibility=["read", "create", "update", "delete", "query"] + ) + """The interval (in hours) at which Hyper-V Replica should create an application consistent + snapshot within the VM.""" + replication_interval: Optional[int] = rest_field( + name="replicationInterval", visibility=["read", "create", "update", "delete", "query"] + ) + """The replication interval.""" + online_replication_start_time: Optional[str] = rest_field( + name="onlineReplicationStartTime", visibility=["read", "create", "update", "delete", "query"] + ) + """The scheduled start time for the initial replication. If this parameter is Null, the initial + replication starts immediately.""" + storage_accounts: Optional[list[str]] = rest_field( + name="storageAccounts", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of storage accounts to which the VMs in the primary cloud can replicate to.""" + instance_type: Literal["HyperVReplicaAzure"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The class type. Required. Default value is \"HyperVReplicaAzure\".""" + + @overload + def __init__( + self, + *, + recovery_point_history_duration: Optional[int] = None, + application_consistent_snapshot_frequency_in_hours: Optional[int] = None, + replication_interval: Optional[int] = None, + online_replication_start_time: Optional[str] = None, + storage_accounts: 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) + self.instance_type = "HyperVReplicaAzure" # type: ignore + + +class HyperVReplicaAzureReplicationDetails(ReplicationProviderSpecificSettings, discriminator="HyperVReplicaAzure"): + """Hyper V Replica Azure provider specific settings. + + :ivar azure_vm_disk_details: Azure VM Disk details. + :vartype azure_vm_disk_details: + list[~azure.mgmt.recoveryservicessiterecovery.models.AzureVmDiskDetails] + :ivar recovery_azure_vm_name: Recovery Azure given name. + :vartype recovery_azure_vm_name: str + :ivar recovery_azure_vm_size: The Recovery Azure VM size. + :vartype recovery_azure_vm_size: str + :ivar recovery_azure_storage_account: The recovery Azure storage account. + :vartype recovery_azure_storage_account: str + :ivar recovery_azure_log_storage_account_id: The ARM id of the log storage account used for + replication. This will be set to null if no log storage account was provided during enable + protection. + :vartype recovery_azure_log_storage_account_id: str + :ivar last_replicated_time: The Last replication time. + :vartype last_replicated_time: ~datetime.datetime + :ivar rpo_in_seconds: Last RPO value. + :vartype rpo_in_seconds: int + :ivar last_rpo_calculated_time: The last RPO calculated time. + :vartype last_rpo_calculated_time: ~datetime.datetime + :ivar vm_id: The virtual machine Id. + :vartype vm_id: str + :ivar vm_protection_state: The protection state for the vm. + :vartype vm_protection_state: str + :ivar vm_protection_state_description: The protection state description for the vm. + :vartype vm_protection_state_description: str + :ivar initial_replication_details: Initial replication details. + :vartype initial_replication_details: + ~azure.mgmt.recoveryservicessiterecovery.models.InitialReplicationDetails + :ivar vm_nics: The PE Network details. + :vartype vm_nics: list[~azure.mgmt.recoveryservicessiterecovery.models.VMNicDetails] + :ivar selected_recovery_azure_network_id: The selected recovery azure network Id. + :vartype selected_recovery_azure_network_id: str + :ivar selected_source_nic_id: The selected source nic Id which will be used as the primary nic + during failover. + :vartype selected_source_nic_id: str + :ivar encryption: The encryption info. + :vartype encryption: str + :ivar o_s_details: The operating system info. + :vartype o_s_details: ~azure.mgmt.recoveryservicessiterecovery.models.OSDetails + :ivar source_vm_ram_size_in_mb: The RAM size of the VM on the primary side. + :vartype source_vm_ram_size_in_mb: int + :ivar source_vm_cpu_count: The CPU count of the VM on the primary side. + :vartype source_vm_cpu_count: int + :ivar enable_rdp_on_target_option: The selected option to enable RDP\\SSH on target vm after + failover. String value of SrsDataContract.EnableRDPOnTargetOption enum. + :vartype enable_rdp_on_target_option: str + :ivar recovery_azure_resource_group_id: The target resource group Id. + :vartype recovery_azure_resource_group_id: str + :ivar recovery_availability_set_id: The recovery availability set Id. + :vartype recovery_availability_set_id: str + :ivar target_availability_zone: The target availability zone. + :vartype target_availability_zone: str + :ivar target_proximity_placement_group_id: The target proximity placement group Id. + :vartype target_proximity_placement_group_id: str + :ivar use_managed_disks: A value indicating whether managed disks should be used during + failover. + :vartype use_managed_disks: str + :ivar license_type: License Type of the VM to be used. + :vartype license_type: str + :ivar sql_server_license_type: The SQL Server license type. + :vartype sql_server_license_type: str + :ivar linux_license_type: The license type for Linux VM's. Known values are: "NotSpecified", + "NoLicenseType", and "LinuxServer". + :vartype linux_license_type: str or + ~azure.mgmt.recoveryservicessiterecovery.models.LinuxLicenseType + :ivar last_recovery_point_received: The last recovery point received time. + :vartype last_recovery_point_received: ~datetime.datetime + :ivar target_vm_tags: The target VM tags. + :vartype target_vm_tags: dict[str, str] + :ivar seed_managed_disk_tags: The tags for the seed managed disks. + :vartype seed_managed_disk_tags: dict[str, str] + :ivar target_managed_disk_tags: The tags for the target managed disks. + :vartype target_managed_disk_tags: dict[str, str] + :ivar target_nic_tags: The tags for the target NICs. + :vartype target_nic_tags: dict[str, str] + :ivar protected_managed_disks: The list of protected managed disks. + :vartype protected_managed_disks: + list[~azure.mgmt.recoveryservicessiterecovery.models.HyperVReplicaAzureManagedDiskDetails] + :ivar all_available_os_upgrade_configurations: A value indicating all available inplace OS + Upgrade configurations. + :vartype all_available_os_upgrade_configurations: + list[~azure.mgmt.recoveryservicessiterecovery.models.OSUpgradeSupportedVersions] + :ivar target_vm_security_profile: The target VM security profile. + :vartype target_vm_security_profile: + ~azure.mgmt.recoveryservicessiterecovery.models.SecurityProfileProperties + :ivar target_capacity_reservation_group_id: The target capacity reservation group ARM Id. + :vartype target_capacity_reservation_group_id: str + :ivar instance_type: Gets the Instance type. Required. Default value is "HyperVReplicaAzure". + :vartype instance_type: str + """ + + azure_vm_disk_details: Optional[list["_models.AzureVmDiskDetails"]] = rest_field( + name="azureVmDiskDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """Azure VM Disk details.""" + recovery_azure_vm_name: Optional[str] = rest_field( + name="recoveryAzureVmName", visibility=["read", "create", "update", "delete", "query"] + ) + """Recovery Azure given name.""" + recovery_azure_vm_size: Optional[str] = rest_field( + name="recoveryAzureVMSize", visibility=["read", "create", "update", "delete", "query"] + ) + """The Recovery Azure VM size.""" + recovery_azure_storage_account: Optional[str] = rest_field( + name="recoveryAzureStorageAccount", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery Azure storage account.""" + recovery_azure_log_storage_account_id: Optional[str] = rest_field( + name="recoveryAzureLogStorageAccountId", visibility=["read", "create", "update", "delete", "query"] + ) + """The ARM id of the log storage account used for replication. This will be set to null if no log + storage account was provided during enable protection.""" + last_replicated_time: Optional[datetime.datetime] = rest_field( + name="lastReplicatedTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The Last replication time.""" + rpo_in_seconds: Optional[int] = rest_field( + name="rpoInSeconds", visibility=["read", "create", "update", "delete", "query"] + ) + """Last RPO value.""" + last_rpo_calculated_time: Optional[datetime.datetime] = rest_field( + name="lastRpoCalculatedTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The last RPO calculated time.""" + vm_id: Optional[str] = rest_field(name="vmId", visibility=["read", "create", "update", "delete", "query"]) + """The virtual machine Id.""" + vm_protection_state: Optional[str] = rest_field( + name="vmProtectionState", visibility=["read", "create", "update", "delete", "query"] + ) + """The protection state for the vm.""" + vm_protection_state_description: Optional[str] = rest_field( + name="vmProtectionStateDescription", visibility=["read", "create", "update", "delete", "query"] + ) + """The protection state description for the vm.""" + initial_replication_details: Optional["_models.InitialReplicationDetails"] = rest_field( + name="initialReplicationDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """Initial replication details.""" + vm_nics: Optional[list["_models.VMNicDetails"]] = rest_field( + name="vmNics", visibility=["read", "create", "update", "delete", "query"] + ) + """The PE Network details.""" + selected_recovery_azure_network_id: Optional[str] = rest_field( + name="selectedRecoveryAzureNetworkId", visibility=["read", "create", "update", "delete", "query"] + ) + """The selected recovery azure network Id.""" + selected_source_nic_id: Optional[str] = rest_field( + name="selectedSourceNicId", visibility=["read", "create", "update", "delete", "query"] + ) + """The selected source nic Id which will be used as the primary nic during failover.""" + encryption: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The encryption info.""" + o_s_details: Optional["_models.OSDetails"] = rest_field( + name="oSDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """The operating system info.""" + source_vm_ram_size_in_mb: Optional[int] = rest_field( + name="sourceVmRamSizeInMB", visibility=["read", "create", "update", "delete", "query"] + ) + """The RAM size of the VM on the primary side.""" + source_vm_cpu_count: Optional[int] = rest_field( + name="sourceVmCpuCount", visibility=["read", "create", "update", "delete", "query"] + ) + """The CPU count of the VM on the primary side.""" + enable_rdp_on_target_option: Optional[str] = rest_field( + name="enableRdpOnTargetOption", visibility=["read", "create", "update", "delete", "query"] + ) + """The selected option to enable RDP\SSH on target vm after failover. String value of + SrsDataContract.EnableRDPOnTargetOption enum.""" + recovery_azure_resource_group_id: Optional[str] = rest_field( + name="recoveryAzureResourceGroupId", visibility=["read", "create", "update", "delete", "query"] + ) + """The target resource group Id.""" + recovery_availability_set_id: Optional[str] = rest_field( + name="recoveryAvailabilitySetId", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery availability set Id.""" + target_availability_zone: Optional[str] = rest_field( + name="targetAvailabilityZone", visibility=["read", "create", "update", "delete", "query"] + ) + """The target availability zone.""" + target_proximity_placement_group_id: Optional[str] = rest_field( + name="targetProximityPlacementGroupId", visibility=["read", "create", "update", "delete", "query"] + ) + """The target proximity placement group Id.""" + use_managed_disks: Optional[str] = rest_field( + name="useManagedDisks", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether managed disks should be used during failover.""" + license_type: Optional[str] = rest_field( + name="licenseType", visibility=["read", "create", "update", "delete", "query"] + ) + """License Type of the VM to be used.""" + sql_server_license_type: Optional[str] = rest_field( + name="sqlServerLicenseType", visibility=["read", "create", "update", "delete", "query"] + ) + """The SQL Server license type.""" + linux_license_type: Optional[Union[str, "_models.LinuxLicenseType"]] = rest_field( + name="linuxLicenseType", visibility=["read", "create", "update", "delete", "query"] + ) + """The license type for Linux VM's. Known values are: \"NotSpecified\", \"NoLicenseType\", and + \"LinuxServer\".""" + last_recovery_point_received: Optional[datetime.datetime] = rest_field( + name="lastRecoveryPointReceived", visibility=["read"], format="rfc3339" + ) + """The last recovery point received time.""" + target_vm_tags: Optional[dict[str, str]] = rest_field( + name="targetVmTags", visibility=["read", "create", "update", "delete", "query"] + ) + """The target VM tags.""" + seed_managed_disk_tags: Optional[dict[str, str]] = rest_field( + name="seedManagedDiskTags", visibility=["read", "create", "update", "delete", "query"] + ) + """The tags for the seed managed disks.""" + target_managed_disk_tags: Optional[dict[str, str]] = rest_field( + name="targetManagedDiskTags", visibility=["read", "create", "update", "delete", "query"] + ) + """The tags for the target managed disks.""" + target_nic_tags: Optional[dict[str, str]] = rest_field( + name="targetNicTags", visibility=["read", "create", "update", "delete", "query"] + ) + """The tags for the target NICs.""" + protected_managed_disks: Optional[list["_models.HyperVReplicaAzureManagedDiskDetails"]] = rest_field( + name="protectedManagedDisks", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of protected managed disks.""" + all_available_os_upgrade_configurations: Optional[list["_models.OSUpgradeSupportedVersions"]] = rest_field( + name="allAvailableOSUpgradeConfigurations", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating all available inplace OS Upgrade configurations.""" + target_vm_security_profile: Optional["_models.SecurityProfileProperties"] = rest_field( + name="targetVmSecurityProfile", visibility=["read", "create", "update", "delete", "query"] + ) + """The target VM security profile.""" + target_capacity_reservation_group_id: Optional[str] = rest_field( + name="targetCapacityReservationGroupId", visibility=["read", "create", "update", "delete", "query"] + ) + """The target capacity reservation group ARM Id.""" + instance_type: Literal["HyperVReplicaAzure"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets the Instance type. Required. Default value is \"HyperVReplicaAzure\".""" + + @overload + def __init__( # pylint: disable=too-many-locals + self, + *, + azure_vm_disk_details: Optional[list["_models.AzureVmDiskDetails"]] = None, + recovery_azure_vm_name: Optional[str] = None, + recovery_azure_vm_size: Optional[str] = None, + recovery_azure_storage_account: Optional[str] = None, + recovery_azure_log_storage_account_id: Optional[str] = None, + last_replicated_time: Optional[datetime.datetime] = None, + rpo_in_seconds: Optional[int] = None, + last_rpo_calculated_time: Optional[datetime.datetime] = None, + vm_id: Optional[str] = None, + vm_protection_state: Optional[str] = None, + vm_protection_state_description: Optional[str] = None, + initial_replication_details: Optional["_models.InitialReplicationDetails"] = None, + vm_nics: Optional[list["_models.VMNicDetails"]] = None, + selected_recovery_azure_network_id: Optional[str] = None, + selected_source_nic_id: Optional[str] = None, + encryption: Optional[str] = None, + o_s_details: Optional["_models.OSDetails"] = None, + source_vm_ram_size_in_mb: Optional[int] = None, + source_vm_cpu_count: Optional[int] = None, + enable_rdp_on_target_option: Optional[str] = None, + recovery_azure_resource_group_id: Optional[str] = None, + recovery_availability_set_id: Optional[str] = None, + target_availability_zone: Optional[str] = None, + target_proximity_placement_group_id: Optional[str] = None, + use_managed_disks: Optional[str] = None, + license_type: Optional[str] = None, + sql_server_license_type: Optional[str] = None, + linux_license_type: Optional[Union[str, "_models.LinuxLicenseType"]] = None, + target_vm_tags: Optional[dict[str, str]] = None, + seed_managed_disk_tags: Optional[dict[str, str]] = None, + target_managed_disk_tags: Optional[dict[str, str]] = None, + target_nic_tags: Optional[dict[str, str]] = None, + protected_managed_disks: Optional[list["_models.HyperVReplicaAzureManagedDiskDetails"]] = None, + all_available_os_upgrade_configurations: Optional[list["_models.OSUpgradeSupportedVersions"]] = None, + target_vm_security_profile: Optional["_models.SecurityProfileProperties"] = None, + target_capacity_reservation_group_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) + self.instance_type = "HyperVReplicaAzure" # type: ignore + + +class HyperVReplicaAzureReprotectInput(ReverseReplicationProviderSpecificInput, discriminator="HyperVReplicaAzure"): + """Azure specific reprotect input. + + :ivar hv_host_vm_id: The Hyper-V host Vm Id. + :vartype hv_host_vm_id: str + :ivar vm_name: The Vm Name. + :vartype vm_name: str + :ivar os_type: The OS type associated with vm. + :vartype os_type: str + :ivar v_hd_id: The OS disk VHD id associated with vm. + :vartype v_hd_id: str + :ivar storage_account_id: The storage account name. + :vartype storage_account_id: str + :ivar log_storage_account_id: The storage account to be used for logging during replication. + :vartype log_storage_account_id: str + :ivar instance_type: The class type. Required. Default value is "HyperVReplicaAzure". + :vartype instance_type: str + """ + + hv_host_vm_id: Optional[str] = rest_field( + name="hvHostVmId", visibility=["read", "create", "update", "delete", "query"] + ) + """The Hyper-V host Vm Id.""" + vm_name: Optional[str] = rest_field(name="vmName", visibility=["read", "create", "update", "delete", "query"]) + """The Vm Name.""" + os_type: Optional[str] = rest_field(name="osType", visibility=["read", "create", "update", "delete", "query"]) + """The OS type associated with vm.""" + v_hd_id: Optional[str] = rest_field(name="vHDId", visibility=["read", "create", "update", "delete", "query"]) + """The OS disk VHD id associated with vm.""" + storage_account_id: Optional[str] = rest_field( + name="storageAccountId", visibility=["read", "create", "update", "delete", "query"] + ) + """The storage account name.""" + log_storage_account_id: Optional[str] = rest_field( + name="logStorageAccountId", visibility=["read", "create", "update", "delete", "query"] + ) + """The storage account to be used for logging during replication.""" + instance_type: Literal["HyperVReplicaAzure"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The class type. Required. Default value is \"HyperVReplicaAzure\".""" + + @overload + def __init__( + self, + *, + hv_host_vm_id: Optional[str] = None, + vm_name: Optional[str] = None, + os_type: Optional[str] = None, + v_hd_id: Optional[str] = None, + storage_account_id: Optional[str] = None, + log_storage_account_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) + self.instance_type = "HyperVReplicaAzure" # type: ignore + + +class HyperVReplicaAzureTestFailoverInput(TestFailoverProviderSpecificInput, discriminator="HyperVReplicaAzure"): + """HvrA provider specific input for test failover. + + :ivar primary_kek_certificate_pfx: Primary kek certificate pfx. + :vartype primary_kek_certificate_pfx: str + :ivar secondary_kek_certificate_pfx: Secondary kek certificate pfx. + :vartype secondary_kek_certificate_pfx: str + :ivar recovery_point_id: The recovery point id to be passed to test failover to a particular + recovery point. In case of latest recovery point, null should be passed. + :vartype recovery_point_id: str + :ivar os_upgrade_version: A value indicating the inplace OS Upgrade version. + :vartype os_upgrade_version: str + :ivar instance_type: The class type. Required. Default value is "HyperVReplicaAzure". + :vartype instance_type: str + """ + + primary_kek_certificate_pfx: Optional[str] = rest_field( + name="primaryKekCertificatePfx", visibility=["read", "create", "update", "delete", "query"] + ) + """Primary kek certificate pfx.""" + secondary_kek_certificate_pfx: Optional[str] = rest_field( + name="secondaryKekCertificatePfx", visibility=["read", "create", "update", "delete", "query"] + ) + """Secondary kek certificate pfx.""" + recovery_point_id: Optional[str] = rest_field( + name="recoveryPointId", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery point id to be passed to test failover to a particular recovery point. In case of + latest recovery point, null should be passed.""" + os_upgrade_version: Optional[str] = rest_field( + name="osUpgradeVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating the inplace OS Upgrade version.""" + instance_type: Literal["HyperVReplicaAzure"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The class type. Required. Default value is \"HyperVReplicaAzure\".""" + + @overload + def __init__( + self, + *, + primary_kek_certificate_pfx: Optional[str] = None, + secondary_kek_certificate_pfx: Optional[str] = None, + recovery_point_id: Optional[str] = None, + os_upgrade_version: 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) + self.instance_type = "HyperVReplicaAzure" # type: ignore + + +class HyperVReplicaAzureUnplannedFailoverInput( + UnplannedFailoverProviderSpecificInput, discriminator="HyperVReplicaAzure" +): + """HvrA provider specific input for unplanned failover. + + :ivar primary_kek_certificate_pfx: Primary kek certificate pfx. + :vartype primary_kek_certificate_pfx: str + :ivar secondary_kek_certificate_pfx: Secondary kek certificate pfx. + :vartype secondary_kek_certificate_pfx: str + :ivar recovery_point_id: The recovery point id to be passed to failover to a particular + recovery point. In case of latest recovery point, null should be passed. + :vartype recovery_point_id: str + :ivar instance_type: The class type. Required. Default value is "HyperVReplicaAzure". + :vartype instance_type: str + """ + + primary_kek_certificate_pfx: Optional[str] = rest_field( + name="primaryKekCertificatePfx", visibility=["read", "create", "update", "delete", "query"] + ) + """Primary kek certificate pfx.""" + secondary_kek_certificate_pfx: Optional[str] = rest_field( + name="secondaryKekCertificatePfx", visibility=["read", "create", "update", "delete", "query"] + ) + """Secondary kek certificate pfx.""" + recovery_point_id: Optional[str] = rest_field( + name="recoveryPointId", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery point id to be passed to failover to a particular recovery point. In case of + latest recovery point, null should be passed.""" + instance_type: Literal["HyperVReplicaAzure"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The class type. Required. Default value is \"HyperVReplicaAzure\".""" + + @overload + def __init__( + self, + *, + primary_kek_certificate_pfx: Optional[str] = None, + secondary_kek_certificate_pfx: Optional[str] = None, + recovery_point_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) + self.instance_type = "HyperVReplicaAzure" # type: ignore + + +class HyperVReplicaAzureUpdateReplicationProtectedItemInput( + UpdateReplicationProtectedItemProviderInput, discriminator="HyperVReplicaAzure" +): # pylint: disable=name-too-long + """HyperV replica Azure input to update replication protected item. + + :ivar recovery_azure_v1_resource_group_id: The recovery Azure resource group Id for classic + deployment. + :vartype recovery_azure_v1_resource_group_id: str + :ivar recovery_azure_v2_resource_group_id: The recovery Azure resource group Id for resource + manager deployment. + :vartype recovery_azure_v2_resource_group_id: str + :ivar use_managed_disks: A value indicating whether managed disks should be used during + failover. + :vartype use_managed_disks: str + :ivar disk_id_to_disk_encryption_map: The dictionary of disk resource Id to disk encryption set + ARM Id. + :vartype disk_id_to_disk_encryption_map: dict[str, str] + :ivar target_proximity_placement_group_id: The target proximity placement group Id. + :vartype target_proximity_placement_group_id: str + :ivar target_availability_zone: The target availability zone. + :vartype target_availability_zone: str + :ivar target_vm_tags: The target VM tags. + :vartype target_vm_tags: dict[str, str] + :ivar target_managed_disk_tags: The tags for the target managed disks. + :vartype target_managed_disk_tags: dict[str, str] + :ivar target_nic_tags: The tags for the target NICs. + :vartype target_nic_tags: dict[str, str] + :ivar sql_server_license_type: The SQL Server license type. Known values are: "NotSpecified", + "NoLicenseType", "PAYG", and "AHUB". + :vartype sql_server_license_type: str or + ~azure.mgmt.recoveryservicessiterecovery.models.SqlServerLicenseType + :ivar linux_license_type: The license type for Linux VM's. Known values are: "NotSpecified", + "NoLicenseType", and "LinuxServer". + :vartype linux_license_type: str or + ~azure.mgmt.recoveryservicessiterecovery.models.LinuxLicenseType + :ivar user_selected_os_name: The OS name selected by user. + :vartype user_selected_os_name: str + :ivar vm_disks: The list of disk update properties. + :vartype vm_disks: list[~azure.mgmt.recoveryservicessiterecovery.models.UpdateDiskInput] + :ivar target_capacity_reservation_group_id: The target capacity reservation group ARM Id. + :vartype target_capacity_reservation_group_id: str + :ivar instance_type: The class type. Required. Default value is "HyperVReplicaAzure". + :vartype instance_type: str + """ + + recovery_azure_v1_resource_group_id: Optional[str] = rest_field( + name="recoveryAzureV1ResourceGroupId", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery Azure resource group Id for classic deployment.""" + recovery_azure_v2_resource_group_id: Optional[str] = rest_field( + name="recoveryAzureV2ResourceGroupId", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery Azure resource group Id for resource manager deployment.""" + use_managed_disks: Optional[str] = rest_field( + name="useManagedDisks", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether managed disks should be used during failover.""" + disk_id_to_disk_encryption_map: Optional[dict[str, str]] = rest_field( + name="diskIdToDiskEncryptionMap", visibility=["read", "create", "update", "delete", "query"] + ) + """The dictionary of disk resource Id to disk encryption set ARM Id.""" + target_proximity_placement_group_id: Optional[str] = rest_field( + name="targetProximityPlacementGroupId", visibility=["read", "create", "update", "delete", "query"] + ) + """The target proximity placement group Id.""" + target_availability_zone: Optional[str] = rest_field( + name="targetAvailabilityZone", visibility=["read", "create", "update", "delete", "query"] + ) + """The target availability zone.""" + target_vm_tags: Optional[dict[str, str]] = rest_field( + name="targetVmTags", visibility=["read", "create", "update", "delete", "query"] + ) + """The target VM tags.""" + target_managed_disk_tags: Optional[dict[str, str]] = rest_field( + name="targetManagedDiskTags", visibility=["read", "create", "update", "delete", "query"] + ) + """The tags for the target managed disks.""" + target_nic_tags: Optional[dict[str, str]] = rest_field( + name="targetNicTags", visibility=["read", "create", "update", "delete", "query"] + ) + """The tags for the target NICs.""" + sql_server_license_type: Optional[Union[str, "_models.SqlServerLicenseType"]] = rest_field( + name="sqlServerLicenseType", visibility=["read", "create", "update", "delete", "query"] + ) + """The SQL Server license type. Known values are: \"NotSpecified\", \"NoLicenseType\", \"PAYG\", + and \"AHUB\".""" + linux_license_type: Optional[Union[str, "_models.LinuxLicenseType"]] = rest_field( + name="linuxLicenseType", visibility=["read", "create", "update", "delete", "query"] + ) + """The license type for Linux VM's. Known values are: \"NotSpecified\", \"NoLicenseType\", and + \"LinuxServer\".""" + user_selected_os_name: Optional[str] = rest_field( + name="userSelectedOSName", visibility=["read", "create", "update", "delete", "query"] + ) + """The OS name selected by user.""" + vm_disks: Optional[list["_models.UpdateDiskInput"]] = rest_field( + name="vmDisks", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of disk update properties.""" + target_capacity_reservation_group_id: Optional[str] = rest_field( + name="targetCapacityReservationGroupId", visibility=["read", "create", "update", "delete", "query"] + ) + """The target capacity reservation group ARM Id.""" + instance_type: Literal["HyperVReplicaAzure"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The class type. Required. Default value is \"HyperVReplicaAzure\".""" + + @overload + def __init__( + self, + *, + recovery_azure_v1_resource_group_id: Optional[str] = None, + recovery_azure_v2_resource_group_id: Optional[str] = None, + use_managed_disks: Optional[str] = None, + disk_id_to_disk_encryption_map: Optional[dict[str, str]] = None, + target_proximity_placement_group_id: Optional[str] = None, + target_availability_zone: Optional[str] = None, + target_vm_tags: Optional[dict[str, str]] = None, + target_managed_disk_tags: Optional[dict[str, str]] = None, + target_nic_tags: Optional[dict[str, str]] = None, + sql_server_license_type: Optional[Union[str, "_models.SqlServerLicenseType"]] = None, + linux_license_type: Optional[Union[str, "_models.LinuxLicenseType"]] = None, + user_selected_os_name: Optional[str] = None, + vm_disks: Optional[list["_models.UpdateDiskInput"]] = None, + target_capacity_reservation_group_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) + self.instance_type = "HyperVReplicaAzure" # type: ignore + + +class HyperVReplicaBaseEventDetails(EventProviderSpecificDetails, discriminator="HyperVReplicaBaseEventDetails"): + """Abstract model class for event details of a HyperVReplica E2E event. + + :ivar container_name: The container friendly name. + :vartype container_name: str + :ivar fabric_name: The fabric friendly name. + :vartype fabric_name: str + :ivar remote_container_name: The remote container name. + :vartype remote_container_name: str + :ivar remote_fabric_name: The remote fabric name. + :vartype remote_fabric_name: str + :ivar instance_type: Gets the class type. Overridden in derived classes. Required. Default + value is "HyperVReplicaBaseEventDetails". + :vartype instance_type: str + """ + + container_name: Optional[str] = rest_field( + name="containerName", visibility=["read", "create", "update", "delete", "query"] + ) + """The container friendly name.""" + fabric_name: Optional[str] = rest_field( + name="fabricName", visibility=["read", "create", "update", "delete", "query"] + ) + """The fabric friendly name.""" + remote_container_name: Optional[str] = rest_field( + name="remoteContainerName", visibility=["read", "create", "update", "delete", "query"] + ) + """The remote container name.""" + remote_fabric_name: Optional[str] = rest_field( + name="remoteFabricName", visibility=["read", "create", "update", "delete", "query"] + ) + """The remote fabric name.""" + instance_type: Literal["HyperVReplicaBaseEventDetails"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets the class type. Overridden in derived classes. Required. Default value is + \"HyperVReplicaBaseEventDetails\".""" + + @overload + def __init__( + self, + *, + container_name: Optional[str] = None, + fabric_name: Optional[str] = None, + remote_container_name: Optional[str] = None, + remote_fabric_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) + self.instance_type = "HyperVReplicaBaseEventDetails" # type: ignore + + +class HyperVReplicaBasePolicyDetails(PolicyProviderSpecificDetails, discriminator="HyperVReplicaBasePolicyDetails"): + """Base class for HyperVReplica policy details. + + :ivar recovery_points: A value indicating the number of recovery points. + :vartype recovery_points: int + :ivar application_consistent_snapshot_frequency_in_hours: A value indicating the application + consistent frequency. + :vartype application_consistent_snapshot_frequency_in_hours: int + :ivar compression: A value indicating whether compression has to be enabled. + :vartype compression: str + :ivar initial_replication_method: A value indicating whether IR is online. + :vartype initial_replication_method: str + :ivar online_replication_start_time: A value indicating the online IR start time. + :vartype online_replication_start_time: str + :ivar offline_replication_import_path: A value indicating the offline IR import path. + :vartype offline_replication_import_path: str + :ivar offline_replication_export_path: A value indicating the offline IR export path. + :vartype offline_replication_export_path: str + :ivar replication_port: A value indicating the recovery HTTPS port. + :vartype replication_port: int + :ivar allowed_authentication_type: A value indicating the authentication type. + :vartype allowed_authentication_type: int + :ivar replica_deletion_option: A value indicating whether the VM has to be auto deleted. + Supported Values: String.Empty, None, OnRecoveryCloud. + :vartype replica_deletion_option: str + :ivar instance_type: Gets the class type. Overridden in derived classes. Required. Default + value is "HyperVReplicaBasePolicyDetails". + :vartype instance_type: str + """ + + recovery_points: Optional[int] = rest_field( + name="recoveryPoints", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating the number of recovery points.""" + application_consistent_snapshot_frequency_in_hours: Optional[int] = rest_field( + name="applicationConsistentSnapshotFrequencyInHours", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating the application consistent frequency.""" + compression: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """A value indicating whether compression has to be enabled.""" + initial_replication_method: Optional[str] = rest_field( + name="initialReplicationMethod", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether IR is online.""" + online_replication_start_time: Optional[str] = rest_field( + name="onlineReplicationStartTime", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating the online IR start time.""" + offline_replication_import_path: Optional[str] = rest_field( + name="offlineReplicationImportPath", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating the offline IR import path.""" + offline_replication_export_path: Optional[str] = rest_field( + name="offlineReplicationExportPath", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating the offline IR export path.""" + replication_port: Optional[int] = rest_field( + name="replicationPort", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating the recovery HTTPS port.""" + allowed_authentication_type: Optional[int] = rest_field( + name="allowedAuthenticationType", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating the authentication type.""" + replica_deletion_option: Optional[str] = rest_field( + name="replicaDeletionOption", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether the VM has to be auto deleted. Supported Values: String.Empty, None, + OnRecoveryCloud.""" + instance_type: Literal["HyperVReplicaBasePolicyDetails"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets the class type. Overridden in derived classes. Required. Default value is + \"HyperVReplicaBasePolicyDetails\".""" + + @overload + def __init__( + self, + *, + recovery_points: Optional[int] = None, + application_consistent_snapshot_frequency_in_hours: Optional[int] = None, + compression: Optional[str] = None, + initial_replication_method: Optional[str] = None, + online_replication_start_time: Optional[str] = None, + offline_replication_import_path: Optional[str] = None, + offline_replication_export_path: Optional[str] = None, + replication_port: Optional[int] = None, + allowed_authentication_type: Optional[int] = None, + replica_deletion_option: 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) + self.instance_type = "HyperVReplicaBasePolicyDetails" # type: ignore + + +class HyperVReplicaBaseReplicationDetails( + ReplicationProviderSpecificSettings, discriminator="HyperVReplicaBaseReplicationDetails" +): + """Hyper V replica provider specific settings base class. + + :ivar last_replicated_time: The Last replication time. + :vartype last_replicated_time: ~datetime.datetime + :ivar vm_nics: The PE Network details. + :vartype vm_nics: list[~azure.mgmt.recoveryservicessiterecovery.models.VMNicDetails] + :ivar vm_id: The virtual machine Id. + :vartype vm_id: str + :ivar vm_protection_state: The protection state for the vm. + :vartype vm_protection_state: str + :ivar vm_protection_state_description: The protection state description for the vm. + :vartype vm_protection_state_description: str + :ivar initial_replication_details: Initial replication details. + :vartype initial_replication_details: + ~azure.mgmt.recoveryservicessiterecovery.models.InitialReplicationDetails + :ivar v_m_disk_details: VM disk details. + :vartype v_m_disk_details: list[~azure.mgmt.recoveryservicessiterecovery.models.DiskDetails] + :ivar instance_type: Gets the Instance type. Required. Default value is + "HyperVReplicaBaseReplicationDetails". + :vartype instance_type: str + """ + + last_replicated_time: Optional[datetime.datetime] = rest_field( + name="lastReplicatedTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The Last replication time.""" + vm_nics: Optional[list["_models.VMNicDetails"]] = rest_field( + name="vmNics", visibility=["read", "create", "update", "delete", "query"] + ) + """The PE Network details.""" + vm_id: Optional[str] = rest_field(name="vmId", visibility=["read", "create", "update", "delete", "query"]) + """The virtual machine Id.""" + vm_protection_state: Optional[str] = rest_field( + name="vmProtectionState", visibility=["read", "create", "update", "delete", "query"] + ) + """The protection state for the vm.""" + vm_protection_state_description: Optional[str] = rest_field( + name="vmProtectionStateDescription", visibility=["read", "create", "update", "delete", "query"] + ) + """The protection state description for the vm.""" + initial_replication_details: Optional["_models.InitialReplicationDetails"] = rest_field( + name="initialReplicationDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """Initial replication details.""" + v_m_disk_details: Optional[list["_models.DiskDetails"]] = rest_field( + name="vMDiskDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """VM disk details.""" + instance_type: Literal["HyperVReplicaBaseReplicationDetails"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets the Instance type. Required. Default value is \"HyperVReplicaBaseReplicationDetails\".""" + + @overload + def __init__( + self, + *, + last_replicated_time: Optional[datetime.datetime] = None, + vm_nics: Optional[list["_models.VMNicDetails"]] = None, + vm_id: Optional[str] = None, + vm_protection_state: Optional[str] = None, + vm_protection_state_description: Optional[str] = None, + initial_replication_details: Optional["_models.InitialReplicationDetails"] = None, + v_m_disk_details: Optional[list["_models.DiskDetails"]] = 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) + self.instance_type = "HyperVReplicaBaseReplicationDetails" # type: ignore + + +class HyperVReplicaBluePolicyDetails(PolicyProviderSpecificDetails, discriminator="HyperVReplica2012R2"): + """Hyper-V Replica Blue specific protection profile details. + + :ivar replication_frequency_in_seconds: A value indicating the replication interval. + :vartype replication_frequency_in_seconds: int + :ivar recovery_points: A value indicating the number of recovery points. + :vartype recovery_points: int + :ivar application_consistent_snapshot_frequency_in_hours: A value indicating the application + consistent frequency. + :vartype application_consistent_snapshot_frequency_in_hours: int + :ivar compression: A value indicating whether compression has to be enabled. + :vartype compression: str + :ivar initial_replication_method: A value indicating whether IR is online. + :vartype initial_replication_method: str + :ivar online_replication_start_time: A value indicating the online IR start time. + :vartype online_replication_start_time: str + :ivar offline_replication_import_path: A value indicating the offline IR import path. + :vartype offline_replication_import_path: str + :ivar offline_replication_export_path: A value indicating the offline IR export path. + :vartype offline_replication_export_path: str + :ivar replication_port: A value indicating the recovery HTTPS port. + :vartype replication_port: int + :ivar allowed_authentication_type: A value indicating the authentication type. + :vartype allowed_authentication_type: int + :ivar replica_deletion_option: A value indicating whether the VM has to be auto deleted. + Supported Values: String.Empty, None, OnRecoveryCloud. + :vartype replica_deletion_option: str + :ivar instance_type: Gets the class type. Overridden in derived classes. Required. Default + value is "HyperVReplica2012R2". + :vartype instance_type: str + """ + + replication_frequency_in_seconds: Optional[int] = rest_field( + name="replicationFrequencyInSeconds", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating the replication interval.""" + recovery_points: Optional[int] = rest_field( + name="recoveryPoints", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating the number of recovery points.""" + application_consistent_snapshot_frequency_in_hours: Optional[int] = rest_field( + name="applicationConsistentSnapshotFrequencyInHours", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating the application consistent frequency.""" + compression: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """A value indicating whether compression has to be enabled.""" + initial_replication_method: Optional[str] = rest_field( + name="initialReplicationMethod", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether IR is online.""" + online_replication_start_time: Optional[str] = rest_field( + name="onlineReplicationStartTime", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating the online IR start time.""" + offline_replication_import_path: Optional[str] = rest_field( + name="offlineReplicationImportPath", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating the offline IR import path.""" + offline_replication_export_path: Optional[str] = rest_field( + name="offlineReplicationExportPath", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating the offline IR export path.""" + replication_port: Optional[int] = rest_field( + name="replicationPort", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating the recovery HTTPS port.""" + allowed_authentication_type: Optional[int] = rest_field( + name="allowedAuthenticationType", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating the authentication type.""" + replica_deletion_option: Optional[str] = rest_field( + name="replicaDeletionOption", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether the VM has to be auto deleted. Supported Values: String.Empty, None, + OnRecoveryCloud.""" + instance_type: Literal["HyperVReplica2012R2"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets the class type. Overridden in derived classes. Required. Default value is + \"HyperVReplica2012R2\".""" + + @overload + def __init__( + self, + *, + replication_frequency_in_seconds: Optional[int] = None, + recovery_points: Optional[int] = None, + application_consistent_snapshot_frequency_in_hours: Optional[int] = None, + compression: Optional[str] = None, + initial_replication_method: Optional[str] = None, + online_replication_start_time: Optional[str] = None, + offline_replication_import_path: Optional[str] = None, + offline_replication_export_path: Optional[str] = None, + replication_port: Optional[int] = None, + allowed_authentication_type: Optional[int] = None, + replica_deletion_option: 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) + self.instance_type = "HyperVReplica2012R2" # type: ignore + + +class HyperVReplicaPolicyInput(PolicyProviderSpecificInput, discriminator="HyperVReplica2012"): + """Hyper-V Replica specific policy Input. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + HyperVReplicaBluePolicyInput + + :ivar instance_type: The class type. Required. Default value is "HyperVReplica2012". + :vartype instance_type: str + :ivar recovery_points: A value indicating the number of recovery points. + :vartype recovery_points: int + :ivar application_consistent_snapshot_frequency_in_hours: A value indicating the application + consistent frequency. + :vartype application_consistent_snapshot_frequency_in_hours: int + :ivar compression: A value indicating whether compression has to be enabled. + :vartype compression: str + :ivar initial_replication_method: A value indicating whether IR is online. + :vartype initial_replication_method: str + :ivar online_replication_start_time: A value indicating the online IR start time. + :vartype online_replication_start_time: str + :ivar offline_replication_import_path: A value indicating the offline IR import path. + :vartype offline_replication_import_path: str + :ivar offline_replication_export_path: A value indicating the offline IR export path. + :vartype offline_replication_export_path: str + :ivar replication_port: A value indicating the recovery HTTPS port. + :vartype replication_port: int + :ivar allowed_authentication_type: A value indicating the authentication type. + :vartype allowed_authentication_type: int + :ivar replica_deletion: A value indicating whether the VM has to be auto deleted. + :vartype replica_deletion: str + """ + + __mapping__: dict[str, _Model] = {} + instance_type: Literal["HyperVReplica2012"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The class type. Required. Default value is \"HyperVReplica2012\".""" + recovery_points: Optional[int] = rest_field( + name="recoveryPoints", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating the number of recovery points.""" + application_consistent_snapshot_frequency_in_hours: Optional[int] = rest_field( + name="applicationConsistentSnapshotFrequencyInHours", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating the application consistent frequency.""" + compression: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """A value indicating whether compression has to be enabled.""" + initial_replication_method: Optional[str] = rest_field( + name="initialReplicationMethod", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether IR is online.""" + online_replication_start_time: Optional[str] = rest_field( + name="onlineReplicationStartTime", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating the online IR start time.""" + offline_replication_import_path: Optional[str] = rest_field( + name="offlineReplicationImportPath", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating the offline IR import path.""" + offline_replication_export_path: Optional[str] = rest_field( + name="offlineReplicationExportPath", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating the offline IR export path.""" + replication_port: Optional[int] = rest_field( + name="replicationPort", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating the recovery HTTPS port.""" + allowed_authentication_type: Optional[int] = rest_field( + name="allowedAuthenticationType", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating the authentication type.""" + replica_deletion: Optional[str] = rest_field( + name="replicaDeletion", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether the VM has to be auto deleted.""" + + @overload + def __init__( + self, + *, + recovery_points: Optional[int] = None, + application_consistent_snapshot_frequency_in_hours: Optional[int] = None, + compression: Optional[str] = None, + initial_replication_method: Optional[str] = None, + online_replication_start_time: Optional[str] = None, + offline_replication_import_path: Optional[str] = None, + offline_replication_export_path: Optional[str] = None, + replication_port: Optional[int] = None, + allowed_authentication_type: Optional[int] = None, + replica_deletion: 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) + self.instance_type = "HyperVReplica2012" # type: ignore + + +class HyperVReplicaBluePolicyInput(HyperVReplicaPolicyInput, discriminator="HyperVReplica2012R2"): + """HyperV Replica Blue policy input. + + :ivar recovery_points: A value indicating the number of recovery points. + :vartype recovery_points: int + :ivar application_consistent_snapshot_frequency_in_hours: A value indicating the application + consistent frequency. + :vartype application_consistent_snapshot_frequency_in_hours: int + :ivar compression: A value indicating whether compression has to be enabled. + :vartype compression: str + :ivar initial_replication_method: A value indicating whether IR is online. + :vartype initial_replication_method: str + :ivar online_replication_start_time: A value indicating the online IR start time. + :vartype online_replication_start_time: str + :ivar offline_replication_import_path: A value indicating the offline IR import path. + :vartype offline_replication_import_path: str + :ivar offline_replication_export_path: A value indicating the offline IR export path. + :vartype offline_replication_export_path: str + :ivar replication_port: A value indicating the recovery HTTPS port. + :vartype replication_port: int + :ivar allowed_authentication_type: A value indicating the authentication type. + :vartype allowed_authentication_type: int + :ivar replica_deletion: A value indicating whether the VM has to be auto deleted. + :vartype replica_deletion: str + :ivar instance_type: The class type. Required. Default value is "HyperVReplica2012R2". + :vartype instance_type: str + :ivar replication_frequency_in_seconds: A value indicating the replication interval. + :vartype replication_frequency_in_seconds: int + """ + + instance_type: Literal["HyperVReplica2012R2"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The class type. Required. Default value is \"HyperVReplica2012R2\".""" + replication_frequency_in_seconds: Optional[int] = rest_field( + name="replicationFrequencyInSeconds", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating the replication interval.""" + + @overload + def __init__( + self, + *, + recovery_points: Optional[int] = None, + application_consistent_snapshot_frequency_in_hours: Optional[int] = None, + compression: Optional[str] = None, + initial_replication_method: Optional[str] = None, + online_replication_start_time: Optional[str] = None, + offline_replication_import_path: Optional[str] = None, + offline_replication_export_path: Optional[str] = None, + replication_port: Optional[int] = None, + allowed_authentication_type: Optional[int] = None, + replica_deletion: Optional[str] = None, + replication_frequency_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) + self.instance_type = "HyperVReplica2012R2" # type: ignore + + +class HyperVReplicaBlueReplicationDetails(ReplicationProviderSpecificSettings, discriminator="HyperVReplica2012R2"): + """HyperV replica 2012 R2 (Blue) replication details. + + :ivar last_replicated_time: The Last replication time. + :vartype last_replicated_time: ~datetime.datetime + :ivar vm_nics: The PE Network details. + :vartype vm_nics: list[~azure.mgmt.recoveryservicessiterecovery.models.VMNicDetails] + :ivar vm_id: The virtual machine Id. + :vartype vm_id: str + :ivar vm_protection_state: The protection state for the vm. + :vartype vm_protection_state: str + :ivar vm_protection_state_description: The protection state description for the vm. + :vartype vm_protection_state_description: str + :ivar initial_replication_details: Initial replication details. + :vartype initial_replication_details: + ~azure.mgmt.recoveryservicessiterecovery.models.InitialReplicationDetails + :ivar v_m_disk_details: VM disk details. + :vartype v_m_disk_details: list[~azure.mgmt.recoveryservicessiterecovery.models.DiskDetails] + :ivar instance_type: Gets the Instance type. Required. Default value is "HyperVReplica2012R2". + :vartype instance_type: str + """ + + last_replicated_time: Optional[datetime.datetime] = rest_field( + name="lastReplicatedTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The Last replication time.""" + vm_nics: Optional[list["_models.VMNicDetails"]] = rest_field( + name="vmNics", visibility=["read", "create", "update", "delete", "query"] + ) + """The PE Network details.""" + vm_id: Optional[str] = rest_field(name="vmId", visibility=["read", "create", "update", "delete", "query"]) + """The virtual machine Id.""" + vm_protection_state: Optional[str] = rest_field( + name="vmProtectionState", visibility=["read", "create", "update", "delete", "query"] + ) + """The protection state for the vm.""" + vm_protection_state_description: Optional[str] = rest_field( + name="vmProtectionStateDescription", visibility=["read", "create", "update", "delete", "query"] + ) + """The protection state description for the vm.""" + initial_replication_details: Optional["_models.InitialReplicationDetails"] = rest_field( + name="initialReplicationDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """Initial replication details.""" + v_m_disk_details: Optional[list["_models.DiskDetails"]] = rest_field( + name="vMDiskDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """VM disk details.""" + instance_type: Literal["HyperVReplica2012R2"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets the Instance type. Required. Default value is \"HyperVReplica2012R2\".""" + + @overload + def __init__( + self, + *, + last_replicated_time: Optional[datetime.datetime] = None, + vm_nics: Optional[list["_models.VMNicDetails"]] = None, + vm_id: Optional[str] = None, + vm_protection_state: Optional[str] = None, + vm_protection_state_description: Optional[str] = None, + initial_replication_details: Optional["_models.InitialReplicationDetails"] = None, + v_m_disk_details: Optional[list["_models.DiskDetails"]] = 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) + self.instance_type = "HyperVReplica2012R2" # type: ignore + + +class HyperVReplicaPolicyDetails(PolicyProviderSpecificDetails, discriminator="HyperVReplica2012"): + """Hyper-V Replica Blue specific protection profile details. + + :ivar recovery_points: A value indicating the number of recovery points. + :vartype recovery_points: int + :ivar application_consistent_snapshot_frequency_in_hours: A value indicating the application + consistent frequency. + :vartype application_consistent_snapshot_frequency_in_hours: int + :ivar compression: A value indicating whether compression has to be enabled. + :vartype compression: str + :ivar initial_replication_method: A value indicating whether IR is online. + :vartype initial_replication_method: str + :ivar online_replication_start_time: A value indicating the online IR start time. + :vartype online_replication_start_time: str + :ivar offline_replication_import_path: A value indicating the offline IR import path. + :vartype offline_replication_import_path: str + :ivar offline_replication_export_path: A value indicating the offline IR export path. + :vartype offline_replication_export_path: str + :ivar replication_port: A value indicating the recovery HTTPS port. + :vartype replication_port: int + :ivar allowed_authentication_type: A value indicating the authentication type. + :vartype allowed_authentication_type: int + :ivar replica_deletion_option: A value indicating whether the VM has to be auto deleted. + Supported Values: String.Empty, None, OnRecoveryCloud. + :vartype replica_deletion_option: str + :ivar instance_type: Gets the class type. Overridden in derived classes. Required. Default + value is "HyperVReplica2012". + :vartype instance_type: str + """ + + recovery_points: Optional[int] = rest_field( + name="recoveryPoints", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating the number of recovery points.""" + application_consistent_snapshot_frequency_in_hours: Optional[int] = rest_field( + name="applicationConsistentSnapshotFrequencyInHours", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating the application consistent frequency.""" + compression: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """A value indicating whether compression has to be enabled.""" + initial_replication_method: Optional[str] = rest_field( + name="initialReplicationMethod", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether IR is online.""" + online_replication_start_time: Optional[str] = rest_field( + name="onlineReplicationStartTime", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating the online IR start time.""" + offline_replication_import_path: Optional[str] = rest_field( + name="offlineReplicationImportPath", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating the offline IR import path.""" + offline_replication_export_path: Optional[str] = rest_field( + name="offlineReplicationExportPath", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating the offline IR export path.""" + replication_port: Optional[int] = rest_field( + name="replicationPort", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating the recovery HTTPS port.""" + allowed_authentication_type: Optional[int] = rest_field( + name="allowedAuthenticationType", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating the authentication type.""" + replica_deletion_option: Optional[str] = rest_field( + name="replicaDeletionOption", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether the VM has to be auto deleted. Supported Values: String.Empty, None, + OnRecoveryCloud.""" + instance_type: Literal["HyperVReplica2012"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets the class type. Overridden in derived classes. Required. Default value is + \"HyperVReplica2012\".""" + + @overload + def __init__( + self, + *, + recovery_points: Optional[int] = None, + application_consistent_snapshot_frequency_in_hours: Optional[int] = None, + compression: Optional[str] = None, + initial_replication_method: Optional[str] = None, + online_replication_start_time: Optional[str] = None, + offline_replication_import_path: Optional[str] = None, + offline_replication_export_path: Optional[str] = None, + replication_port: Optional[int] = None, + allowed_authentication_type: Optional[int] = None, + replica_deletion_option: 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) + self.instance_type = "HyperVReplica2012" # type: ignore + + +class HyperVReplicaReplicationDetails(ReplicationProviderSpecificSettings, discriminator="HyperVReplica2012"): + """HyperV replica 2012 replication details. + + :ivar last_replicated_time: The Last replication time. + :vartype last_replicated_time: ~datetime.datetime + :ivar vm_nics: The PE Network details. + :vartype vm_nics: list[~azure.mgmt.recoveryservicessiterecovery.models.VMNicDetails] + :ivar vm_id: The virtual machine Id. + :vartype vm_id: str + :ivar vm_protection_state: The protection state for the vm. + :vartype vm_protection_state: str + :ivar vm_protection_state_description: The protection state description for the vm. + :vartype vm_protection_state_description: str + :ivar initial_replication_details: Initial replication details. + :vartype initial_replication_details: + ~azure.mgmt.recoveryservicessiterecovery.models.InitialReplicationDetails + :ivar v_m_disk_details: VM disk details. + :vartype v_m_disk_details: list[~azure.mgmt.recoveryservicessiterecovery.models.DiskDetails] + :ivar instance_type: Gets the Instance type. Required. Default value is "HyperVReplica2012". + :vartype instance_type: str + """ + + last_replicated_time: Optional[datetime.datetime] = rest_field( + name="lastReplicatedTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The Last replication time.""" + vm_nics: Optional[list["_models.VMNicDetails"]] = rest_field( + name="vmNics", visibility=["read", "create", "update", "delete", "query"] + ) + """The PE Network details.""" + vm_id: Optional[str] = rest_field(name="vmId", visibility=["read", "create", "update", "delete", "query"]) + """The virtual machine Id.""" + vm_protection_state: Optional[str] = rest_field( + name="vmProtectionState", visibility=["read", "create", "update", "delete", "query"] + ) + """The protection state for the vm.""" + vm_protection_state_description: Optional[str] = rest_field( + name="vmProtectionStateDescription", visibility=["read", "create", "update", "delete", "query"] + ) + """The protection state description for the vm.""" + initial_replication_details: Optional["_models.InitialReplicationDetails"] = rest_field( + name="initialReplicationDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """Initial replication details.""" + v_m_disk_details: Optional[list["_models.DiskDetails"]] = rest_field( + name="vMDiskDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """VM disk details.""" + instance_type: Literal["HyperVReplica2012"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets the Instance type. Required. Default value is \"HyperVReplica2012\".""" + + @overload + def __init__( + self, + *, + last_replicated_time: Optional[datetime.datetime] = None, + vm_nics: Optional[list["_models.VMNicDetails"]] = None, + vm_id: Optional[str] = None, + vm_protection_state: Optional[str] = None, + vm_protection_state_description: Optional[str] = None, + initial_replication_details: Optional["_models.InitialReplicationDetails"] = None, + v_m_disk_details: Optional[list["_models.DiskDetails"]] = 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) + self.instance_type = "HyperVReplica2012" # type: ignore + + +class HyperVSiteDetails(FabricSpecificDetails, discriminator="HyperVSite"): + """HyperVSite fabric specific details. + + :ivar hyper_v_hosts: The list of Hyper-V hosts associated with the fabric. + :vartype hyper_v_hosts: list[~azure.mgmt.recoveryservicessiterecovery.models.HyperVHostDetails] + :ivar instance_type: Gets the class type. Overridden in derived classes. Required. Default + value is "HyperVSite". + :vartype instance_type: str + """ + + hyper_v_hosts: Optional[list["_models.HyperVHostDetails"]] = rest_field( + name="hyperVHosts", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of Hyper-V hosts associated with the fabric.""" + instance_type: Literal["HyperVSite"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets the class type. Overridden in derived classes. Required. Default value is \"HyperVSite\".""" + + @overload + def __init__( + self, + *, + hyper_v_hosts: Optional[list["_models.HyperVHostDetails"]] = 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) + self.instance_type = "HyperVSite" # type: ignore + + +class HyperVVirtualMachineDetails(ConfigurationSettings, discriminator="HyperVVirtualMachine"): + """Single Host fabric provider specific VM settings. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + VmmVirtualMachineDetails + + :ivar source_item_id: The source id of the object. + :vartype source_item_id: str + :ivar generation: The id of the object in fabric. + :vartype generation: str + :ivar os_details: The Last replication time. + :vartype os_details: ~azure.mgmt.recoveryservicessiterecovery.models.OSDetails + :ivar disk_details: The Last successful failover time. + :vartype disk_details: list[~azure.mgmt.recoveryservicessiterecovery.models.DiskDetails] + :ivar has_physical_disk: A value indicating whether the VM has a physical disk attached. String + value of SrsDataContract.PresenceStatus enum. Known values are: "Unknown", "Present", and + "NotPresent". + :vartype has_physical_disk: str or + ~azure.mgmt.recoveryservicessiterecovery.models.PresenceStatus + :ivar has_fibre_channel_adapter: A value indicating whether the VM has a fibre channel adapter + attached. String value of SrsDataContract.PresenceStatus enum. Known values are: "Unknown", + "Present", and "NotPresent". + :vartype has_fibre_channel_adapter: str or + ~azure.mgmt.recoveryservicessiterecovery.models.PresenceStatus + :ivar has_shared_vhd: A value indicating whether the VM has a shared VHD attached. String value + of SrsDataContract.PresenceStatus enum. Known values are: "Unknown", "Present", and + "NotPresent". + :vartype has_shared_vhd: str or ~azure.mgmt.recoveryservicessiterecovery.models.PresenceStatus + :ivar hyper_v_host_id: The Id of the hyper-v host in fabric. + :vartype hyper_v_host_id: str + :ivar instance_type: Required. Default value is "HyperVVirtualMachine". + :vartype instance_type: str + """ + + __mapping__: dict[str, _Model] = {} + source_item_id: Optional[str] = rest_field( + name="sourceItemId", visibility=["read", "create", "update", "delete", "query"] + ) + """The source id of the object.""" + generation: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The id of the object in fabric.""" + os_details: Optional["_models.OSDetails"] = rest_field( + name="osDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """The Last replication time.""" + disk_details: Optional[list["_models.DiskDetails"]] = rest_field( + name="diskDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """The Last successful failover time.""" + has_physical_disk: Optional[Union[str, "_models.PresenceStatus"]] = rest_field( + name="hasPhysicalDisk", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether the VM has a physical disk attached. String value of + SrsDataContract.PresenceStatus enum. Known values are: \"Unknown\", \"Present\", and + \"NotPresent\".""" + has_fibre_channel_adapter: Optional[Union[str, "_models.PresenceStatus"]] = rest_field( + name="hasFibreChannelAdapter", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether the VM has a fibre channel adapter attached. String value of + SrsDataContract.PresenceStatus enum. Known values are: \"Unknown\", \"Present\", and + \"NotPresent\".""" + has_shared_vhd: Optional[Union[str, "_models.PresenceStatus"]] = rest_field( + name="hasSharedVhd", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether the VM has a shared VHD attached. String value of + SrsDataContract.PresenceStatus enum. Known values are: \"Unknown\", \"Present\", and + \"NotPresent\".""" + hyper_v_host_id: Optional[str] = rest_field( + name="hyperVHostId", visibility=["read", "create", "update", "delete", "query"] + ) + """The Id of the hyper-v host in fabric.""" + instance_type: Literal["HyperVVirtualMachine"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Required. Default value is \"HyperVVirtualMachine\".""" + + @overload + def __init__( + self, + *, + source_item_id: Optional[str] = None, + generation: Optional[str] = None, + os_details: Optional["_models.OSDetails"] = None, + disk_details: Optional[list["_models.DiskDetails"]] = None, + has_physical_disk: Optional[Union[str, "_models.PresenceStatus"]] = None, + has_fibre_channel_adapter: Optional[Union[str, "_models.PresenceStatus"]] = None, + has_shared_vhd: Optional[Union[str, "_models.PresenceStatus"]] = None, + hyper_v_host_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) + self.instance_type = "HyperVVirtualMachine" # type: ignore + + +class IdentityProviderDetails(_Model): + """Identity provider details. + + :ivar tenant_id: The tenant Id for the service principal with which the on-premise + management/data plane components would communicate with our Azure services. + :vartype tenant_id: str + :ivar application_id: The application/client Id for the service principal with which the + on-premise management/data plane components would communicate with our Azure services. + :vartype application_id: str + :ivar object_id: The object Id of the service principal with which the on-premise + management/data plane components would communicate with our Azure services. + :vartype object_id: str + :ivar audience: The intended Audience of the service principal with which the on-premise + management/data plane components would communicate with our Azure services. + :vartype audience: str + :ivar aad_authority: The base authority for Azure Active Directory authentication. + :vartype aad_authority: str + """ + + tenant_id: Optional[str] = rest_field(name="tenantId", visibility=["read", "create", "update", "delete", "query"]) + """The tenant Id for the service principal with which the on-premise management/data plane + components would communicate with our Azure services.""" + application_id: Optional[str] = rest_field( + name="applicationId", visibility=["read", "create", "update", "delete", "query"] + ) + """The application/client Id for the service principal with which the on-premise management/data + plane components would communicate with our Azure services.""" + object_id: Optional[str] = rest_field(name="objectId", visibility=["read", "create", "update", "delete", "query"]) + """The object Id of the service principal with which the on-premise management/data plane + components would communicate with our Azure services.""" + audience: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The intended Audience of the service principal with which the on-premise management/data plane + components would communicate with our Azure services.""" + aad_authority: Optional[str] = rest_field( + name="aadAuthority", visibility=["read", "create", "update", "delete", "query"] + ) + """The base authority for Azure Active Directory authentication.""" + + @overload + def __init__( + self, + *, + tenant_id: Optional[str] = None, + application_id: Optional[str] = None, + object_id: Optional[str] = None, + audience: Optional[str] = None, + aad_authority: 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 IdentityProviderInput(_Model): + """Identity provider input. + + :ivar tenant_id: The tenant Id for the service principal with which the on-premise + management/data plane components would communicate with our Azure services. Required. + :vartype tenant_id: str + :ivar application_id: The application/client Id for the service principal with which the + on-premise management/data plane components would communicate with our Azure services. + Required. + :vartype application_id: str + :ivar object_id: The object Id of the service principal with which the on-premise + management/data plane components would communicate with our Azure services. Required. + :vartype object_id: str + :ivar audience: The intended Audience of the service principal with which the on-premise + management/data plane components would communicate with our Azure services. Required. + :vartype audience: str + :ivar aad_authority: The base authority for Azure Active Directory authentication. Required. + :vartype aad_authority: str + """ + + tenant_id: str = rest_field(name="tenantId", visibility=["read", "create", "update", "delete", "query"]) + """The tenant Id for the service principal with which the on-premise management/data plane + components would communicate with our Azure services. Required.""" + application_id: str = rest_field(name="applicationId", visibility=["read", "create", "update", "delete", "query"]) + """The application/client Id for the service principal with which the on-premise management/data + plane components would communicate with our Azure services. Required.""" + object_id: str = rest_field(name="objectId", visibility=["read", "create", "update", "delete", "query"]) + """The object Id of the service principal with which the on-premise management/data plane + components would communicate with our Azure services. Required.""" + audience: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The intended Audience of the service principal with which the on-premise management/data plane + components would communicate with our Azure services. Required.""" + aad_authority: str = rest_field(name="aadAuthority", visibility=["read", "create", "update", "delete", "query"]) + """The base authority for Azure Active Directory authentication. Required.""" + + @overload + def __init__( + self, + *, + tenant_id: str, + application_id: str, + object_id: str, + audience: str, + aad_authority: str, + ) -> 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 InconsistentVmDetails(_Model): + """This class stores the monitoring details for consistency check of inconsistent Protected + Entity. + + :ivar vm_name: The Vm name. + :vartype vm_name: str + :ivar cloud_name: The Cloud name. + :vartype cloud_name: str + :ivar details: The list of details regarding state of the Protected Entity in SRS and On prem. + :vartype details: list[str] + :ivar error_ids: The list of error ids. + :vartype error_ids: list[str] + """ + + vm_name: Optional[str] = rest_field(name="vmName", visibility=["read", "create", "update", "delete", "query"]) + """The Vm name.""" + cloud_name: Optional[str] = rest_field(name="cloudName", visibility=["read", "create", "update", "delete", "query"]) + """The Cloud name.""" + details: Optional[list[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The list of details regarding state of the Protected Entity in SRS and On prem.""" + error_ids: Optional[list[str]] = rest_field( + name="errorIds", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of error ids.""" + + @overload + def __init__( + self, + *, + vm_name: Optional[str] = None, + cloud_name: Optional[str] = None, + details: Optional[list[str]] = None, + error_ids: 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 InitialReplicationDetails(_Model): + """Initial replication details. + + :ivar initial_replication_type: Initial replication type. + :vartype initial_replication_type: str + :ivar initial_replication_progress_percentage: The initial replication progress percentage. + :vartype initial_replication_progress_percentage: str + """ + + initial_replication_type: Optional[str] = rest_field( + name="initialReplicationType", visibility=["read", "create", "update", "delete", "query"] + ) + """Initial replication type.""" + initial_replication_progress_percentage: Optional[str] = rest_field( + name="initialReplicationProgressPercentage", visibility=["read", "create", "update", "delete", "query"] + ) + """The initial replication progress percentage.""" + + @overload + def __init__( + self, + *, + initial_replication_type: Optional[str] = None, + initial_replication_progress_percentage: 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 InlineWorkflowTaskDetails(GroupTaskDetails, discriminator="InlineWorkflowTaskDetails"): + """This class represents the inline workflow task details. + + :ivar child_tasks: The child tasks. + :vartype child_tasks: list[~azure.mgmt.recoveryservicessiterecovery.models.ASRTask] + :ivar workflow_ids: The list of child workflow ids. + :vartype workflow_ids: list[str] + :ivar instance_type: The type of task details. Required. Default value is + "InlineWorkflowTaskDetails". + :vartype instance_type: str + """ + + workflow_ids: Optional[list[str]] = rest_field( + name="workflowIds", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of child workflow ids.""" + instance_type: Literal["InlineWorkflowTaskDetails"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The type of task details. Required. Default value is \"InlineWorkflowTaskDetails\".""" + + @overload + def __init__( + self, + *, + child_tasks: Optional[list["_models.ASRTask"]] = None, + workflow_ids: 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) + self.instance_type = "InlineWorkflowTaskDetails" # type: ignore + + +class InMageAgentDetails(_Model): + """The details of the InMage agent. + + :ivar agent_version: The agent version. + :vartype agent_version: str + :ivar agent_update_status: A value indicating whether installed agent needs to be updated. + :vartype agent_update_status: str + :ivar post_update_reboot_status: A value indicating whether reboot is required after update is + applied. + :vartype post_update_reboot_status: str + :ivar agent_expiry_date: Agent expiry date. + :vartype agent_expiry_date: ~datetime.datetime + """ + + agent_version: Optional[str] = rest_field( + name="agentVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """The agent version.""" + agent_update_status: Optional[str] = rest_field( + name="agentUpdateStatus", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether installed agent needs to be updated.""" + post_update_reboot_status: Optional[str] = rest_field( + name="postUpdateRebootStatus", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether reboot is required after update is applied.""" + agent_expiry_date: Optional[datetime.datetime] = rest_field( + name="agentExpiryDate", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """Agent expiry date.""" + + @overload + def __init__( + self, + *, + agent_version: Optional[str] = None, + agent_update_status: Optional[str] = None, + post_update_reboot_status: Optional[str] = None, + agent_expiry_date: 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 InMageAzureV2ApplyRecoveryPointInput(ApplyRecoveryPointProviderSpecificInput, discriminator="InMageAzureV2"): + """ApplyRecoveryPoint input specific to InMageAzureV2 provider. + + :ivar instance_type: The class type. Required. Default value is "InMageAzureV2". + :vartype instance_type: str + """ + + instance_type: Literal["InMageAzureV2"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The class type. Required. Default value is \"InMageAzureV2\".""" + + @overload + def __init__( + self, + ) -> 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) + self.instance_type = "InMageAzureV2" # type: ignore + + +class InMageAzureV2DiskInputDetails(_Model): + """Disk input details. + + :ivar disk_id: The DiskId. + :vartype disk_id: str + :ivar log_storage_account_id: The LogStorageAccountId. + :vartype log_storage_account_id: str + :ivar disk_type: The disk type. Known values are: "Standard_LRS", "Premium_LRS", + "StandardSSD_LRS", "PremiumV2_LRS", "UltraSSD_LRS", "StandardSSD_ZRS", and "Premium_ZRS". + :vartype disk_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.DiskAccountType + :ivar disk_encryption_set_id: The DiskEncryptionSet ARM ID. + :vartype disk_encryption_set_id: str + """ + + disk_id: Optional[str] = rest_field(name="diskId", visibility=["read", "create", "update", "delete", "query"]) + """The DiskId.""" + log_storage_account_id: Optional[str] = rest_field( + name="logStorageAccountId", visibility=["read", "create", "update", "delete", "query"] + ) + """The LogStorageAccountId.""" + disk_type: Optional[Union[str, "_models.DiskAccountType"]] = rest_field( + name="diskType", visibility=["read", "create", "update", "delete", "query"] + ) + """The disk type. Known values are: \"Standard_LRS\", \"Premium_LRS\", \"StandardSSD_LRS\", + \"PremiumV2_LRS\", \"UltraSSD_LRS\", \"StandardSSD_ZRS\", and \"Premium_ZRS\".""" + disk_encryption_set_id: Optional[str] = rest_field( + name="diskEncryptionSetId", visibility=["read", "create", "update", "delete", "query"] + ) + """The DiskEncryptionSet ARM ID.""" + + @overload + def __init__( + self, + *, + disk_id: Optional[str] = None, + log_storage_account_id: Optional[str] = None, + disk_type: Optional[Union[str, "_models.DiskAccountType"]] = None, + disk_encryption_set_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 InMageAzureV2EnableProtectionInput(EnableProtectionProviderSpecificInput, discriminator="InMageAzureV2"): + """VMware Azure specific enable protection input. + + :ivar master_target_id: The Master target Id. + :vartype master_target_id: str + :ivar process_server_id: The Process Server Id. + :vartype process_server_id: str + :ivar storage_account_id: The storage account Id. + :vartype storage_account_id: str + :ivar run_as_account_id: The CS account Id. + :vartype run_as_account_id: str + :ivar multi_vm_group_id: The multi VM group Id. + :vartype multi_vm_group_id: str + :ivar multi_vm_group_name: The multi VM group name. + :vartype multi_vm_group_name: str + :ivar disks_to_include: The disks to include list. + :vartype disks_to_include: + list[~azure.mgmt.recoveryservicessiterecovery.models.InMageAzureV2DiskInputDetails] + :ivar target_azure_network_id: The selected target Azure network Id. + :vartype target_azure_network_id: str + :ivar target_azure_subnet_id: The selected target Azure subnet Id. + :vartype target_azure_subnet_id: str + :ivar enable_rdp_on_target_option: The selected option to enable RDP\\SSH on target VM after + failover. String value of SrsDataContract.EnableRDPOnTargetOption enum. + :vartype enable_rdp_on_target_option: str + :ivar target_azure_vm_name: The target azure VM Name. + :vartype target_azure_vm_name: str + :ivar log_storage_account_id: The storage account to be used for logging during replication. + :vartype log_storage_account_id: str + :ivar target_azure_v1_resource_group_id: The Id of the target resource group (for classic + deployment) in which the failover VM is to be created. + :vartype target_azure_v1_resource_group_id: str + :ivar target_azure_v2_resource_group_id: The Id of the target resource group (for resource + manager deployment) in which the failover VM is to be created. + :vartype target_azure_v2_resource_group_id: str + :ivar disk_type: The disk type. Known values are: "Standard_LRS", "Premium_LRS", + "StandardSSD_LRS", "PremiumV2_LRS", "UltraSSD_LRS", "StandardSSD_ZRS", and "Premium_ZRS". + :vartype disk_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.DiskAccountType + :ivar target_availability_set_id: The target availability set ARM Id for resource manager + deployment. + :vartype target_availability_set_id: str + :ivar target_availability_zone: The target availability zone. + :vartype target_availability_zone: str + :ivar target_proximity_placement_group_id: The proximity placement group ARM Id. + :vartype target_proximity_placement_group_id: str + :ivar license_type: License type. Known values are: "NotSpecified", "NoLicenseType", and + "WindowsServer". + :vartype license_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.LicenseType + :ivar sql_server_license_type: The SQL Server license type. Known values are: "NotSpecified", + "NoLicenseType", "PAYG", and "AHUB". + :vartype sql_server_license_type: str or + ~azure.mgmt.recoveryservicessiterecovery.models.SqlServerLicenseType + :ivar target_vm_size: The target VM size. + :vartype target_vm_size: str + :ivar disk_encryption_set_id: The DiskEncryptionSet ARM Id. + :vartype disk_encryption_set_id: str + :ivar target_vm_tags: The target VM tags. + :vartype target_vm_tags: dict[str, str] + :ivar seed_managed_disk_tags: The tags for the seed managed disks. + :vartype seed_managed_disk_tags: dict[str, str] + :ivar target_managed_disk_tags: The tags for the target managed disks. + :vartype target_managed_disk_tags: dict[str, str] + :ivar target_nic_tags: The tags for the target NICs. + :vartype target_nic_tags: dict[str, str] + :ivar instance_type: The class type. Required. Default value is "InMageAzureV2". + :vartype instance_type: str + """ + + master_target_id: Optional[str] = rest_field( + name="masterTargetId", visibility=["read", "create", "update", "delete", "query"] + ) + """The Master target Id.""" + process_server_id: Optional[str] = rest_field( + name="processServerId", visibility=["read", "create", "update", "delete", "query"] + ) + """The Process Server Id.""" + storage_account_id: Optional[str] = rest_field( + name="storageAccountId", visibility=["read", "create", "update", "delete", "query"] + ) + """The storage account Id.""" + run_as_account_id: Optional[str] = rest_field( + name="runAsAccountId", visibility=["read", "create", "update", "delete", "query"] + ) + """The CS account Id.""" + multi_vm_group_id: Optional[str] = rest_field( + name="multiVmGroupId", visibility=["read", "create", "update", "delete", "query"] + ) + """The multi VM group Id.""" + multi_vm_group_name: Optional[str] = rest_field( + name="multiVmGroupName", visibility=["read", "create", "update", "delete", "query"] + ) + """The multi VM group name.""" + disks_to_include: Optional[list["_models.InMageAzureV2DiskInputDetails"]] = rest_field( + name="disksToInclude", visibility=["read", "create", "update", "delete", "query"] + ) + """The disks to include list.""" + target_azure_network_id: Optional[str] = rest_field( + name="targetAzureNetworkId", visibility=["read", "create", "update", "delete", "query"] + ) + """The selected target Azure network Id.""" + target_azure_subnet_id: Optional[str] = rest_field( + name="targetAzureSubnetId", visibility=["read", "create", "update", "delete", "query"] + ) + """The selected target Azure subnet Id.""" + enable_rdp_on_target_option: Optional[str] = rest_field( + name="enableRdpOnTargetOption", visibility=["read", "create", "update", "delete", "query"] + ) + """The selected option to enable RDP\SSH on target VM after failover. String value of + SrsDataContract.EnableRDPOnTargetOption enum.""" + target_azure_vm_name: Optional[str] = rest_field( + name="targetAzureVmName", visibility=["read", "create", "update", "delete", "query"] + ) + """The target azure VM Name.""" + log_storage_account_id: Optional[str] = rest_field( + name="logStorageAccountId", visibility=["read", "create", "update", "delete", "query"] + ) + """The storage account to be used for logging during replication.""" + target_azure_v1_resource_group_id: Optional[str] = rest_field( + name="targetAzureV1ResourceGroupId", visibility=["read", "create", "update", "delete", "query"] + ) + """The Id of the target resource group (for classic deployment) in which the failover VM is to be + created.""" + target_azure_v2_resource_group_id: Optional[str] = rest_field( + name="targetAzureV2ResourceGroupId", visibility=["read", "create", "update", "delete", "query"] + ) + """The Id of the target resource group (for resource manager deployment) in which the failover VM + is to be created.""" + disk_type: Optional[Union[str, "_models.DiskAccountType"]] = rest_field( + name="diskType", visibility=["read", "create", "update", "delete", "query"] + ) + """The disk type. Known values are: \"Standard_LRS\", \"Premium_LRS\", \"StandardSSD_LRS\", + \"PremiumV2_LRS\", \"UltraSSD_LRS\", \"StandardSSD_ZRS\", and \"Premium_ZRS\".""" + target_availability_set_id: Optional[str] = rest_field( + name="targetAvailabilitySetId", visibility=["read", "create", "update", "delete", "query"] + ) + """The target availability set ARM Id for resource manager deployment.""" + target_availability_zone: Optional[str] = rest_field( + name="targetAvailabilityZone", visibility=["read", "create", "update", "delete", "query"] + ) + """The target availability zone.""" + target_proximity_placement_group_id: Optional[str] = rest_field( + name="targetProximityPlacementGroupId", visibility=["read", "create", "update", "delete", "query"] + ) + """The proximity placement group ARM Id.""" + license_type: Optional[Union[str, "_models.LicenseType"]] = rest_field( + name="licenseType", visibility=["read", "create", "update", "delete", "query"] + ) + """License type. Known values are: \"NotSpecified\", \"NoLicenseType\", and \"WindowsServer\".""" + sql_server_license_type: Optional[Union[str, "_models.SqlServerLicenseType"]] = rest_field( + name="sqlServerLicenseType", visibility=["read", "create", "update", "delete", "query"] + ) + """The SQL Server license type. Known values are: \"NotSpecified\", \"NoLicenseType\", \"PAYG\", + and \"AHUB\".""" + target_vm_size: Optional[str] = rest_field( + name="targetVmSize", visibility=["read", "create", "update", "delete", "query"] + ) + """The target VM size.""" + disk_encryption_set_id: Optional[str] = rest_field( + name="diskEncryptionSetId", visibility=["read", "create", "update", "delete", "query"] + ) + """The DiskEncryptionSet ARM Id.""" + target_vm_tags: Optional[dict[str, str]] = rest_field( + name="targetVmTags", visibility=["read", "create", "update", "delete", "query"] + ) + """The target VM tags.""" + seed_managed_disk_tags: Optional[dict[str, str]] = rest_field( + name="seedManagedDiskTags", visibility=["read", "create", "update", "delete", "query"] + ) + """The tags for the seed managed disks.""" + target_managed_disk_tags: Optional[dict[str, str]] = rest_field( + name="targetManagedDiskTags", visibility=["read", "create", "update", "delete", "query"] + ) + """The tags for the target managed disks.""" + target_nic_tags: Optional[dict[str, str]] = rest_field( + name="targetNicTags", visibility=["read", "create", "update", "delete", "query"] + ) + """The tags for the target NICs.""" + instance_type: Literal["InMageAzureV2"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The class type. Required. Default value is \"InMageAzureV2\".""" + + @overload + def __init__( # pylint: disable=too-many-locals + self, + *, + master_target_id: Optional[str] = None, + process_server_id: Optional[str] = None, + storage_account_id: Optional[str] = None, + run_as_account_id: Optional[str] = None, + multi_vm_group_id: Optional[str] = None, + multi_vm_group_name: Optional[str] = None, + disks_to_include: Optional[list["_models.InMageAzureV2DiskInputDetails"]] = None, + target_azure_network_id: Optional[str] = None, + target_azure_subnet_id: Optional[str] = None, + enable_rdp_on_target_option: Optional[str] = None, + target_azure_vm_name: Optional[str] = None, + log_storage_account_id: Optional[str] = None, + target_azure_v1_resource_group_id: Optional[str] = None, + target_azure_v2_resource_group_id: Optional[str] = None, + disk_type: Optional[Union[str, "_models.DiskAccountType"]] = None, + target_availability_set_id: Optional[str] = None, + target_availability_zone: Optional[str] = None, + target_proximity_placement_group_id: Optional[str] = None, + license_type: Optional[Union[str, "_models.LicenseType"]] = None, + sql_server_license_type: Optional[Union[str, "_models.SqlServerLicenseType"]] = None, + target_vm_size: Optional[str] = None, + disk_encryption_set_id: Optional[str] = None, + target_vm_tags: Optional[dict[str, str]] = None, + seed_managed_disk_tags: Optional[dict[str, str]] = None, + target_managed_disk_tags: Optional[dict[str, str]] = None, + target_nic_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) + self.instance_type = "InMageAzureV2" # type: ignore + + +class InMageAzureV2EventDetails(EventProviderSpecificDetails, discriminator="InMageAzureV2"): + """Model class for event details of a VMwareAzureV2 event. + + :ivar event_type: InMage Event type. Takes one of the values of + InMageDataContract.InMageMonitoringEventType. + :vartype event_type: str + :ivar category: InMage Event Category. + :vartype category: str + :ivar component: InMage Event Component. + :vartype component: str + :ivar corrective_action: Corrective Action string for the event. + :vartype corrective_action: str + :ivar details: InMage Event Details. + :vartype details: str + :ivar summary: InMage Event Summary. + :vartype summary: str + :ivar site_name: VMware Site name. + :vartype site_name: str + :ivar instance_type: Gets the class type. Overridden in derived classes. Required. Default + value is "InMageAzureV2". + :vartype instance_type: str + """ + + event_type: Optional[str] = rest_field(name="eventType", visibility=["read", "create", "update", "delete", "query"]) + """InMage Event type. Takes one of the values of InMageDataContract.InMageMonitoringEventType.""" + category: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """InMage Event Category.""" + component: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """InMage Event Component.""" + corrective_action: Optional[str] = rest_field( + name="correctiveAction", visibility=["read", "create", "update", "delete", "query"] + ) + """Corrective Action string for the event.""" + details: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """InMage Event Details.""" + summary: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """InMage Event Summary.""" + site_name: Optional[str] = rest_field(name="siteName", visibility=["read", "create", "update", "delete", "query"]) + """VMware Site name.""" + instance_type: Literal["InMageAzureV2"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets the class type. Overridden in derived classes. Required. Default value is + \"InMageAzureV2\".""" + + @overload + def __init__( + self, + *, + event_type: Optional[str] = None, + category: Optional[str] = None, + component: Optional[str] = None, + corrective_action: Optional[str] = None, + details: Optional[str] = None, + summary: Optional[str] = None, + site_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) + self.instance_type = "InMageAzureV2" # type: ignore + + +class InMageAzureV2ManagedDiskDetails(_Model): + """InMageAzureV2 Managed disk details. + + :ivar disk_id: The disk id. + :vartype disk_id: str + :ivar seed_managed_disk_id: Seed managed disk Id. + :vartype seed_managed_disk_id: str + :ivar replica_disk_type: The replica disk type. + :vartype replica_disk_type: str + :ivar disk_encryption_set_id: The DiskEncryptionSet ARM ID. + :vartype disk_encryption_set_id: str + :ivar target_disk_name: The target disk name. + :vartype target_disk_name: str + """ + + disk_id: Optional[str] = rest_field(name="diskId", visibility=["read", "create", "update", "delete", "query"]) + """The disk id.""" + seed_managed_disk_id: Optional[str] = rest_field( + name="seedManagedDiskId", visibility=["read", "create", "update", "delete", "query"] + ) + """Seed managed disk Id.""" + replica_disk_type: Optional[str] = rest_field( + name="replicaDiskType", visibility=["read", "create", "update", "delete", "query"] + ) + """The replica disk type.""" + disk_encryption_set_id: Optional[str] = rest_field( + name="diskEncryptionSetId", visibility=["read", "create", "update", "delete", "query"] + ) + """The DiskEncryptionSet ARM ID.""" + target_disk_name: Optional[str] = rest_field( + name="targetDiskName", visibility=["read", "create", "update", "delete", "query"] + ) + """The target disk name.""" + + @overload + def __init__( + self, + *, + disk_id: Optional[str] = None, + seed_managed_disk_id: Optional[str] = None, + replica_disk_type: Optional[str] = None, + disk_encryption_set_id: Optional[str] = None, + target_disk_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 InMageAzureV2PolicyDetails(PolicyProviderSpecificDetails, discriminator="InMageAzureV2"): + """InMage Azure v2 specific protection profile details. + + :ivar crash_consistent_frequency_in_minutes: The crash consistent snapshot frequency in + minutes. + :vartype crash_consistent_frequency_in_minutes: int + :ivar recovery_point_threshold_in_minutes: The recovery point threshold in minutes. + :vartype recovery_point_threshold_in_minutes: int + :ivar recovery_point_history: The duration in minutes until which the recovery points need to + be stored. + :vartype recovery_point_history: int + :ivar app_consistent_frequency_in_minutes: The app consistent snapshot frequency in minutes. + :vartype app_consistent_frequency_in_minutes: int + :ivar multi_vm_sync_status: A value indicating whether multi-VM sync has to be enabled. + :vartype multi_vm_sync_status: str + :ivar instance_type: Gets the class type. Overridden in derived classes. Required. Default + value is "InMageAzureV2". + :vartype instance_type: str + """ + + crash_consistent_frequency_in_minutes: Optional[int] = rest_field( + name="crashConsistentFrequencyInMinutes", visibility=["read", "create", "update", "delete", "query"] + ) + """The crash consistent snapshot frequency in minutes.""" + recovery_point_threshold_in_minutes: Optional[int] = rest_field( + name="recoveryPointThresholdInMinutes", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery point threshold in minutes.""" + recovery_point_history: Optional[int] = rest_field( + name="recoveryPointHistory", visibility=["read", "create", "update", "delete", "query"] + ) + """The duration in minutes until which the recovery points need to be stored.""" + app_consistent_frequency_in_minutes: Optional[int] = rest_field( + name="appConsistentFrequencyInMinutes", visibility=["read", "create", "update", "delete", "query"] + ) + """The app consistent snapshot frequency in minutes.""" + multi_vm_sync_status: Optional[str] = rest_field( + name="multiVmSyncStatus", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether multi-VM sync has to be enabled.""" + instance_type: Literal["InMageAzureV2"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets the class type. Overridden in derived classes. Required. Default value is + \"InMageAzureV2\".""" + + @overload + def __init__( + self, + *, + crash_consistent_frequency_in_minutes: Optional[int] = None, + recovery_point_threshold_in_minutes: Optional[int] = None, + recovery_point_history: Optional[int] = None, + app_consistent_frequency_in_minutes: Optional[int] = None, + multi_vm_sync_status: 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) + self.instance_type = "InMageAzureV2" # type: ignore + + +class InMageAzureV2PolicyInput(PolicyProviderSpecificInput, discriminator="InMageAzureV2"): + """VMWare Azure specific policy Input. + + :ivar recovery_point_threshold_in_minutes: The recovery point threshold in minutes. + :vartype recovery_point_threshold_in_minutes: int + :ivar recovery_point_history: The duration in minutes until which the recovery points need to + be stored. + :vartype recovery_point_history: int + :ivar crash_consistent_frequency_in_minutes: The crash consistent snapshot frequency (in + minutes). + :vartype crash_consistent_frequency_in_minutes: int + :ivar app_consistent_frequency_in_minutes: The app consistent snapshot frequency (in minutes). + :vartype app_consistent_frequency_in_minutes: int + :ivar multi_vm_sync_status: A value indicating whether multi-VM sync has to be enabled. Value + should be 'Enabled' or 'Disabled'. Required. Known values are: "Enable" and "Disable". + :vartype multi_vm_sync_status: str or + ~azure.mgmt.recoveryservicessiterecovery.models.SetMultiVmSyncStatus + :ivar instance_type: The class type. Required. Default value is "InMageAzureV2". + :vartype instance_type: str + """ + + recovery_point_threshold_in_minutes: Optional[int] = rest_field( + name="recoveryPointThresholdInMinutes", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery point threshold in minutes.""" + recovery_point_history: Optional[int] = rest_field( + name="recoveryPointHistory", visibility=["read", "create", "update", "delete", "query"] + ) + """The duration in minutes until which the recovery points need to be stored.""" + crash_consistent_frequency_in_minutes: Optional[int] = rest_field( + name="crashConsistentFrequencyInMinutes", visibility=["read", "create", "update", "delete", "query"] + ) + """The crash consistent snapshot frequency (in minutes).""" + app_consistent_frequency_in_minutes: Optional[int] = rest_field( + name="appConsistentFrequencyInMinutes", visibility=["read", "create", "update", "delete", "query"] + ) + """The app consistent snapshot frequency (in minutes).""" + multi_vm_sync_status: Union[str, "_models.SetMultiVmSyncStatus"] = rest_field( + name="multiVmSyncStatus", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether multi-VM sync has to be enabled. Value should be 'Enabled' or + 'Disabled'. Required. Known values are: \"Enable\" and \"Disable\".""" + instance_type: Literal["InMageAzureV2"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The class type. Required. Default value is \"InMageAzureV2\".""" + + @overload + def __init__( + self, + *, + multi_vm_sync_status: Union[str, "_models.SetMultiVmSyncStatus"], + recovery_point_threshold_in_minutes: Optional[int] = None, + recovery_point_history: Optional[int] = None, + crash_consistent_frequency_in_minutes: Optional[int] = None, + app_consistent_frequency_in_minutes: 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) + self.instance_type = "InMageAzureV2" # type: ignore + + +class InMageAzureV2ProtectedDiskDetails(_Model): + """InMageAzureV2 protected disk details. + + :ivar disk_id: The disk id. + :vartype disk_id: str + :ivar disk_name: The disk name. + :vartype disk_name: str + :ivar protection_stage: The protection stage. + :vartype protection_stage: str + :ivar health_error_code: The health error code for the disk. + :vartype health_error_code: str + :ivar rpo_in_seconds: The RPO in seconds. + :vartype rpo_in_seconds: int + :ivar resync_required: A value indicating whether resync is required for this disk. + :vartype resync_required: str + :ivar resync_progress_percentage: The resync progress percentage. + :vartype resync_progress_percentage: int + :ivar resync_duration_in_seconds: The resync duration in seconds. + :vartype resync_duration_in_seconds: int + :ivar disk_capacity_in_bytes: The disk capacity in bytes. + :vartype disk_capacity_in_bytes: int + :ivar file_system_capacity_in_bytes: The disk file system capacity in bytes. + :vartype file_system_capacity_in_bytes: int + :ivar source_data_in_mega_bytes: The source data transit in MB. + :vartype source_data_in_mega_bytes: float + :ivar ps_data_in_mega_bytes: The PS data transit in MB. + :vartype ps_data_in_mega_bytes: float + :ivar target_data_in_mega_bytes: The target data transit in MB. + :vartype target_data_in_mega_bytes: float + :ivar disk_resized: A value indicating whether disk is resized. + :vartype disk_resized: str + :ivar last_rpo_calculated_time: The last RPO calculated time. + :vartype last_rpo_calculated_time: ~datetime.datetime + :ivar resync_processed_bytes: The resync processed bytes. + :vartype resync_processed_bytes: int + :ivar resync_total_transferred_bytes: The resync total transferred bytes. + :vartype resync_total_transferred_bytes: int + :ivar resync_last15_minutes_transferred_bytes: The resync last 15 minutes transferred bytes. + :vartype resync_last15_minutes_transferred_bytes: int + :ivar resync_last_data_transfer_time_utc: The last data transfer time in UTC. + :vartype resync_last_data_transfer_time_utc: ~datetime.datetime + :ivar resync_start_time: The resync start time. + :vartype resync_start_time: ~datetime.datetime + :ivar progress_health: The Progress Health. + :vartype progress_health: str + :ivar progress_status: The Progress Status. + :vartype progress_status: str + :ivar seconds_to_take_switch_provider: The seconds to take for switch provider. + :vartype seconds_to_take_switch_provider: int + """ + + disk_id: Optional[str] = rest_field(name="diskId", visibility=["read", "create", "update", "delete", "query"]) + """The disk id.""" + disk_name: Optional[str] = rest_field(name="diskName", visibility=["read", "create", "update", "delete", "query"]) + """The disk name.""" + protection_stage: Optional[str] = rest_field( + name="protectionStage", visibility=["read", "create", "update", "delete", "query"] + ) + """The protection stage.""" + health_error_code: Optional[str] = rest_field( + name="healthErrorCode", visibility=["read", "create", "update", "delete", "query"] + ) + """The health error code for the disk.""" + rpo_in_seconds: Optional[int] = rest_field( + name="rpoInSeconds", visibility=["read", "create", "update", "delete", "query"] + ) + """The RPO in seconds.""" + resync_required: Optional[str] = rest_field( + name="resyncRequired", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether resync is required for this disk.""" + resync_progress_percentage: Optional[int] = rest_field( + name="resyncProgressPercentage", visibility=["read", "create", "update", "delete", "query"] + ) + """The resync progress percentage.""" + resync_duration_in_seconds: Optional[int] = rest_field( + name="resyncDurationInSeconds", visibility=["read", "create", "update", "delete", "query"] + ) + """The resync duration in seconds.""" + disk_capacity_in_bytes: Optional[int] = rest_field( + name="diskCapacityInBytes", visibility=["read", "create", "update", "delete", "query"] + ) + """The disk capacity in bytes.""" + file_system_capacity_in_bytes: Optional[int] = rest_field( + name="fileSystemCapacityInBytes", visibility=["read", "create", "update", "delete", "query"] + ) + """The disk file system capacity in bytes.""" + source_data_in_mega_bytes: Optional[float] = rest_field( + name="sourceDataInMegaBytes", visibility=["read", "create", "update", "delete", "query"] + ) + """The source data transit in MB.""" + ps_data_in_mega_bytes: Optional[float] = rest_field( + name="psDataInMegaBytes", visibility=["read", "create", "update", "delete", "query"] + ) + """The PS data transit in MB.""" + target_data_in_mega_bytes: Optional[float] = rest_field( + name="targetDataInMegaBytes", visibility=["read", "create", "update", "delete", "query"] + ) + """The target data transit in MB.""" + disk_resized: Optional[str] = rest_field( + name="diskResized", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether disk is resized.""" + last_rpo_calculated_time: Optional[datetime.datetime] = rest_field( + name="lastRpoCalculatedTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The last RPO calculated time.""" + resync_processed_bytes: Optional[int] = rest_field( + name="resyncProcessedBytes", visibility=["read", "create", "update", "delete", "query"] + ) + """The resync processed bytes.""" + resync_total_transferred_bytes: Optional[int] = rest_field( + name="resyncTotalTransferredBytes", visibility=["read", "create", "update", "delete", "query"] + ) + """The resync total transferred bytes.""" + resync_last15_minutes_transferred_bytes: Optional[int] = rest_field( + name="resyncLast15MinutesTransferredBytes", visibility=["read", "create", "update", "delete", "query"] + ) + """The resync last 15 minutes transferred bytes.""" + resync_last_data_transfer_time_utc: Optional[datetime.datetime] = rest_field( + name="resyncLastDataTransferTimeUTC", + visibility=["read", "create", "update", "delete", "query"], + format="rfc3339", + ) + """The last data transfer time in UTC.""" + resync_start_time: Optional[datetime.datetime] = rest_field( + name="resyncStartTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The resync start time.""" + progress_health: Optional[str] = rest_field( + name="progressHealth", visibility=["read", "create", "update", "delete", "query"] + ) + """The Progress Health.""" + progress_status: Optional[str] = rest_field( + name="progressStatus", visibility=["read", "create", "update", "delete", "query"] + ) + """The Progress Status.""" + seconds_to_take_switch_provider: Optional[int] = rest_field( + name="secondsToTakeSwitchProvider", visibility=["read", "create", "update", "delete", "query"] + ) + """The seconds to take for switch provider.""" + + @overload + def __init__( + self, + *, + disk_id: Optional[str] = None, + disk_name: Optional[str] = None, + protection_stage: Optional[str] = None, + health_error_code: Optional[str] = None, + rpo_in_seconds: Optional[int] = None, + resync_required: Optional[str] = None, + resync_progress_percentage: Optional[int] = None, + resync_duration_in_seconds: Optional[int] = None, + disk_capacity_in_bytes: Optional[int] = None, + file_system_capacity_in_bytes: Optional[int] = None, + source_data_in_mega_bytes: Optional[float] = None, + ps_data_in_mega_bytes: Optional[float] = None, + target_data_in_mega_bytes: Optional[float] = None, + disk_resized: Optional[str] = None, + last_rpo_calculated_time: Optional[datetime.datetime] = None, + resync_processed_bytes: Optional[int] = None, + resync_total_transferred_bytes: Optional[int] = None, + resync_last15_minutes_transferred_bytes: Optional[int] = None, + resync_last_data_transfer_time_utc: Optional[datetime.datetime] = None, + resync_start_time: Optional[datetime.datetime] = None, + progress_health: Optional[str] = None, + progress_status: Optional[str] = None, + seconds_to_take_switch_provider: 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 InMageAzureV2RecoveryPointDetails(ProviderSpecificRecoveryPointDetails, discriminator="InMageAzureV2"): + """InMage Azure V2 provider specific recovery point details. + + :ivar is_multi_vm_sync_point: A value indicating whether the recovery point is multi VM + consistent. + :vartype is_multi_vm_sync_point: str + :ivar instance_type: Gets the provider type. Required. Default value is "InMageAzureV2". + :vartype instance_type: str + """ + + is_multi_vm_sync_point: Optional[str] = rest_field( + name="isMultiVmSyncPoint", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether the recovery point is multi VM consistent.""" + instance_type: Literal["InMageAzureV2"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets the provider type. Required. Default value is \"InMageAzureV2\".""" + + @overload + def __init__( + self, + *, + is_multi_vm_sync_point: 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) + self.instance_type = "InMageAzureV2" # type: ignore + + +class InMageAzureV2ReplicationDetails(ReplicationProviderSpecificSettings, discriminator="InMageAzureV2"): + """InMageAzureV2 provider specific settings. + + :ivar infrastructure_vm_id: The infrastructure VM Id. + :vartype infrastructure_vm_id: str + :ivar v_center_infrastructure_id: The vCenter infrastructure Id. + :vartype v_center_infrastructure_id: str + :ivar protection_stage: The protection stage. + :vartype protection_stage: str + :ivar vm_id: The virtual machine Id. + :vartype vm_id: str + :ivar vm_protection_state: The protection state for the vm. + :vartype vm_protection_state: str + :ivar vm_protection_state_description: The protection state description for the vm. + :vartype vm_protection_state_description: str + :ivar resync_progress_percentage: The resync progress percentage. + :vartype resync_progress_percentage: int + :ivar rpo_in_seconds: The RPO in seconds. + :vartype rpo_in_seconds: int + :ivar compressed_data_rate_in_mb: The compressed data change rate in MB. + :vartype compressed_data_rate_in_mb: float + :ivar uncompressed_data_rate_in_mb: The uncompressed data change rate in MB. + :vartype uncompressed_data_rate_in_mb: float + :ivar ip_address: The source IP address. + :vartype ip_address: str + :ivar agent_version: The agent version. + :vartype agent_version: str + :ivar agent_expiry_date: Agent expiry date. + :vartype agent_expiry_date: ~datetime.datetime + :ivar is_agent_update_required: A value indicating whether installed agent needs to be updated. + :vartype is_agent_update_required: str + :ivar is_reboot_after_update_required: A value indicating whether the source server requires a + restart after update. + :vartype is_reboot_after_update_required: str + :ivar last_heartbeat: The last heartbeat received from the source server. + :vartype last_heartbeat: ~datetime.datetime + :ivar process_server_id: The process server Id. + :vartype process_server_id: str + :ivar process_server_name: The process server name. + :vartype process_server_name: str + :ivar multi_vm_group_id: The multi vm group Id. + :vartype multi_vm_group_id: str + :ivar multi_vm_group_name: The multi vm group name. + :vartype multi_vm_group_name: str + :ivar multi_vm_sync_status: A value indicating whether multi vm sync is enabled or disabled. + :vartype multi_vm_sync_status: str + :ivar protected_disks: The list of protected disks. + :vartype protected_disks: + list[~azure.mgmt.recoveryservicessiterecovery.models.InMageAzureV2ProtectedDiskDetails] + :ivar disk_resized: A value indicating whether any disk is resized for this VM. + :vartype disk_resized: str + :ivar master_target_id: The master target Id. + :vartype master_target_id: str + :ivar source_vm_cpu_count: The CPU count of the VM on the primary side. + :vartype source_vm_cpu_count: int + :ivar source_vm_ram_size_in_mb: The RAM size of the VM on the primary side. + :vartype source_vm_ram_size_in_mb: int + :ivar os_type: The type of the OS on the VM. + :vartype os_type: str + :ivar vhd_name: The OS disk VHD name. + :vartype vhd_name: str + :ivar os_disk_id: The id of the disk containing the OS. + :vartype os_disk_id: str + :ivar azure_vm_disk_details: Azure VM Disk details. + :vartype azure_vm_disk_details: + list[~azure.mgmt.recoveryservicessiterecovery.models.AzureVmDiskDetails] + :ivar recovery_azure_vm_name: Recovery Azure given name. + :vartype recovery_azure_vm_name: str + :ivar recovery_azure_vm_size: The Recovery Azure VM size. + :vartype recovery_azure_vm_size: str + :ivar recovery_azure_storage_account: The recovery Azure storage account. + :vartype recovery_azure_storage_account: str + :ivar recovery_azure_log_storage_account_id: The ARM id of the log storage account used for + replication. This will be set to null if no log storage account was provided during enable + protection. + :vartype recovery_azure_log_storage_account_id: str + :ivar vm_nics: The PE Network details. + :vartype vm_nics: list[~azure.mgmt.recoveryservicessiterecovery.models.VMNicDetails] + :ivar selected_recovery_azure_network_id: The selected recovery azure network Id. + :vartype selected_recovery_azure_network_id: str + :ivar selected_tfo_azure_network_id: The test failover virtual network. + :vartype selected_tfo_azure_network_id: str + :ivar selected_source_nic_id: The selected source nic Id which will be used as the primary nic + during failover. + :vartype selected_source_nic_id: str + :ivar discovery_type: A value indicating the discovery type of the machine. Value can be + vCenter or physical. + :vartype discovery_type: str + :ivar enable_rdp_on_target_option: The selected option to enable RDP\\SSH on target vm after + failover. String value of SrsDataContract.EnableRDPOnTargetOption enum. + :vartype enable_rdp_on_target_option: str + :ivar datastores: The datastores of the on-premise machine. Value can be list of strings that + contain datastore names. + :vartype datastores: list[str] + :ivar target_vm_id: The ARM Id of the target Azure VM. This value will be null until the VM is + failed over. Only after failure it will be populated with the ARM Id of the Azure VM. + :vartype target_vm_id: str + :ivar recovery_azure_resource_group_id: The target resource group Id. + :vartype recovery_azure_resource_group_id: str + :ivar recovery_availability_set_id: The recovery availability set Id. + :vartype recovery_availability_set_id: str + :ivar target_availability_zone: The target availability zone. + :vartype target_availability_zone: str + :ivar target_proximity_placement_group_id: The target proximity placement group Id. + :vartype target_proximity_placement_group_id: str + :ivar use_managed_disks: A value indicating whether managed disks should be used during + failover. + :vartype use_managed_disks: str + :ivar license_type: License Type of the VM to be used. + :vartype license_type: str + :ivar sql_server_license_type: The SQL Server license type. + :vartype sql_server_license_type: str + :ivar validation_errors: The validation errors of the on-premise machine Value can be list of + validation errors. + :vartype validation_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] + :ivar last_rpo_calculated_time: The last RPO calculated time. + :vartype last_rpo_calculated_time: ~datetime.datetime + :ivar last_update_received_time: The last update time received from on-prem components. + :vartype last_update_received_time: ~datetime.datetime + :ivar replica_id: The replica id of the protected item. + :vartype replica_id: str + :ivar os_version: The OS Version of the protected item. + :vartype os_version: str + :ivar protected_managed_disks: The list of protected managed disks. + :vartype protected_managed_disks: + list[~azure.mgmt.recoveryservicessiterecovery.models.InMageAzureV2ManagedDiskDetails] + :ivar last_recovery_point_received: The last recovery point received time. + :vartype last_recovery_point_received: ~datetime.datetime + :ivar firmware_type: The firmware type of this protected item. + :vartype firmware_type: str + :ivar azure_vm_generation: The target generation for this protected item. + :vartype azure_vm_generation: str + :ivar is_additional_stats_available: A value indicating whether additional IR stats are + available or not. + :vartype is_additional_stats_available: bool + :ivar total_data_transferred: The total transferred data in bytes. + :vartype total_data_transferred: int + :ivar total_progress_health: The progress health. + :vartype total_progress_health: str + :ivar target_vm_tags: The target VM tags. + :vartype target_vm_tags: dict[str, str] + :ivar seed_managed_disk_tags: The tags for the seed managed disks. + :vartype seed_managed_disk_tags: dict[str, str] + :ivar target_managed_disk_tags: The tags for the target managed disks. + :vartype target_managed_disk_tags: dict[str, str] + :ivar target_nic_tags: The tags for the target NICs. + :vartype target_nic_tags: dict[str, str] + :ivar switch_provider_blocking_error_details: The switch provider blocking error information. + :vartype switch_provider_blocking_error_details: + list[~azure.mgmt.recoveryservicessiterecovery.models.InMageAzureV2SwitchProviderBlockingErrorDetails] + :ivar switch_provider_details: The switch provider blocking error information. + :vartype switch_provider_details: + ~azure.mgmt.recoveryservicessiterecovery.models.InMageAzureV2SwitchProviderDetails + :ivar supported_os_versions: A value indicating the inplace OS Upgrade version. + :vartype supported_os_versions: list[str] + :ivar all_available_os_upgrade_configurations: A value indicating all available inplace OS + Upgrade configurations. + :vartype all_available_os_upgrade_configurations: + list[~azure.mgmt.recoveryservicessiterecovery.models.OSUpgradeSupportedVersions] + :ivar os_name: The name of the OS on the VM. + :vartype os_name: str + :ivar instance_type: Gets the Instance type. Required. Default value is "InMageAzureV2". + :vartype instance_type: str + """ + + infrastructure_vm_id: Optional[str] = rest_field( + name="infrastructureVmId", visibility=["read", "create", "update", "delete", "query"] + ) + """The infrastructure VM Id.""" + v_center_infrastructure_id: Optional[str] = rest_field( + name="vCenterInfrastructureId", visibility=["read", "create", "update", "delete", "query"] + ) + """The vCenter infrastructure Id.""" + protection_stage: Optional[str] = rest_field( + name="protectionStage", visibility=["read", "create", "update", "delete", "query"] + ) + """The protection stage.""" + vm_id: Optional[str] = rest_field(name="vmId", visibility=["read", "create", "update", "delete", "query"]) + """The virtual machine Id.""" + vm_protection_state: Optional[str] = rest_field( + name="vmProtectionState", visibility=["read", "create", "update", "delete", "query"] + ) + """The protection state for the vm.""" + vm_protection_state_description: Optional[str] = rest_field( + name="vmProtectionStateDescription", visibility=["read", "create", "update", "delete", "query"] + ) + """The protection state description for the vm.""" + resync_progress_percentage: Optional[int] = rest_field( + name="resyncProgressPercentage", visibility=["read", "create", "update", "delete", "query"] + ) + """The resync progress percentage.""" + rpo_in_seconds: Optional[int] = rest_field( + name="rpoInSeconds", visibility=["read", "create", "update", "delete", "query"] + ) + """The RPO in seconds.""" + compressed_data_rate_in_mb: Optional[float] = rest_field( + name="compressedDataRateInMB", visibility=["read", "create", "update", "delete", "query"] + ) + """The compressed data change rate in MB.""" + uncompressed_data_rate_in_mb: Optional[float] = rest_field( + name="uncompressedDataRateInMB", visibility=["read", "create", "update", "delete", "query"] + ) + """The uncompressed data change rate in MB.""" + ip_address: Optional[str] = rest_field(name="ipAddress", visibility=["read", "create", "update", "delete", "query"]) + """The source IP address.""" + agent_version: Optional[str] = rest_field( + name="agentVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """The agent version.""" + agent_expiry_date: Optional[datetime.datetime] = rest_field( + name="agentExpiryDate", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """Agent expiry date.""" + is_agent_update_required: Optional[str] = rest_field( + name="isAgentUpdateRequired", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether installed agent needs to be updated.""" + is_reboot_after_update_required: Optional[str] = rest_field( + name="isRebootAfterUpdateRequired", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether the source server requires a restart after update.""" + last_heartbeat: Optional[datetime.datetime] = rest_field( + name="lastHeartbeat", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The last heartbeat received from the source server.""" + process_server_id: Optional[str] = rest_field( + name="processServerId", visibility=["read", "create", "update", "delete", "query"] + ) + """The process server Id.""" + process_server_name: Optional[str] = rest_field( + name="processServerName", visibility=["read", "create", "update", "delete", "query"] + ) + """The process server name.""" + multi_vm_group_id: Optional[str] = rest_field( + name="multiVmGroupId", visibility=["read", "create", "update", "delete", "query"] + ) + """The multi vm group Id.""" + multi_vm_group_name: Optional[str] = rest_field( + name="multiVmGroupName", visibility=["read", "create", "update", "delete", "query"] + ) + """The multi vm group name.""" + multi_vm_sync_status: Optional[str] = rest_field( + name="multiVmSyncStatus", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether multi vm sync is enabled or disabled.""" + protected_disks: Optional[list["_models.InMageAzureV2ProtectedDiskDetails"]] = rest_field( + name="protectedDisks", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of protected disks.""" + disk_resized: Optional[str] = rest_field( + name="diskResized", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether any disk is resized for this VM.""" + master_target_id: Optional[str] = rest_field( + name="masterTargetId", visibility=["read", "create", "update", "delete", "query"] + ) + """The master target Id.""" + source_vm_cpu_count: Optional[int] = rest_field( + name="sourceVmCpuCount", visibility=["read", "create", "update", "delete", "query"] + ) + """The CPU count of the VM on the primary side.""" + source_vm_ram_size_in_mb: Optional[int] = rest_field( + name="sourceVmRamSizeInMB", visibility=["read", "create", "update", "delete", "query"] + ) + """The RAM size of the VM on the primary side.""" + os_type: Optional[str] = rest_field(name="osType", visibility=["read", "create", "update", "delete", "query"]) + """The type of the OS on the VM.""" + vhd_name: Optional[str] = rest_field(name="vhdName", visibility=["read", "create", "update", "delete", "query"]) + """The OS disk VHD name.""" + os_disk_id: Optional[str] = rest_field(name="osDiskId", visibility=["read", "create", "update", "delete", "query"]) + """The id of the disk containing the OS.""" + azure_vm_disk_details: Optional[list["_models.AzureVmDiskDetails"]] = rest_field( + name="azureVMDiskDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """Azure VM Disk details.""" + recovery_azure_vm_name: Optional[str] = rest_field( + name="recoveryAzureVMName", visibility=["read", "create", "update", "delete", "query"] + ) + """Recovery Azure given name.""" + recovery_azure_vm_size: Optional[str] = rest_field( + name="recoveryAzureVMSize", visibility=["read", "create", "update", "delete", "query"] + ) + """The Recovery Azure VM size.""" + recovery_azure_storage_account: Optional[str] = rest_field( + name="recoveryAzureStorageAccount", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery Azure storage account.""" + recovery_azure_log_storage_account_id: Optional[str] = rest_field( + name="recoveryAzureLogStorageAccountId", visibility=["read", "create", "update", "delete", "query"] + ) + """The ARM id of the log storage account used for replication. This will be set to null if no log + storage account was provided during enable protection.""" + vm_nics: Optional[list["_models.VMNicDetails"]] = rest_field( + name="vmNics", visibility=["read", "create", "update", "delete", "query"] + ) + """The PE Network details.""" + selected_recovery_azure_network_id: Optional[str] = rest_field( + name="selectedRecoveryAzureNetworkId", visibility=["read", "create", "update", "delete", "query"] + ) + """The selected recovery azure network Id.""" + selected_tfo_azure_network_id: Optional[str] = rest_field( + name="selectedTfoAzureNetworkId", visibility=["read", "create", "update", "delete", "query"] + ) + """The test failover virtual network.""" + selected_source_nic_id: Optional[str] = rest_field( + name="selectedSourceNicId", visibility=["read", "create", "update", "delete", "query"] + ) + """The selected source nic Id which will be used as the primary nic during failover.""" + discovery_type: Optional[str] = rest_field( + name="discoveryType", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating the discovery type of the machine. Value can be vCenter or physical.""" + enable_rdp_on_target_option: Optional[str] = rest_field( + name="enableRdpOnTargetOption", visibility=["read", "create", "update", "delete", "query"] + ) + """The selected option to enable RDP\SSH on target vm after failover. String value of + SrsDataContract.EnableRDPOnTargetOption enum.""" + datastores: Optional[list[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The datastores of the on-premise machine. Value can be list of strings that contain datastore + names.""" + target_vm_id: Optional[str] = rest_field( + name="targetVmId", visibility=["read", "create", "update", "delete", "query"] + ) + """The ARM Id of the target Azure VM. This value will be null until the VM is failed over. Only + after failure it will be populated with the ARM Id of the Azure VM.""" + recovery_azure_resource_group_id: Optional[str] = rest_field( + name="recoveryAzureResourceGroupId", visibility=["read", "create", "update", "delete", "query"] + ) + """The target resource group Id.""" + recovery_availability_set_id: Optional[str] = rest_field( + name="recoveryAvailabilitySetId", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery availability set Id.""" + target_availability_zone: Optional[str] = rest_field( + name="targetAvailabilityZone", visibility=["read", "create", "update", "delete", "query"] + ) + """The target availability zone.""" + target_proximity_placement_group_id: Optional[str] = rest_field( + name="targetProximityPlacementGroupId", visibility=["read", "create", "update", "delete", "query"] + ) + """The target proximity placement group Id.""" + use_managed_disks: Optional[str] = rest_field( + name="useManagedDisks", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether managed disks should be used during failover.""" + license_type: Optional[str] = rest_field( + name="licenseType", visibility=["read", "create", "update", "delete", "query"] + ) + """License Type of the VM to be used.""" + sql_server_license_type: Optional[str] = rest_field( + name="sqlServerLicenseType", visibility=["read", "create", "update", "delete", "query"] + ) + """The SQL Server license type.""" + validation_errors: Optional[list["_models.HealthError"]] = rest_field( + name="validationErrors", visibility=["read", "create", "update", "delete", "query"] + ) + """The validation errors of the on-premise machine Value can be list of validation errors.""" + last_rpo_calculated_time: Optional[datetime.datetime] = rest_field( + name="lastRpoCalculatedTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The last RPO calculated time.""" + last_update_received_time: Optional[datetime.datetime] = rest_field( + name="lastUpdateReceivedTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The last update time received from on-prem components.""" + replica_id: Optional[str] = rest_field(name="replicaId", visibility=["read", "create", "update", "delete", "query"]) + """The replica id of the protected item.""" + os_version: Optional[str] = rest_field(name="osVersion", visibility=["read", "create", "update", "delete", "query"]) + """The OS Version of the protected item.""" + protected_managed_disks: Optional[list["_models.InMageAzureV2ManagedDiskDetails"]] = rest_field( + name="protectedManagedDisks", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of protected managed disks.""" + last_recovery_point_received: Optional[datetime.datetime] = rest_field( + name="lastRecoveryPointReceived", visibility=["read"], format="rfc3339" + ) + """The last recovery point received time.""" + firmware_type: Optional[str] = rest_field( + name="firmwareType", visibility=["read", "create", "update", "delete", "query"] + ) + """The firmware type of this protected item.""" + azure_vm_generation: Optional[str] = rest_field( + name="azureVmGeneration", visibility=["read", "create", "update", "delete", "query"] + ) + """The target generation for this protected item.""" + is_additional_stats_available: Optional[bool] = rest_field( + name="isAdditionalStatsAvailable", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether additional IR stats are available or not.""" + total_data_transferred: Optional[int] = rest_field( + name="totalDataTransferred", visibility=["read", "create", "update", "delete", "query"] + ) + """The total transferred data in bytes.""" + total_progress_health: Optional[str] = rest_field( + name="totalProgressHealth", visibility=["read", "create", "update", "delete", "query"] + ) + """The progress health.""" + target_vm_tags: Optional[dict[str, str]] = rest_field( + name="targetVmTags", visibility=["read", "create", "update", "delete", "query"] + ) + """The target VM tags.""" + seed_managed_disk_tags: Optional[dict[str, str]] = rest_field( + name="seedManagedDiskTags", visibility=["read", "create", "update", "delete", "query"] + ) + """The tags for the seed managed disks.""" + target_managed_disk_tags: Optional[dict[str, str]] = rest_field( + name="targetManagedDiskTags", visibility=["read", "create", "update", "delete", "query"] + ) + """The tags for the target managed disks.""" + target_nic_tags: Optional[dict[str, str]] = rest_field( + name="targetNicTags", visibility=["read", "create", "update", "delete", "query"] + ) + """The tags for the target NICs.""" + switch_provider_blocking_error_details: Optional[ + list["_models.InMageAzureV2SwitchProviderBlockingErrorDetails"] + ] = rest_field( + name="switchProviderBlockingErrorDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """The switch provider blocking error information.""" + switch_provider_details: Optional["_models.InMageAzureV2SwitchProviderDetails"] = rest_field( + name="switchProviderDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """The switch provider blocking error information.""" + supported_os_versions: Optional[list[str]] = rest_field( + name="supportedOSVersions", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating the inplace OS Upgrade version.""" + all_available_os_upgrade_configurations: Optional[list["_models.OSUpgradeSupportedVersions"]] = rest_field( + name="allAvailableOSUpgradeConfigurations", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating all available inplace OS Upgrade configurations.""" + os_name: Optional[str] = rest_field(name="osName", visibility=["read"]) + """The name of the OS on the VM.""" + instance_type: Literal["InMageAzureV2"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets the Instance type. Required. Default value is \"InMageAzureV2\".""" + + @overload + def __init__( # pylint: disable=too-many-locals + self, + *, + infrastructure_vm_id: Optional[str] = None, + v_center_infrastructure_id: Optional[str] = None, + protection_stage: Optional[str] = None, + vm_id: Optional[str] = None, + vm_protection_state: Optional[str] = None, + vm_protection_state_description: Optional[str] = None, + resync_progress_percentage: Optional[int] = None, + rpo_in_seconds: Optional[int] = None, + compressed_data_rate_in_mb: Optional[float] = None, + uncompressed_data_rate_in_mb: Optional[float] = None, + ip_address: Optional[str] = None, + agent_version: Optional[str] = None, + agent_expiry_date: Optional[datetime.datetime] = None, + is_agent_update_required: Optional[str] = None, + is_reboot_after_update_required: Optional[str] = None, + last_heartbeat: Optional[datetime.datetime] = None, + process_server_id: Optional[str] = None, + process_server_name: Optional[str] = None, + multi_vm_group_id: Optional[str] = None, + multi_vm_group_name: Optional[str] = None, + multi_vm_sync_status: Optional[str] = None, + protected_disks: Optional[list["_models.InMageAzureV2ProtectedDiskDetails"]] = None, + disk_resized: Optional[str] = None, + master_target_id: Optional[str] = None, + source_vm_cpu_count: Optional[int] = None, + source_vm_ram_size_in_mb: Optional[int] = None, + os_type: Optional[str] = None, + vhd_name: Optional[str] = None, + os_disk_id: Optional[str] = None, + azure_vm_disk_details: Optional[list["_models.AzureVmDiskDetails"]] = None, + recovery_azure_vm_name: Optional[str] = None, + recovery_azure_vm_size: Optional[str] = None, + recovery_azure_storage_account: Optional[str] = None, + recovery_azure_log_storage_account_id: Optional[str] = None, + vm_nics: Optional[list["_models.VMNicDetails"]] = None, + selected_recovery_azure_network_id: Optional[str] = None, + selected_tfo_azure_network_id: Optional[str] = None, + selected_source_nic_id: Optional[str] = None, + discovery_type: Optional[str] = None, + enable_rdp_on_target_option: Optional[str] = None, + datastores: Optional[list[str]] = None, + target_vm_id: Optional[str] = None, + recovery_azure_resource_group_id: Optional[str] = None, + recovery_availability_set_id: Optional[str] = None, + target_availability_zone: Optional[str] = None, + target_proximity_placement_group_id: Optional[str] = None, + use_managed_disks: Optional[str] = None, + license_type: Optional[str] = None, + sql_server_license_type: Optional[str] = None, + validation_errors: Optional[list["_models.HealthError"]] = None, + last_rpo_calculated_time: Optional[datetime.datetime] = None, + last_update_received_time: Optional[datetime.datetime] = None, + replica_id: Optional[str] = None, + os_version: Optional[str] = None, + protected_managed_disks: Optional[list["_models.InMageAzureV2ManagedDiskDetails"]] = None, + firmware_type: Optional[str] = None, + azure_vm_generation: Optional[str] = None, + is_additional_stats_available: Optional[bool] = None, + total_data_transferred: Optional[int] = None, + total_progress_health: Optional[str] = None, + target_vm_tags: Optional[dict[str, str]] = None, + seed_managed_disk_tags: Optional[dict[str, str]] = None, + target_managed_disk_tags: Optional[dict[str, str]] = None, + target_nic_tags: Optional[dict[str, str]] = None, + switch_provider_blocking_error_details: Optional[ + list["_models.InMageAzureV2SwitchProviderBlockingErrorDetails"] + ] = None, + switch_provider_details: Optional["_models.InMageAzureV2SwitchProviderDetails"] = None, + supported_os_versions: Optional[list[str]] = None, + all_available_os_upgrade_configurations: Optional[list["_models.OSUpgradeSupportedVersions"]] = 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) + self.instance_type = "InMageAzureV2" # type: ignore + + +class InMageAzureV2ReprotectInput(ReverseReplicationProviderSpecificInput, discriminator="InMageAzureV2"): + """InMageAzureV2 specific provider input. + + :ivar master_target_id: The Master target Id. + :vartype master_target_id: str + :ivar process_server_id: The Process Server Id. + :vartype process_server_id: str + :ivar storage_account_id: The storage account id. + :vartype storage_account_id: str + :ivar run_as_account_id: The CS account Id. + :vartype run_as_account_id: str + :ivar policy_id: The Policy Id. + :vartype policy_id: str + :ivar log_storage_account_id: The storage account to be used for logging during replication. + :vartype log_storage_account_id: str + :ivar disks_to_include: The disks to include list. + :vartype disks_to_include: list[str] + :ivar instance_type: The class type. Required. Default value is "InMageAzureV2". + :vartype instance_type: str + """ + + master_target_id: Optional[str] = rest_field( + name="masterTargetId", visibility=["read", "create", "update", "delete", "query"] + ) + """The Master target Id.""" + process_server_id: Optional[str] = rest_field( + name="processServerId", visibility=["read", "create", "update", "delete", "query"] + ) + """The Process Server Id.""" + storage_account_id: Optional[str] = rest_field( + name="storageAccountId", visibility=["read", "create", "update", "delete", "query"] + ) + """The storage account id.""" + run_as_account_id: Optional[str] = rest_field( + name="runAsAccountId", visibility=["read", "create", "update", "delete", "query"] + ) + """The CS account Id.""" + policy_id: Optional[str] = rest_field(name="policyId", visibility=["read", "create", "update", "delete", "query"]) + """The Policy Id.""" + log_storage_account_id: Optional[str] = rest_field( + name="logStorageAccountId", visibility=["read", "create", "update", "delete", "query"] + ) + """The storage account to be used for logging during replication.""" + disks_to_include: Optional[list[str]] = rest_field( + name="disksToInclude", visibility=["read", "create", "update", "delete", "query"] + ) + """The disks to include list.""" + instance_type: Literal["InMageAzureV2"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The class type. Required. Default value is \"InMageAzureV2\".""" + + @overload + def __init__( + self, + *, + master_target_id: Optional[str] = None, + process_server_id: Optional[str] = None, + storage_account_id: Optional[str] = None, + run_as_account_id: Optional[str] = None, + policy_id: Optional[str] = None, + log_storage_account_id: Optional[str] = None, + disks_to_include: 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) + self.instance_type = "InMageAzureV2" # type: ignore + + +class InMageAzureV2SwitchProviderBlockingErrorDetails(_Model): # pylint: disable=name-too-long + """InMageAzureV2 switch provider blocking error details. + + :ivar error_code: The error code. + :vartype error_code: str + :ivar error_message: The error message. + :vartype error_message: str + :ivar possible_causes: The possible causes. + :vartype possible_causes: str + :ivar recommended_action: The recommended action. + :vartype recommended_action: str + :ivar error_message_parameters: The error message parameters. + :vartype error_message_parameters: dict[str, str] + :ivar error_tags: The error tags. + :vartype error_tags: dict[str, str] + """ + + error_code: Optional[str] = rest_field(name="errorCode", visibility=["read"]) + """The error code.""" + error_message: Optional[str] = rest_field(name="errorMessage", visibility=["read"]) + """The error message.""" + possible_causes: Optional[str] = rest_field(name="possibleCauses", visibility=["read"]) + """The possible causes.""" + recommended_action: Optional[str] = rest_field(name="recommendedAction", visibility=["read"]) + """The recommended action.""" + error_message_parameters: Optional[dict[str, str]] = rest_field(name="errorMessageParameters", visibility=["read"]) + """The error message parameters.""" + error_tags: Optional[dict[str, str]] = rest_field(name="errorTags", visibility=["read"]) + """The error tags.""" + + +class InMageAzureV2SwitchProviderDetails(_Model): + """InMageAzureV2 switch provider details. + + :ivar target_vault_id: The target vault Id. + :vartype target_vault_id: str + :ivar target_resource_id: The target resource Id. + :vartype target_resource_id: str + :ivar target_fabric_id: The target fabric Id. + :vartype target_fabric_id: str + :ivar target_appliance_id: The target appliance Id. + :vartype target_appliance_id: str + """ + + target_vault_id: Optional[str] = rest_field(name="targetVaultId", visibility=["read"]) + """The target vault Id.""" + target_resource_id: Optional[str] = rest_field(name="targetResourceId", visibility=["read"]) + """The target resource Id.""" + target_fabric_id: Optional[str] = rest_field(name="targetFabricId", visibility=["read"]) + """The target fabric Id.""" + target_appliance_id: Optional[str] = rest_field(name="targetApplianceId", visibility=["read"]) + """The target appliance Id.""" + + +class SwitchProviderSpecificInput(_Model): + """Provider specific switch provider input. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + InMageAzureV2SwitchProviderInput + + :ivar instance_type: The class type. Required. Default value is None. + :vartype instance_type: str + """ + + __mapping__: dict[str, _Model] = {} + instance_type: str = rest_discriminator( + name="instanceType", visibility=["read", "create", "update", "delete", "query"] + ) + """The class type. Required. Default value is None.""" + + @overload + def __init__( + self, + *, + instance_type: str, + ) -> 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 InMageAzureV2SwitchProviderInput(SwitchProviderSpecificInput, discriminator="InMageAzureV2"): + """Provider specific input for InMageAzureV2 switch provider. + + :ivar target_vault_id: The target vault Id. Required. + :vartype target_vault_id: str + :ivar target_fabric_id: The target fabric Id. Required. + :vartype target_fabric_id: str + :ivar target_appliance_id: The target appliance Id. Required. + :vartype target_appliance_id: str + :ivar instance_type: The class type. Required. Default value is "InMageAzureV2". + :vartype instance_type: str + """ + + target_vault_id: str = rest_field(name="targetVaultID", visibility=["read", "create", "update", "delete", "query"]) + """The target vault Id. Required.""" + target_fabric_id: str = rest_field( + name="targetFabricID", visibility=["read", "create", "update", "delete", "query"] + ) + """The target fabric Id. Required.""" + target_appliance_id: str = rest_field( + name="targetApplianceID", visibility=["read", "create", "update", "delete", "query"] + ) + """The target appliance Id. Required.""" + instance_type: Literal["InMageAzureV2"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The class type. Required. Default value is \"InMageAzureV2\".""" + + @overload + def __init__( + self, + *, + target_vault_id: str, + target_fabric_id: str, + target_appliance_id: str, + ) -> 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) + self.instance_type = "InMageAzureV2" # type: ignore + + +class InMageAzureV2TestFailoverInput(TestFailoverProviderSpecificInput, discriminator="InMageAzureV2"): + """InMageAzureV2 provider specific input for test failover. + + :ivar recovery_point_id: The recovery point id to be passed to test failover to a particular + recovery point. In case of latest recovery point, null should be passed. + :vartype recovery_point_id: str + :ivar os_upgrade_version: A value indicating the inplace OS Upgrade version. + :vartype os_upgrade_version: str + :ivar instance_type: The class type. Required. Default value is "InMageAzureV2". + :vartype instance_type: str + """ + + recovery_point_id: Optional[str] = rest_field( + name="recoveryPointId", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery point id to be passed to test failover to a particular recovery point. In case of + latest recovery point, null should be passed.""" + os_upgrade_version: Optional[str] = rest_field( + name="osUpgradeVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating the inplace OS Upgrade version.""" + instance_type: Literal["InMageAzureV2"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The class type. Required. Default value is \"InMageAzureV2\".""" + + @overload + def __init__( + self, + *, + recovery_point_id: Optional[str] = None, + os_upgrade_version: 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) + self.instance_type = "InMageAzureV2" # type: ignore + + +class InMageAzureV2UnplannedFailoverInput(UnplannedFailoverProviderSpecificInput, discriminator="InMageAzureV2"): + """InMageAzureV2 provider specific input for unplanned failover. + + :ivar recovery_point_id: The recovery point id to be passed to failover to a particular + recovery point. In case of latest recovery point, null should be passed. + :vartype recovery_point_id: str + :ivar os_upgrade_version: A value indicating the inplace OS Upgrade version. + :vartype os_upgrade_version: str + :ivar instance_type: The class type. Required. Default value is "InMageAzureV2". + :vartype instance_type: str + """ + + recovery_point_id: Optional[str] = rest_field( + name="recoveryPointId", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery point id to be passed to failover to a particular recovery point. In case of + latest recovery point, null should be passed.""" + os_upgrade_version: Optional[str] = rest_field( + name="osUpgradeVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating the inplace OS Upgrade version.""" + instance_type: Literal["InMageAzureV2"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The class type. Required. Default value is \"InMageAzureV2\".""" + + @overload + def __init__( + self, + *, + recovery_point_id: Optional[str] = None, + os_upgrade_version: 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) + self.instance_type = "InMageAzureV2" # type: ignore + + +class InMageAzureV2UpdateReplicationProtectedItemInput( + UpdateReplicationProtectedItemProviderInput, discriminator="InMageAzureV2" +): # pylint: disable=name-too-long + """InMage Azure V2 input to update replication protected item. + + :ivar recovery_azure_v1_resource_group_id: The recovery Azure resource group Id for classic + deployment. + :vartype recovery_azure_v1_resource_group_id: str + :ivar recovery_azure_v2_resource_group_id: The recovery Azure resource group Id for resource + manager deployment. + :vartype recovery_azure_v2_resource_group_id: str + :ivar use_managed_disks: A value indicating whether managed disks should be used during + failover. + :vartype use_managed_disks: str + :ivar target_proximity_placement_group_id: The target proximity placement group Id. + :vartype target_proximity_placement_group_id: str + :ivar target_availability_zone: The target availability zone. + :vartype target_availability_zone: str + :ivar target_vm_tags: The target VM tags. + :vartype target_vm_tags: dict[str, str] + :ivar target_managed_disk_tags: The tags for the target managed disks. + :vartype target_managed_disk_tags: dict[str, str] + :ivar target_nic_tags: The tags for the target NICs. + :vartype target_nic_tags: dict[str, str] + :ivar sql_server_license_type: The SQL Server license type. Known values are: "NotSpecified", + "NoLicenseType", "PAYG", and "AHUB". + :vartype sql_server_license_type: str or + ~azure.mgmt.recoveryservicessiterecovery.models.SqlServerLicenseType + :ivar vm_disks: The list of disk update properties. + :vartype vm_disks: list[~azure.mgmt.recoveryservicessiterecovery.models.UpdateDiskInput] + :ivar instance_type: The class type. Required. Default value is "InMageAzureV2". + :vartype instance_type: str + """ + + recovery_azure_v1_resource_group_id: Optional[str] = rest_field( + name="recoveryAzureV1ResourceGroupId", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery Azure resource group Id for classic deployment.""" + recovery_azure_v2_resource_group_id: Optional[str] = rest_field( + name="recoveryAzureV2ResourceGroupId", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery Azure resource group Id for resource manager deployment.""" + use_managed_disks: Optional[str] = rest_field( + name="useManagedDisks", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether managed disks should be used during failover.""" + target_proximity_placement_group_id: Optional[str] = rest_field( + name="targetProximityPlacementGroupId", visibility=["read", "create", "update", "delete", "query"] + ) + """The target proximity placement group Id.""" + target_availability_zone: Optional[str] = rest_field( + name="targetAvailabilityZone", visibility=["read", "create", "update", "delete", "query"] + ) + """The target availability zone.""" + target_vm_tags: Optional[dict[str, str]] = rest_field( + name="targetVmTags", visibility=["read", "create", "update", "delete", "query"] + ) + """The target VM tags.""" + target_managed_disk_tags: Optional[dict[str, str]] = rest_field( + name="targetManagedDiskTags", visibility=["read", "create", "update", "delete", "query"] + ) + """The tags for the target managed disks.""" + target_nic_tags: Optional[dict[str, str]] = rest_field( + name="targetNicTags", visibility=["read", "create", "update", "delete", "query"] + ) + """The tags for the target NICs.""" + sql_server_license_type: Optional[Union[str, "_models.SqlServerLicenseType"]] = rest_field( + name="sqlServerLicenseType", visibility=["read", "create", "update", "delete", "query"] + ) + """The SQL Server license type. Known values are: \"NotSpecified\", \"NoLicenseType\", \"PAYG\", + and \"AHUB\".""" + vm_disks: Optional[list["_models.UpdateDiskInput"]] = rest_field( + name="vmDisks", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of disk update properties.""" + instance_type: Literal["InMageAzureV2"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The class type. Required. Default value is \"InMageAzureV2\".""" + + @overload + def __init__( + self, + *, + recovery_azure_v1_resource_group_id: Optional[str] = None, + recovery_azure_v2_resource_group_id: Optional[str] = None, + use_managed_disks: Optional[str] = None, + target_proximity_placement_group_id: Optional[str] = None, + target_availability_zone: Optional[str] = None, + target_vm_tags: Optional[dict[str, str]] = None, + target_managed_disk_tags: Optional[dict[str, str]] = None, + target_nic_tags: Optional[dict[str, str]] = None, + sql_server_license_type: Optional[Union[str, "_models.SqlServerLicenseType"]] = None, + vm_disks: Optional[list["_models.UpdateDiskInput"]] = 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) + self.instance_type = "InMageAzureV2" # type: ignore + + +class InMageBasePolicyDetails(PolicyProviderSpecificDetails, discriminator="InMageBasePolicyDetails"): + """Base class for the policies of providers using InMage replication. + + :ivar recovery_point_threshold_in_minutes: The recovery point threshold in minutes. + :vartype recovery_point_threshold_in_minutes: int + :ivar recovery_point_history: The duration in minutes until which the recovery points need to + be stored. + :vartype recovery_point_history: int + :ivar app_consistent_frequency_in_minutes: The app consistent snapshot frequency in minutes. + :vartype app_consistent_frequency_in_minutes: int + :ivar multi_vm_sync_status: A value indicating whether multi-VM sync has to be enabled. + :vartype multi_vm_sync_status: str + :ivar instance_type: Gets the class type. Overridden in derived classes. Required. Default + value is "InMageBasePolicyDetails". + :vartype instance_type: str + """ + + recovery_point_threshold_in_minutes: Optional[int] = rest_field( + name="recoveryPointThresholdInMinutes", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery point threshold in minutes.""" + recovery_point_history: Optional[int] = rest_field( + name="recoveryPointHistory", visibility=["read", "create", "update", "delete", "query"] + ) + """The duration in minutes until which the recovery points need to be stored.""" + app_consistent_frequency_in_minutes: Optional[int] = rest_field( + name="appConsistentFrequencyInMinutes", visibility=["read", "create", "update", "delete", "query"] + ) + """The app consistent snapshot frequency in minutes.""" + multi_vm_sync_status: Optional[str] = rest_field( + name="multiVmSyncStatus", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether multi-VM sync has to be enabled.""" + instance_type: Literal["InMageBasePolicyDetails"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets the class type. Overridden in derived classes. Required. Default value is + \"InMageBasePolicyDetails\".""" + + @overload + def __init__( + self, + *, + recovery_point_threshold_in_minutes: Optional[int] = None, + recovery_point_history: Optional[int] = None, + app_consistent_frequency_in_minutes: Optional[int] = None, + multi_vm_sync_status: 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) + self.instance_type = "InMageBasePolicyDetails" # type: ignore + + +class InMageDisableProtectionProviderSpecificInput( + DisableProtectionProviderSpecificInput, discriminator="InMage" +): # pylint: disable=name-too-long + """InMage disable protection provider specific input. + + :ivar replica_vm_deletion_status: A value indicating whether the replica VM should be destroyed + or retained. Values from Delete and Retain. + :vartype replica_vm_deletion_status: str + :ivar instance_type: The class type. Required. Default value is "InMage". + :vartype instance_type: str + """ + + replica_vm_deletion_status: Optional[str] = rest_field( + name="replicaVmDeletionStatus", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether the replica VM should be destroyed or retained. Values from Delete + and Retain.""" + instance_type: Literal["InMage"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The class type. Required. Default value is \"InMage\".""" + + @overload + def __init__( + self, + *, + replica_vm_deletion_status: 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) + self.instance_type = "InMage" # type: ignore + + +class InMageDiskDetails(_Model): + """VMware/Physical specific Disk Details. + + :ivar disk_id: The disk Id. + :vartype disk_id: str + :ivar disk_name: The disk name. + :vartype disk_name: str + :ivar disk_size_in_mb: The disk size in MB. + :vartype disk_size_in_mb: str + :ivar disk_type: Whether disk is system disk or data disk. + :vartype disk_type: str + :ivar disk_configuration: Whether disk is dynamic disk or basic disk. + :vartype disk_configuration: str + :ivar volume_list: Volumes of the disk. + :vartype volume_list: list[~azure.mgmt.recoveryservicessiterecovery.models.DiskVolumeDetails] + """ + + disk_id: Optional[str] = rest_field(name="diskId", visibility=["read", "create", "update", "delete", "query"]) + """The disk Id.""" + disk_name: Optional[str] = rest_field(name="diskName", visibility=["read", "create", "update", "delete", "query"]) + """The disk name.""" + disk_size_in_mb: Optional[str] = rest_field( + name="diskSizeInMB", visibility=["read", "create", "update", "delete", "query"] + ) + """The disk size in MB.""" + disk_type: Optional[str] = rest_field(name="diskType", visibility=["read", "create", "update", "delete", "query"]) + """Whether disk is system disk or data disk.""" + disk_configuration: Optional[str] = rest_field( + name="diskConfiguration", visibility=["read", "create", "update", "delete", "query"] + ) + """Whether disk is dynamic disk or basic disk.""" + volume_list: Optional[list["_models.DiskVolumeDetails"]] = rest_field( + name="volumeList", visibility=["read", "create", "update", "delete", "query"] + ) + """Volumes of the disk.""" + + @overload + def __init__( + self, + *, + disk_id: Optional[str] = None, + disk_name: Optional[str] = None, + disk_size_in_mb: Optional[str] = None, + disk_type: Optional[str] = None, + disk_configuration: Optional[str] = None, + volume_list: Optional[list["_models.DiskVolumeDetails"]] = 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 InMageDiskExclusionInput(_Model): + """DiskExclusionInput when doing enable protection of virtual machine in InMage provider. + + :ivar volume_options: The volume label based option for disk exclusion. + :vartype volume_options: + list[~azure.mgmt.recoveryservicessiterecovery.models.InMageVolumeExclusionOptions] + :ivar disk_signature_options: The guest disk signature based option for disk exclusion. + :vartype disk_signature_options: + list[~azure.mgmt.recoveryservicessiterecovery.models.InMageDiskSignatureExclusionOptions] + """ + + volume_options: Optional[list["_models.InMageVolumeExclusionOptions"]] = rest_field( + name="volumeOptions", visibility=["read", "create", "update", "delete", "query"] + ) + """The volume label based option for disk exclusion.""" + disk_signature_options: Optional[list["_models.InMageDiskSignatureExclusionOptions"]] = rest_field( + name="diskSignatureOptions", visibility=["read", "create", "update", "delete", "query"] + ) + """The guest disk signature based option for disk exclusion.""" + + @overload + def __init__( + self, + *, + volume_options: Optional[list["_models.InMageVolumeExclusionOptions"]] = None, + disk_signature_options: Optional[list["_models.InMageDiskSignatureExclusionOptions"]] = 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 InMageDiskSignatureExclusionOptions(_Model): + """Guest disk signature based disk exclusion option when doing enable protection of virtual + machine in InMage provider. + + :ivar disk_signature: The guest signature of disk to be excluded from replication. + :vartype disk_signature: str + """ + + disk_signature: Optional[str] = rest_field( + name="diskSignature", visibility=["read", "create", "update", "delete", "query"] + ) + """The guest signature of disk to be excluded from replication.""" + + @overload + def __init__( + self, + *, + disk_signature: 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 InMageEnableProtectionInput(EnableProtectionProviderSpecificInput, discriminator="InMage"): + """VMware Azure specific enable protection input. + + :ivar vm_friendly_name: The VM Name. + :vartype vm_friendly_name: str + :ivar master_target_id: The Master Target Id. Required. + :vartype master_target_id: str + :ivar process_server_id: The Process Server Id. Required. + :vartype process_server_id: str + :ivar retention_drive: The retention drive to use on the MT. Required. + :vartype retention_drive: str + :ivar run_as_account_id: The CS account Id. + :vartype run_as_account_id: str + :ivar multi_vm_group_id: The multi VM group Id. Required. + :vartype multi_vm_group_id: str + :ivar multi_vm_group_name: The multi VM group name. Required. + :vartype multi_vm_group_name: str + :ivar datastore_name: The target datastore name. + :vartype datastore_name: str + :ivar disk_exclusion_input: The enable disk exclusion input. + :vartype disk_exclusion_input: + ~azure.mgmt.recoveryservicessiterecovery.models.InMageDiskExclusionInput + :ivar disks_to_include: The disks to include list. + :vartype disks_to_include: list[str] + :ivar instance_type: The class type. Required. Default value is "InMage". + :vartype instance_type: str + """ + + vm_friendly_name: Optional[str] = rest_field( + name="vmFriendlyName", visibility=["read", "create", "update", "delete", "query"] + ) + """The VM Name.""" + master_target_id: str = rest_field( + name="masterTargetId", visibility=["read", "create", "update", "delete", "query"] + ) + """The Master Target Id. Required.""" + process_server_id: str = rest_field( + name="processServerId", visibility=["read", "create", "update", "delete", "query"] + ) + """The Process Server Id. Required.""" + retention_drive: str = rest_field(name="retentionDrive", visibility=["read", "create", "update", "delete", "query"]) + """The retention drive to use on the MT. Required.""" + run_as_account_id: Optional[str] = rest_field( + name="runAsAccountId", visibility=["read", "create", "update", "delete", "query"] + ) + """The CS account Id.""" + multi_vm_group_id: str = rest_field( + name="multiVmGroupId", visibility=["read", "create", "update", "delete", "query"] + ) + """The multi VM group Id. Required.""" + multi_vm_group_name: str = rest_field( + name="multiVmGroupName", visibility=["read", "create", "update", "delete", "query"] + ) + """The multi VM group name. Required.""" + datastore_name: Optional[str] = rest_field( + name="datastoreName", visibility=["read", "create", "update", "delete", "query"] + ) + """The target datastore name.""" + disk_exclusion_input: Optional["_models.InMageDiskExclusionInput"] = rest_field( + name="diskExclusionInput", visibility=["read", "create", "update", "delete", "query"] + ) + """The enable disk exclusion input.""" + disks_to_include: Optional[list[str]] = rest_field( + name="disksToInclude", visibility=["read", "create", "update", "delete", "query"] + ) + """The disks to include list.""" + instance_type: Literal["InMage"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The class type. Required. Default value is \"InMage\".""" + + @overload + def __init__( + self, + *, + master_target_id: str, + process_server_id: str, + retention_drive: str, + multi_vm_group_id: str, + multi_vm_group_name: str, + vm_friendly_name: Optional[str] = None, + run_as_account_id: Optional[str] = None, + datastore_name: Optional[str] = None, + disk_exclusion_input: Optional["_models.InMageDiskExclusionInput"] = None, + disks_to_include: 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) + self.instance_type = "InMage" # type: ignore + + +class InMageFabricSwitchProviderBlockingErrorDetails(_Model): # pylint: disable=name-too-long + """InMageFabric switch provider blocking error details. + + :ivar error_code: The error code. + :vartype error_code: str + :ivar error_message: The error message. + :vartype error_message: str + :ivar possible_causes: The possible causes. + :vartype possible_causes: str + :ivar recommended_action: The recommended action. + :vartype recommended_action: str + :ivar error_message_parameters: The error message parameters. + :vartype error_message_parameters: dict[str, str] + :ivar error_tags: The error tags. + :vartype error_tags: dict[str, str] + """ + + error_code: Optional[str] = rest_field(name="errorCode", visibility=["read"]) + """The error code.""" + error_message: Optional[str] = rest_field(name="errorMessage", visibility=["read"]) + """The error message.""" + possible_causes: Optional[str] = rest_field(name="possibleCauses", visibility=["read"]) + """The possible causes.""" + recommended_action: Optional[str] = rest_field(name="recommendedAction", visibility=["read"]) + """The recommended action.""" + error_message_parameters: Optional[dict[str, str]] = rest_field(name="errorMessageParameters", visibility=["read"]) + """The error message parameters.""" + error_tags: Optional[dict[str, str]] = rest_field(name="errorTags", visibility=["read"]) + """The error tags.""" + + +class InMagePolicyDetails(PolicyProviderSpecificDetails, discriminator="InMage"): + """InMage specific protection profile details. + + :ivar recovery_point_threshold_in_minutes: The recovery point threshold in minutes. + :vartype recovery_point_threshold_in_minutes: int + :ivar recovery_point_history: The duration in minutes until which the recovery points need to + be stored. + :vartype recovery_point_history: int + :ivar app_consistent_frequency_in_minutes: The app consistent snapshot frequency in minutes. + :vartype app_consistent_frequency_in_minutes: int + :ivar multi_vm_sync_status: A value indicating whether multi-VM sync has to be enabled. + :vartype multi_vm_sync_status: str + :ivar instance_type: Gets the class type. Overridden in derived classes. Required. Default + value is "InMage". + :vartype instance_type: str + """ + + recovery_point_threshold_in_minutes: Optional[int] = rest_field( + name="recoveryPointThresholdInMinutes", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery point threshold in minutes.""" + recovery_point_history: Optional[int] = rest_field( + name="recoveryPointHistory", visibility=["read", "create", "update", "delete", "query"] + ) + """The duration in minutes until which the recovery points need to be stored.""" + app_consistent_frequency_in_minutes: Optional[int] = rest_field( + name="appConsistentFrequencyInMinutes", visibility=["read", "create", "update", "delete", "query"] + ) + """The app consistent snapshot frequency in minutes.""" + multi_vm_sync_status: Optional[str] = rest_field( + name="multiVmSyncStatus", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether multi-VM sync has to be enabled.""" + instance_type: Literal["InMage"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets the class type. Overridden in derived classes. Required. Default value is \"InMage\".""" + + @overload + def __init__( + self, + *, + recovery_point_threshold_in_minutes: Optional[int] = None, + recovery_point_history: Optional[int] = None, + app_consistent_frequency_in_minutes: Optional[int] = None, + multi_vm_sync_status: 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) + self.instance_type = "InMage" # type: ignore + + +class InMagePolicyInput(PolicyProviderSpecificInput, discriminator="InMage"): + """VMWare Azure specific protection profile Input. + + :ivar recovery_point_threshold_in_minutes: The recovery point threshold in minutes. + :vartype recovery_point_threshold_in_minutes: int + :ivar recovery_point_history: The duration in minutes until which the recovery points need to + be stored. + :vartype recovery_point_history: int + :ivar app_consistent_frequency_in_minutes: The app consistent snapshot frequency (in minutes). + :vartype app_consistent_frequency_in_minutes: int + :ivar multi_vm_sync_status: A value indicating whether multi-VM sync has to be enabled. Value + should be 'Enabled' or 'Disabled'. Required. Known values are: "Enable" and "Disable". + :vartype multi_vm_sync_status: str or + ~azure.mgmt.recoveryservicessiterecovery.models.SetMultiVmSyncStatus + :ivar instance_type: The class type. Required. Default value is "InMage". + :vartype instance_type: str + """ + + recovery_point_threshold_in_minutes: Optional[int] = rest_field( + name="recoveryPointThresholdInMinutes", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery point threshold in minutes.""" + recovery_point_history: Optional[int] = rest_field( + name="recoveryPointHistory", visibility=["read", "create", "update", "delete", "query"] + ) + """The duration in minutes until which the recovery points need to be stored.""" + app_consistent_frequency_in_minutes: Optional[int] = rest_field( + name="appConsistentFrequencyInMinutes", visibility=["read", "create", "update", "delete", "query"] + ) + """The app consistent snapshot frequency (in minutes).""" + multi_vm_sync_status: Union[str, "_models.SetMultiVmSyncStatus"] = rest_field( + name="multiVmSyncStatus", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether multi-VM sync has to be enabled. Value should be 'Enabled' or + 'Disabled'. Required. Known values are: \"Enable\" and \"Disable\".""" + instance_type: Literal["InMage"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The class type. Required. Default value is \"InMage\".""" + + @overload + def __init__( + self, + *, + multi_vm_sync_status: Union[str, "_models.SetMultiVmSyncStatus"], + recovery_point_threshold_in_minutes: Optional[int] = None, + recovery_point_history: Optional[int] = None, + app_consistent_frequency_in_minutes: 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) + self.instance_type = "InMage" # type: ignore + + +class InMageProtectedDiskDetails(_Model): + """InMage protected disk details. + + :ivar disk_id: The disk id. + :vartype disk_id: str + :ivar disk_name: The disk name. + :vartype disk_name: str + :ivar protection_stage: The protection stage. + :vartype protection_stage: str + :ivar health_error_code: The health error code for the disk. + :vartype health_error_code: str + :ivar rpo_in_seconds: The RPO in seconds. + :vartype rpo_in_seconds: int + :ivar resync_required: A value indicating whether resync is required for this disk. + :vartype resync_required: str + :ivar resync_progress_percentage: The resync progress percentage. + :vartype resync_progress_percentage: int + :ivar resync_duration_in_seconds: The resync duration in seconds. + :vartype resync_duration_in_seconds: int + :ivar disk_capacity_in_bytes: The disk capacity in bytes. + :vartype disk_capacity_in_bytes: int + :ivar file_system_capacity_in_bytes: The file system capacity in bytes. + :vartype file_system_capacity_in_bytes: int + :ivar source_data_in_mb: The source data transit in MB. + :vartype source_data_in_mb: float + :ivar ps_data_in_mb: The PS data transit in MB. + :vartype ps_data_in_mb: float + :ivar target_data_in_mb: The target data transit in MB. + :vartype target_data_in_mb: float + :ivar disk_resized: A value indicating whether disk is resized. + :vartype disk_resized: str + :ivar last_rpo_calculated_time: The last RPO calculated time. + :vartype last_rpo_calculated_time: ~datetime.datetime + :ivar resync_processed_bytes: The resync processed bytes. + :vartype resync_processed_bytes: int + :ivar resync_total_transferred_bytes: The resync total transferred bytes. + :vartype resync_total_transferred_bytes: int + :ivar resync_last15_minutes_transferred_bytes: The resync last 15 minutes transferred bytes. + :vartype resync_last15_minutes_transferred_bytes: int + :ivar resync_last_data_transfer_time_utc: The last data transfer time in UTC. + :vartype resync_last_data_transfer_time_utc: ~datetime.datetime + :ivar resync_start_time: The resync start time. + :vartype resync_start_time: ~datetime.datetime + :ivar progress_health: The Progress Health. + :vartype progress_health: str + :ivar progress_status: The Progress Status. + :vartype progress_status: str + """ + + disk_id: Optional[str] = rest_field(name="diskId", visibility=["read", "create", "update", "delete", "query"]) + """The disk id.""" + disk_name: Optional[str] = rest_field(name="diskName", visibility=["read", "create", "update", "delete", "query"]) + """The disk name.""" + protection_stage: Optional[str] = rest_field( + name="protectionStage", visibility=["read", "create", "update", "delete", "query"] + ) + """The protection stage.""" + health_error_code: Optional[str] = rest_field( + name="healthErrorCode", visibility=["read", "create", "update", "delete", "query"] + ) + """The health error code for the disk.""" + rpo_in_seconds: Optional[int] = rest_field( + name="rpoInSeconds", visibility=["read", "create", "update", "delete", "query"] + ) + """The RPO in seconds.""" + resync_required: Optional[str] = rest_field( + name="resyncRequired", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether resync is required for this disk.""" + resync_progress_percentage: Optional[int] = rest_field( + name="resyncProgressPercentage", visibility=["read", "create", "update", "delete", "query"] + ) + """The resync progress percentage.""" + resync_duration_in_seconds: Optional[int] = rest_field( + name="resyncDurationInSeconds", visibility=["read", "create", "update", "delete", "query"] + ) + """The resync duration in seconds.""" + disk_capacity_in_bytes: Optional[int] = rest_field( + name="diskCapacityInBytes", visibility=["read", "create", "update", "delete", "query"] + ) + """The disk capacity in bytes.""" + file_system_capacity_in_bytes: Optional[int] = rest_field( + name="fileSystemCapacityInBytes", visibility=["read", "create", "update", "delete", "query"] + ) + """The file system capacity in bytes.""" + source_data_in_mb: Optional[float] = rest_field( + name="sourceDataInMB", visibility=["read", "create", "update", "delete", "query"] + ) + """The source data transit in MB.""" + ps_data_in_mb: Optional[float] = rest_field( + name="psDataInMB", visibility=["read", "create", "update", "delete", "query"] + ) + """The PS data transit in MB.""" + target_data_in_mb: Optional[float] = rest_field( + name="targetDataInMB", visibility=["read", "create", "update", "delete", "query"] + ) + """The target data transit in MB.""" + disk_resized: Optional[str] = rest_field( + name="diskResized", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether disk is resized.""" + last_rpo_calculated_time: Optional[datetime.datetime] = rest_field( + name="lastRpoCalculatedTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The last RPO calculated time.""" + resync_processed_bytes: Optional[int] = rest_field( + name="resyncProcessedBytes", visibility=["read", "create", "update", "delete", "query"] + ) + """The resync processed bytes.""" + resync_total_transferred_bytes: Optional[int] = rest_field( + name="resyncTotalTransferredBytes", visibility=["read", "create", "update", "delete", "query"] + ) + """The resync total transferred bytes.""" + resync_last15_minutes_transferred_bytes: Optional[int] = rest_field( + name="resyncLast15MinutesTransferredBytes", visibility=["read", "create", "update", "delete", "query"] + ) + """The resync last 15 minutes transferred bytes.""" + resync_last_data_transfer_time_utc: Optional[datetime.datetime] = rest_field( + name="resyncLastDataTransferTimeUTC", + visibility=["read", "create", "update", "delete", "query"], + format="rfc3339", + ) + """The last data transfer time in UTC.""" + resync_start_time: Optional[datetime.datetime] = rest_field( + name="resyncStartTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The resync start time.""" + progress_health: Optional[str] = rest_field( + name="progressHealth", visibility=["read", "create", "update", "delete", "query"] + ) + """The Progress Health.""" + progress_status: Optional[str] = rest_field( + name="progressStatus", visibility=["read", "create", "update", "delete", "query"] + ) + """The Progress Status.""" + + @overload + def __init__( + self, + *, + disk_id: Optional[str] = None, + disk_name: Optional[str] = None, + protection_stage: Optional[str] = None, + health_error_code: Optional[str] = None, + rpo_in_seconds: Optional[int] = None, + resync_required: Optional[str] = None, + resync_progress_percentage: Optional[int] = None, + resync_duration_in_seconds: Optional[int] = None, + disk_capacity_in_bytes: Optional[int] = None, + file_system_capacity_in_bytes: Optional[int] = None, + source_data_in_mb: Optional[float] = None, + ps_data_in_mb: Optional[float] = None, + target_data_in_mb: Optional[float] = None, + disk_resized: Optional[str] = None, + last_rpo_calculated_time: Optional[datetime.datetime] = None, + resync_processed_bytes: Optional[int] = None, + resync_total_transferred_bytes: Optional[int] = None, + resync_last15_minutes_transferred_bytes: Optional[int] = None, + resync_last_data_transfer_time_utc: Optional[datetime.datetime] = None, + resync_start_time: Optional[datetime.datetime] = None, + progress_health: Optional[str] = None, + progress_status: 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 InMageRcmAddDisksInput(AddDisksProviderSpecificInput, discriminator="InMageRcm"): + """InMageRcm add disk(s) input. + + :ivar disks: The list of disk details. Required. + :vartype disks: list[~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmDiskInput] + :ivar instance_type: The class type. Required. Default value is "InMageRcm". + :vartype instance_type: str + """ + + disks: list["_models.InMageRcmDiskInput"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The list of disk details. Required.""" + instance_type: Literal["InMageRcm"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The class type. Required. Default value is \"InMageRcm\".""" + + @overload + def __init__( + self, + *, + disks: list["_models.InMageRcmDiskInput"], + ) -> 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) + self.instance_type = "InMageRcm" # type: ignore + + +class InMageRcmAgentReinstallBlockingErrorDetails(_Model): # pylint: disable=name-too-long + """InMageRcm source agent reinstall blocking error details. + + :ivar error_code: error code. + :vartype error_code: str + :ivar error_message: error message. + :vartype error_message: str + :ivar possible_causes: possible causes. + :vartype possible_causes: str + :ivar recommended_action: recommended action. + :vartype recommended_action: str + :ivar error_message_parameters: error message parameters. + :vartype error_message_parameters: dict[str, str] + :ivar error_tags: error tags. + :vartype error_tags: dict[str, str] + """ + + error_code: Optional[str] = rest_field(name="errorCode", visibility=["read", "create", "update", "delete", "query"]) + """error code.""" + error_message: Optional[str] = rest_field( + name="errorMessage", visibility=["read", "create", "update", "delete", "query"] + ) + """error message.""" + possible_causes: Optional[str] = rest_field( + name="possibleCauses", visibility=["read", "create", "update", "delete", "query"] + ) + """possible causes.""" + recommended_action: Optional[str] = rest_field( + name="recommendedAction", visibility=["read", "create", "update", "delete", "query"] + ) + """recommended action.""" + error_message_parameters: Optional[dict[str, str]] = rest_field( + name="errorMessageParameters", visibility=["read", "create", "update", "delete", "query"] + ) + """error message parameters.""" + error_tags: Optional[dict[str, str]] = rest_field( + name="errorTags", visibility=["read", "create", "update", "delete", "query"] + ) + """error tags.""" + + @overload + def __init__( + self, + *, + error_code: Optional[str] = None, + error_message: Optional[str] = None, + possible_causes: Optional[str] = None, + recommended_action: Optional[str] = None, + error_message_parameters: Optional[dict[str, str]] = None, + error_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 InMageRcmAgentUpgradeBlockingErrorDetails(_Model): # pylint: disable=name-too-long + """InMageRcm source agent upgrade blocking error details. + + :ivar error_code: The error code. + :vartype error_code: str + :ivar error_message: The error message. + :vartype error_message: str + :ivar possible_causes: The possible causes. + :vartype possible_causes: str + :ivar recommended_action: The recommended action. + :vartype recommended_action: str + :ivar error_message_parameters: The error message parameters. + :vartype error_message_parameters: dict[str, str] + :ivar error_tags: The error tags. + :vartype error_tags: dict[str, str] + """ + + error_code: Optional[str] = rest_field(name="errorCode", visibility=["read"]) + """The error code.""" + error_message: Optional[str] = rest_field(name="errorMessage", visibility=["read"]) + """The error message.""" + possible_causes: Optional[str] = rest_field(name="possibleCauses", visibility=["read"]) + """The possible causes.""" + recommended_action: Optional[str] = rest_field(name="recommendedAction", visibility=["read"]) + """The recommended action.""" + error_message_parameters: Optional[dict[str, str]] = rest_field(name="errorMessageParameters", visibility=["read"]) + """The error message parameters.""" + error_tags: Optional[dict[str, str]] = rest_field(name="errorTags", visibility=["read"]) + """The error tags.""" + + +class InMageRcmApplianceDetails(_Model): + """InMageRcm appliance details. + + :ivar id: The appliance Id. + :vartype id: str + :ivar name: The appliance name. + :vartype name: str + :ivar fabric_arm_id: The fabric ARM Id. + :vartype fabric_arm_id: str + :ivar process_server: The process server. + :vartype process_server: ~azure.mgmt.recoveryservicessiterecovery.models.ProcessServerDetails + :ivar rcm_proxy: The of RCM proxy. + :vartype rcm_proxy: ~azure.mgmt.recoveryservicessiterecovery.models.RcmProxyDetails + :ivar push_installer: The push installer. + :vartype push_installer: ~azure.mgmt.recoveryservicessiterecovery.models.PushInstallerDetails + :ivar replication_agent: The replication agent. + :vartype replication_agent: + ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationAgentDetails + :ivar reprotect_agent: The reprotect agent. + :vartype reprotect_agent: ~azure.mgmt.recoveryservicessiterecovery.models.ReprotectAgentDetails + :ivar mars_agent: The Mars agent. + :vartype mars_agent: ~azure.mgmt.recoveryservicessiterecovery.models.MarsAgentDetails + :ivar dra: The DRA. + :vartype dra: ~azure.mgmt.recoveryservicessiterecovery.models.DraDetails + :ivar switch_provider_blocking_error_details: The switch provider blocking error information. + :vartype switch_provider_blocking_error_details: + list[~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmFabricSwitchProviderBlockingErrorDetails] + """ + + id: Optional[str] = rest_field(visibility=["read"]) + """The appliance Id.""" + name: Optional[str] = rest_field(visibility=["read"]) + """The appliance name.""" + fabric_arm_id: Optional[str] = rest_field(name="fabricArmId", visibility=["read"]) + """The fabric ARM Id.""" + process_server: Optional["_models.ProcessServerDetails"] = rest_field(name="processServer", visibility=["read"]) + """The process server.""" + rcm_proxy: Optional["_models.RcmProxyDetails"] = rest_field(name="rcmProxy", visibility=["read"]) + """The of RCM proxy.""" + push_installer: Optional["_models.PushInstallerDetails"] = rest_field(name="pushInstaller", visibility=["read"]) + """The push installer.""" + replication_agent: Optional["_models.ReplicationAgentDetails"] = rest_field( + name="replicationAgent", visibility=["read"] + ) + """The replication agent.""" + reprotect_agent: Optional["_models.ReprotectAgentDetails"] = rest_field(name="reprotectAgent", visibility=["read"]) + """The reprotect agent.""" + mars_agent: Optional["_models.MarsAgentDetails"] = rest_field(name="marsAgent", visibility=["read"]) + """The Mars agent.""" + dra: Optional["_models.DraDetails"] = rest_field(visibility=["read"]) + """The DRA.""" + switch_provider_blocking_error_details: Optional[ + list["_models.InMageRcmFabricSwitchProviderBlockingErrorDetails"] + ] = rest_field(name="switchProviderBlockingErrorDetails", visibility=["read"]) + """The switch provider blocking error information.""" + + +class InMageRcmApplianceSpecificDetails(ApplianceSpecificDetails, discriminator="InMageRcm"): + """InMageRcm appliance specific details. + + :ivar appliances: The list of appliances. + :vartype appliances: + list[~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmApplianceDetails] + :ivar instance_type: Gets the class type. Overridden in derived classes. Required. Default + value is "InMageRcm". + :vartype instance_type: str + """ + + appliances: Optional[list["_models.InMageRcmApplianceDetails"]] = rest_field(visibility=["read"]) + """The list of appliances.""" + instance_type: Literal["InMageRcm"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets the class type. Overridden in derived classes. Required. Default value is \"InMageRcm\".""" + + @overload + def __init__( + self, + ) -> 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) + self.instance_type = "InMageRcm" # type: ignore + + +class InMageRcmApplyRecoveryPointInput(ApplyRecoveryPointProviderSpecificInput, discriminator="InMageRcm"): + """ApplyRecoveryPoint input specific to InMageRcm provider. + + :ivar recovery_point_id: The recovery point Id. Required. + :vartype recovery_point_id: str + :ivar instance_type: The class type. Required. Default value is "InMageRcm". + :vartype instance_type: str + """ + + recovery_point_id: str = rest_field( + name="recoveryPointId", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery point Id. Required.""" + instance_type: Literal["InMageRcm"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The class type. Required. Default value is \"InMageRcm\".""" + + @overload + def __init__( + self, + *, + recovery_point_id: str, + ) -> 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) + self.instance_type = "InMageRcm" # type: ignore + + +class InMageRcmDiscoveredProtectedVmDetails(_Model): + """InMageRcm discovered protected VM details. + + :ivar v_center_id: The VCenter Id. + :vartype v_center_id: str + :ivar v_center_fqdn: The VCenter fqdn. + :vartype v_center_fqdn: str + :ivar datastores: The list of datastores. + :vartype datastores: list[str] + :ivar ip_addresses: The list of IP addresses. + :vartype ip_addresses: list[str] + :ivar vmware_tools_status: The VMware tools status. + :vartype vmware_tools_status: str + :ivar power_status: The VM power status. + :vartype power_status: str + :ivar vm_fqdn: The VM fqdn. + :vartype vm_fqdn: str + :ivar os_name: The VM's OS name. + :vartype os_name: str + :ivar created_timestamp: The SDS created timestamp. + :vartype created_timestamp: ~datetime.datetime + :ivar updated_timestamp: The SDS updated timestamp. + :vartype updated_timestamp: ~datetime.datetime + :ivar is_deleted: A value indicating whether the VM is deleted. + :vartype is_deleted: bool + :ivar last_discovery_time_in_utc: The last time when SDS information discovered in SRS. + :vartype last_discovery_time_in_utc: ~datetime.datetime + """ + + v_center_id: Optional[str] = rest_field(name="vCenterId", visibility=["read"]) + """The VCenter Id.""" + v_center_fqdn: Optional[str] = rest_field(name="vCenterFqdn", visibility=["read"]) + """The VCenter fqdn.""" + datastores: Optional[list[str]] = rest_field(visibility=["read"]) + """The list of datastores.""" + ip_addresses: Optional[list[str]] = rest_field(name="ipAddresses", visibility=["read"]) + """The list of IP addresses.""" + vmware_tools_status: Optional[str] = rest_field(name="vmwareToolsStatus", visibility=["read"]) + """The VMware tools status.""" + power_status: Optional[str] = rest_field(name="powerStatus", visibility=["read"]) + """The VM power status.""" + vm_fqdn: Optional[str] = rest_field(name="vmFqdn", visibility=["read"]) + """The VM fqdn.""" + os_name: Optional[str] = rest_field(name="osName", visibility=["read"]) + """The VM's OS name.""" + created_timestamp: Optional[datetime.datetime] = rest_field( + name="createdTimestamp", visibility=["read"], format="rfc3339" + ) + """The SDS created timestamp.""" + updated_timestamp: Optional[datetime.datetime] = rest_field( + name="updatedTimestamp", visibility=["read"], format="rfc3339" + ) + """The SDS updated timestamp.""" + is_deleted: Optional[bool] = rest_field(name="isDeleted", visibility=["read"]) + """A value indicating whether the VM is deleted.""" + last_discovery_time_in_utc: Optional[datetime.datetime] = rest_field( + name="lastDiscoveryTimeInUtc", visibility=["read"], format="rfc3339" + ) + """The last time when SDS information discovered in SRS.""" + + +class InMageRcmDiskInput(_Model): + """InMageRcm disk input. + + :ivar disk_id: The disk Id. Required. + :vartype disk_id: str + :ivar log_storage_account_id: The log storage account ARM Id. Required. + :vartype log_storage_account_id: str + :ivar disk_type: The disk type. Required. Known values are: "Standard_LRS", "Premium_LRS", + "StandardSSD_LRS", "PremiumV2_LRS", "UltraSSD_LRS", "StandardSSD_ZRS", and "Premium_ZRS". + :vartype disk_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.DiskAccountType + :ivar disk_encryption_set_id: The DiskEncryptionSet ARM Id. + :vartype disk_encryption_set_id: str + :ivar sector_size_in_bytes: The logical sector size (in bytes), 512 by default. + :vartype sector_size_in_bytes: int + :ivar iops: The number of IOPS allowed for Premium V2 and Ultra disks. + :vartype iops: int + :ivar throughput_in_mbps: The total throughput in Mbps for Premium V2 and Ultra disks. + :vartype throughput_in_mbps: int + :ivar disk_size_in_gb: The target disk size in GB. + :vartype disk_size_in_gb: int + """ + + disk_id: str = rest_field(name="diskId", visibility=["read", "create", "update", "delete", "query"]) + """The disk Id. Required.""" + log_storage_account_id: str = rest_field( + name="logStorageAccountId", visibility=["read", "create", "update", "delete", "query"] + ) + """The log storage account ARM Id. Required.""" + disk_type: Union[str, "_models.DiskAccountType"] = rest_field( + name="diskType", visibility=["read", "create", "update", "delete", "query"] + ) + """The disk type. Required. Known values are: \"Standard_LRS\", \"Premium_LRS\", + \"StandardSSD_LRS\", \"PremiumV2_LRS\", \"UltraSSD_LRS\", \"StandardSSD_ZRS\", and + \"Premium_ZRS\".""" + disk_encryption_set_id: Optional[str] = rest_field( + name="diskEncryptionSetId", visibility=["read", "create", "update", "delete", "query"] + ) + """The DiskEncryptionSet ARM Id.""" + sector_size_in_bytes: Optional[int] = rest_field( + name="sectorSizeInBytes", visibility=["read", "create", "update", "delete", "query"] + ) + """The logical sector size (in bytes), 512 by default.""" + iops: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The number of IOPS allowed for Premium V2 and Ultra disks.""" + throughput_in_mbps: Optional[int] = rest_field( + name="throughputInMbps", visibility=["read", "create", "update", "delete", "query"] + ) + """The total throughput in Mbps for Premium V2 and Ultra disks.""" + disk_size_in_gb: Optional[int] = rest_field( + name="diskSizeInGB", visibility=["read", "create", "update", "delete", "query"] + ) + """The target disk size in GB.""" + + @overload + def __init__( + self, + *, + disk_id: str, + log_storage_account_id: str, + disk_type: Union[str, "_models.DiskAccountType"], + disk_encryption_set_id: Optional[str] = None, + sector_size_in_bytes: Optional[int] = None, + iops: Optional[int] = None, + throughput_in_mbps: Optional[int] = None, + disk_size_in_gb: 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 InMageRcmDisksDefaultInput(_Model): + """InMageRcm disk input. + + :ivar log_storage_account_id: The log storage account ARM Id. Required. + :vartype log_storage_account_id: str + :ivar disk_type: The disk type. Required. Known values are: "Standard_LRS", "Premium_LRS", + "StandardSSD_LRS", "PremiumV2_LRS", "UltraSSD_LRS", "StandardSSD_ZRS", and "Premium_ZRS". + :vartype disk_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.DiskAccountType + :ivar disk_encryption_set_id: The DiskEncryptionSet ARM Id. + :vartype disk_encryption_set_id: str + :ivar sector_size_in_bytes: The logical sector size (in bytes), 512 by default. + :vartype sector_size_in_bytes: int + :ivar iops: The number of IOPS allowed for Premium V2 and Ultra disks. + :vartype iops: int + :ivar throughput_in_mbps: The total throughput in Mbps for Premium V2 and Ultra disks. + :vartype throughput_in_mbps: int + :ivar disk_size_in_gb: The target disk size in GB. + :vartype disk_size_in_gb: int + """ + + log_storage_account_id: str = rest_field( + name="logStorageAccountId", visibility=["read", "create", "update", "delete", "query"] + ) + """The log storage account ARM Id. Required.""" + disk_type: Union[str, "_models.DiskAccountType"] = rest_field( + name="diskType", visibility=["read", "create", "update", "delete", "query"] + ) + """The disk type. Required. Known values are: \"Standard_LRS\", \"Premium_LRS\", + \"StandardSSD_LRS\", \"PremiumV2_LRS\", \"UltraSSD_LRS\", \"StandardSSD_ZRS\", and + \"Premium_ZRS\".""" + disk_encryption_set_id: Optional[str] = rest_field( + name="diskEncryptionSetId", visibility=["read", "create", "update", "delete", "query"] + ) + """The DiskEncryptionSet ARM Id.""" + sector_size_in_bytes: Optional[int] = rest_field( + name="sectorSizeInBytes", visibility=["read", "create", "update", "delete", "query"] + ) + """The logical sector size (in bytes), 512 by default.""" + iops: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The number of IOPS allowed for Premium V2 and Ultra disks.""" + throughput_in_mbps: Optional[int] = rest_field( + name="throughputInMbps", visibility=["read", "create", "update", "delete", "query"] + ) + """The total throughput in Mbps for Premium V2 and Ultra disks.""" + disk_size_in_gb: Optional[int] = rest_field( + name="diskSizeInGB", visibility=["read", "create", "update", "delete", "query"] + ) + """The target disk size in GB.""" + + @overload + def __init__( + self, + *, + log_storage_account_id: str, + disk_type: Union[str, "_models.DiskAccountType"], + disk_encryption_set_id: Optional[str] = None, + sector_size_in_bytes: Optional[int] = None, + iops: Optional[int] = None, + throughput_in_mbps: Optional[int] = None, + disk_size_in_gb: 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 InMageRcmEnableProtectionInput(EnableProtectionProviderSpecificInput, discriminator="InMageRcm"): + """InMageRcm specific enable protection input. + + :ivar fabric_discovery_machine_id: The ARM Id of discovered machine. Required. + :vartype fabric_discovery_machine_id: str + :ivar disks_to_include: The disks to include list. + :vartype disks_to_include: + list[~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmDiskInput] + :ivar disks_default: The default disk input. + :vartype disks_default: + ~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmDisksDefaultInput + :ivar target_resource_group_id: The target resource group ARM Id. Required. + :vartype target_resource_group_id: str + :ivar target_network_id: The selected target network ARM Id. + :vartype target_network_id: str + :ivar test_network_id: The selected test network ARM Id. + :vartype test_network_id: str + :ivar target_subnet_name: The selected target subnet name. + :vartype target_subnet_name: str + :ivar test_subnet_name: The selected test subnet name. + :vartype test_subnet_name: str + :ivar target_vm_name: The target VM name. + :vartype target_vm_name: str + :ivar target_vm_size: The target VM size. + :vartype target_vm_size: str + :ivar license_type: The license type. Known values are: "NotSpecified", "NoLicenseType", and + "WindowsServer". + :vartype license_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.LicenseType + :ivar target_availability_set_id: The target availability set ARM Id. + :vartype target_availability_set_id: str + :ivar target_availability_zone: The target availability zone. + :vartype target_availability_zone: str + :ivar target_proximity_placement_group_id: The target proximity placement group Id. + :vartype target_proximity_placement_group_id: str + :ivar target_boot_diagnostics_storage_account_id: The target boot diagnostics storage account + ARM Id. + :vartype target_boot_diagnostics_storage_account_id: str + :ivar run_as_account_id: The run-as account Id. + :vartype run_as_account_id: str + :ivar process_server_id: The process server Id. Required. + :vartype process_server_id: str + :ivar multi_vm_group_name: The multi VM group name. + :vartype multi_vm_group_name: str + :ivar sql_server_license_type: The SQL Server license type. Known values are: "NotSpecified", + "NoLicenseType", "PAYG", and "AHUB". + :vartype sql_server_license_type: str or + ~azure.mgmt.recoveryservicessiterecovery.models.SqlServerLicenseType + :ivar linux_license_type: The license type for Linux VM's. Known values are: "NotSpecified", + "NoLicenseType", and "LinuxServer". + :vartype linux_license_type: str or + ~azure.mgmt.recoveryservicessiterecovery.models.LinuxLicenseType + :ivar target_vm_tags: The target VM tags. + :vartype target_vm_tags: + list[~azure.mgmt.recoveryservicessiterecovery.models.UserCreatedResourceTag] + :ivar seed_managed_disk_tags: The tags for the seed managed disks. + :vartype seed_managed_disk_tags: + list[~azure.mgmt.recoveryservicessiterecovery.models.UserCreatedResourceTag] + :ivar target_managed_disk_tags: The tags for the target managed disks. + :vartype target_managed_disk_tags: + list[~azure.mgmt.recoveryservicessiterecovery.models.UserCreatedResourceTag] + :ivar target_nic_tags: The tags for the target NICs. + :vartype target_nic_tags: + list[~azure.mgmt.recoveryservicessiterecovery.models.UserCreatedResourceTag] + :ivar user_selected_os_name: The OS name selected by user. + :vartype user_selected_os_name: str + :ivar target_vm_security_profile: The target VM security profile. + :vartype target_vm_security_profile: + ~azure.mgmt.recoveryservicessiterecovery.models.SecurityProfileProperties + :ivar target_capacity_reservation_group_id: The target capacity reservation group ARM Id. + :vartype target_capacity_reservation_group_id: str + :ivar instance_type: The class type. Required. Default value is "InMageRcm". + :vartype instance_type: str + """ + + fabric_discovery_machine_id: str = rest_field( + name="fabricDiscoveryMachineId", visibility=["read", "create", "update", "delete", "query"] + ) + """The ARM Id of discovered machine. Required.""" + disks_to_include: Optional[list["_models.InMageRcmDiskInput"]] = rest_field( + name="disksToInclude", visibility=["read", "create", "update", "delete", "query"] + ) + """The disks to include list.""" + disks_default: Optional["_models.InMageRcmDisksDefaultInput"] = rest_field( + name="disksDefault", visibility=["read", "create", "update", "delete", "query"] + ) + """The default disk input.""" + target_resource_group_id: str = rest_field( + name="targetResourceGroupId", visibility=["read", "create", "update", "delete", "query"] + ) + """The target resource group ARM Id. Required.""" + target_network_id: Optional[str] = rest_field( + name="targetNetworkId", visibility=["read", "create", "update", "delete", "query"] + ) + """The selected target network ARM Id.""" + test_network_id: Optional[str] = rest_field( + name="testNetworkId", visibility=["read", "create", "update", "delete", "query"] + ) + """The selected test network ARM Id.""" + target_subnet_name: Optional[str] = rest_field( + name="targetSubnetName", visibility=["read", "create", "update", "delete", "query"] + ) + """The selected target subnet name.""" + test_subnet_name: Optional[str] = rest_field( + name="testSubnetName", visibility=["read", "create", "update", "delete", "query"] + ) + """The selected test subnet name.""" + target_vm_name: Optional[str] = rest_field( + name="targetVmName", visibility=["read", "create", "update", "delete", "query"] + ) + """The target VM name.""" + target_vm_size: Optional[str] = rest_field( + name="targetVmSize", visibility=["read", "create", "update", "delete", "query"] + ) + """The target VM size.""" + license_type: Optional[Union[str, "_models.LicenseType"]] = rest_field( + name="licenseType", visibility=["read", "create", "update", "delete", "query"] + ) + """The license type. Known values are: \"NotSpecified\", \"NoLicenseType\", and \"WindowsServer\".""" + target_availability_set_id: Optional[str] = rest_field( + name="targetAvailabilitySetId", visibility=["read", "create", "update", "delete", "query"] + ) + """The target availability set ARM Id.""" + target_availability_zone: Optional[str] = rest_field( + name="targetAvailabilityZone", visibility=["read", "create", "update", "delete", "query"] + ) + """The target availability zone.""" + target_proximity_placement_group_id: Optional[str] = rest_field( + name="targetProximityPlacementGroupId", visibility=["read", "create", "update", "delete", "query"] + ) + """The target proximity placement group Id.""" + target_boot_diagnostics_storage_account_id: Optional[str] = rest_field( + name="targetBootDiagnosticsStorageAccountId", visibility=["read", "create", "update", "delete", "query"] + ) + """The target boot diagnostics storage account ARM Id.""" + run_as_account_id: Optional[str] = rest_field( + name="runAsAccountId", visibility=["read", "create", "update", "delete", "query"] + ) + """The run-as account Id.""" + process_server_id: str = rest_field( + name="processServerId", visibility=["read", "create", "update", "delete", "query"] + ) + """The process server Id. Required.""" + multi_vm_group_name: Optional[str] = rest_field( + name="multiVmGroupName", visibility=["read", "create", "update", "delete", "query"] + ) + """The multi VM group name.""" + sql_server_license_type: Optional[Union[str, "_models.SqlServerLicenseType"]] = rest_field( + name="sqlServerLicenseType", visibility=["read", "create", "update", "delete", "query"] + ) + """The SQL Server license type. Known values are: \"NotSpecified\", \"NoLicenseType\", \"PAYG\", + and \"AHUB\".""" + linux_license_type: Optional[Union[str, "_models.LinuxLicenseType"]] = rest_field( + name="linuxLicenseType", visibility=["read", "create", "update", "delete", "query"] + ) + """The license type for Linux VM's. Known values are: \"NotSpecified\", \"NoLicenseType\", and + \"LinuxServer\".""" + target_vm_tags: Optional[list["_models.UserCreatedResourceTag"]] = rest_field( + name="targetVmTags", visibility=["read", "create", "update", "delete", "query"] + ) + """The target VM tags.""" + seed_managed_disk_tags: Optional[list["_models.UserCreatedResourceTag"]] = rest_field( + name="seedManagedDiskTags", visibility=["read", "create", "update", "delete", "query"] + ) + """The tags for the seed managed disks.""" + target_managed_disk_tags: Optional[list["_models.UserCreatedResourceTag"]] = rest_field( + name="targetManagedDiskTags", visibility=["read", "create", "update", "delete", "query"] + ) + """The tags for the target managed disks.""" + target_nic_tags: Optional[list["_models.UserCreatedResourceTag"]] = rest_field( + name="targetNicTags", visibility=["read", "create", "update", "delete", "query"] + ) + """The tags for the target NICs.""" + user_selected_os_name: Optional[str] = rest_field( + name="userSelectedOSName", visibility=["read", "create", "update", "delete", "query"] + ) + """The OS name selected by user.""" + target_vm_security_profile: Optional["_models.SecurityProfileProperties"] = rest_field( + name="targetVmSecurityProfile", visibility=["read", "create", "update", "delete", "query"] + ) + """The target VM security profile.""" + target_capacity_reservation_group_id: Optional[str] = rest_field( + name="targetCapacityReservationGroupId", visibility=["read", "create", "update", "delete", "query"] + ) + """The target capacity reservation group ARM Id.""" + instance_type: Literal["InMageRcm"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The class type. Required. Default value is \"InMageRcm\".""" + + @overload + def __init__( # pylint: disable=too-many-locals + self, + *, + fabric_discovery_machine_id: str, + target_resource_group_id: str, + process_server_id: str, + disks_to_include: Optional[list["_models.InMageRcmDiskInput"]] = None, + disks_default: Optional["_models.InMageRcmDisksDefaultInput"] = None, + target_network_id: Optional[str] = None, + test_network_id: Optional[str] = None, + target_subnet_name: Optional[str] = None, + test_subnet_name: Optional[str] = None, + target_vm_name: Optional[str] = None, + target_vm_size: Optional[str] = None, + license_type: Optional[Union[str, "_models.LicenseType"]] = None, + target_availability_set_id: Optional[str] = None, + target_availability_zone: Optional[str] = None, + target_proximity_placement_group_id: Optional[str] = None, + target_boot_diagnostics_storage_account_id: Optional[str] = None, + run_as_account_id: Optional[str] = None, + multi_vm_group_name: Optional[str] = None, + sql_server_license_type: Optional[Union[str, "_models.SqlServerLicenseType"]] = None, + linux_license_type: Optional[Union[str, "_models.LinuxLicenseType"]] = None, + target_vm_tags: Optional[list["_models.UserCreatedResourceTag"]] = None, + seed_managed_disk_tags: Optional[list["_models.UserCreatedResourceTag"]] = None, + target_managed_disk_tags: Optional[list["_models.UserCreatedResourceTag"]] = None, + target_nic_tags: Optional[list["_models.UserCreatedResourceTag"]] = None, + user_selected_os_name: Optional[str] = None, + target_vm_security_profile: Optional["_models.SecurityProfileProperties"] = None, + target_capacity_reservation_group_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) + self.instance_type = "InMageRcm" # type: ignore + + +class InMageRcmEventDetails(EventProviderSpecificDetails, discriminator="InMageRcm"): + """Event details for InMageRcm provider. + + :ivar protected_item_name: The protected item name. + :vartype protected_item_name: str + :ivar vm_name: The protected item name. + :vartype vm_name: str + :ivar latest_agent_version: The latest agent version. + :vartype latest_agent_version: str + :ivar job_id: The job Id. + :vartype job_id: str + :ivar fabric_name: The fabric name. + :vartype fabric_name: str + :ivar appliance_name: The appliance name. + :vartype appliance_name: str + :ivar server_type: The server type. + :vartype server_type: str + :ivar component_display_name: The component display name. + :vartype component_display_name: str + :ivar instance_type: Gets the class type. Overridden in derived classes. Required. Default + value is "InMageRcm". + :vartype instance_type: str + """ + + protected_item_name: Optional[str] = rest_field(name="protectedItemName", visibility=["read"]) + """The protected item name.""" + vm_name: Optional[str] = rest_field(name="vmName", visibility=["read"]) + """The protected item name.""" + latest_agent_version: Optional[str] = rest_field(name="latestAgentVersion", visibility=["read"]) + """The latest agent version.""" + job_id: Optional[str] = rest_field(name="jobId", visibility=["read"]) + """The job Id.""" + fabric_name: Optional[str] = rest_field(name="fabricName", visibility=["read"]) + """The fabric name.""" + appliance_name: Optional[str] = rest_field(name="applianceName", visibility=["read"]) + """The appliance name.""" + server_type: Optional[str] = rest_field(name="serverType", visibility=["read"]) + """The server type.""" + component_display_name: Optional[str] = rest_field(name="componentDisplayName", visibility=["read"]) + """The component display name.""" + instance_type: Literal["InMageRcm"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets the class type. Overridden in derived classes. Required. Default value is \"InMageRcm\".""" + + @overload + def __init__( + self, + ) -> 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) + self.instance_type = "InMageRcm" # type: ignore + + +class InMageRcmFabricCreationInput(FabricSpecificCreationInput, discriminator="InMageRcm"): + """InMageRcm fabric provider specific settings. + + :ivar vmware_site_id: The ARM Id of the VMware site. Required. + :vartype vmware_site_id: str + :ivar physical_site_id: The ARM Id of the physical site. Required. + :vartype physical_site_id: str + :ivar source_agent_identity: The identity provider input for source agent authentication. + Required. + :vartype source_agent_identity: + ~azure.mgmt.recoveryservicessiterecovery.models.IdentityProviderInput + :ivar instance_type: Gets the class type. Required. Default value is "InMageRcm". + :vartype instance_type: str + """ + + vmware_site_id: str = rest_field(name="vmwareSiteId", visibility=["read", "create", "update", "delete", "query"]) + """The ARM Id of the VMware site. Required.""" + physical_site_id: str = rest_field( + name="physicalSiteId", visibility=["read", "create", "update", "delete", "query"] + ) + """The ARM Id of the physical site. Required.""" + source_agent_identity: "_models.IdentityProviderInput" = rest_field( + name="sourceAgentIdentity", visibility=["read", "create", "update", "delete", "query"] + ) + """The identity provider input for source agent authentication. Required.""" + instance_type: Literal["InMageRcm"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets the class type. Required. Default value is \"InMageRcm\".""" + + @overload + def __init__( + self, + *, + vmware_site_id: str, + physical_site_id: str, + source_agent_identity: "_models.IdentityProviderInput", + ) -> 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) + self.instance_type = "InMageRcm" # type: ignore + + +class InMageRcmFabricSpecificDetails(FabricSpecificDetails, discriminator="InMageRcm"): + """InMageRcm fabric specific details. + + :ivar vmware_site_id: The ARM Id of the VMware site. + :vartype vmware_site_id: str + :ivar physical_site_id: The ARM Id of the physical site. + :vartype physical_site_id: str + :ivar service_endpoint: The service endpoint. + :vartype service_endpoint: str + :ivar service_resource_id: The service resource Id. + :vartype service_resource_id: str + :ivar service_container_id: The service container Id. + :vartype service_container_id: str + :ivar data_plane_uri: The data plane Uri. + :vartype data_plane_uri: str + :ivar control_plane_uri: The control plane Uri. + :vartype control_plane_uri: str + :ivar source_agent_identity_details: The source agent identity details. + :vartype source_agent_identity_details: + ~azure.mgmt.recoveryservicessiterecovery.models.IdentityProviderDetails + :ivar process_servers: The list of process servers. + :vartype process_servers: + list[~azure.mgmt.recoveryservicessiterecovery.models.ProcessServerDetails] + :ivar rcm_proxies: The list of RCM proxies. + :vartype rcm_proxies: list[~azure.mgmt.recoveryservicessiterecovery.models.RcmProxyDetails] + :ivar push_installers: The list of push installers. + :vartype push_installers: + list[~azure.mgmt.recoveryservicessiterecovery.models.PushInstallerDetails] + :ivar replication_agents: The list of replication agents. + :vartype replication_agents: + list[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationAgentDetails] + :ivar reprotect_agents: The list of reprotect agents. + :vartype reprotect_agents: + list[~azure.mgmt.recoveryservicessiterecovery.models.ReprotectAgentDetails] + :ivar mars_agents: The list of Mars agents. + :vartype mars_agents: list[~azure.mgmt.recoveryservicessiterecovery.models.MarsAgentDetails] + :ivar dras: The list of DRAs. + :vartype dras: list[~azure.mgmt.recoveryservicessiterecovery.models.DraDetails] + :ivar agent_details: The list of agent details. + :vartype agent_details: list[~azure.mgmt.recoveryservicessiterecovery.models.AgentDetails] + :ivar instance_type: Gets the class type. Overridden in derived classes. Required. Default + value is "InMageRcm". + :vartype instance_type: str + """ + + vmware_site_id: Optional[str] = rest_field(name="vmwareSiteId", visibility=["read"]) + """The ARM Id of the VMware site.""" + physical_site_id: Optional[str] = rest_field(name="physicalSiteId", visibility=["read"]) + """The ARM Id of the physical site.""" + service_endpoint: Optional[str] = rest_field(name="serviceEndpoint", visibility=["read"]) + """The service endpoint.""" + service_resource_id: Optional[str] = rest_field(name="serviceResourceId", visibility=["read"]) + """The service resource Id.""" + service_container_id: Optional[str] = rest_field(name="serviceContainerId", visibility=["read"]) + """The service container Id.""" + data_plane_uri: Optional[str] = rest_field(name="dataPlaneUri", visibility=["read"]) + """The data plane Uri.""" + control_plane_uri: Optional[str] = rest_field(name="controlPlaneUri", visibility=["read"]) + """The control plane Uri.""" + source_agent_identity_details: Optional["_models.IdentityProviderDetails"] = rest_field( + name="sourceAgentIdentityDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """The source agent identity details.""" + process_servers: Optional[list["_models.ProcessServerDetails"]] = rest_field( + name="processServers", visibility=["read"] + ) + """The list of process servers.""" + rcm_proxies: Optional[list["_models.RcmProxyDetails"]] = rest_field(name="rcmProxies", visibility=["read"]) + """The list of RCM proxies.""" + push_installers: Optional[list["_models.PushInstallerDetails"]] = rest_field( + name="pushInstallers", visibility=["read"] + ) + """The list of push installers.""" + replication_agents: Optional[list["_models.ReplicationAgentDetails"]] = rest_field( + name="replicationAgents", visibility=["read"] + ) + """The list of replication agents.""" + reprotect_agents: Optional[list["_models.ReprotectAgentDetails"]] = rest_field( + name="reprotectAgents", visibility=["read"] + ) + """The list of reprotect agents.""" + mars_agents: Optional[list["_models.MarsAgentDetails"]] = rest_field(name="marsAgents", visibility=["read"]) + """The list of Mars agents.""" + dras: Optional[list["_models.DraDetails"]] = rest_field(visibility=["read"]) + """The list of DRAs.""" + agent_details: Optional[list["_models.AgentDetails"]] = rest_field(name="agentDetails", visibility=["read"]) + """The list of agent details.""" + instance_type: Literal["InMageRcm"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets the class type. Overridden in derived classes. Required. Default value is \"InMageRcm\".""" + + @overload + def __init__( + self, + *, + source_agent_identity_details: Optional["_models.IdentityProviderDetails"] = 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) + self.instance_type = "InMageRcm" # type: ignore + + +class InMageRcmFabricSwitchProviderBlockingErrorDetails(_Model): # pylint: disable=name-too-long + """InMageRcmFabric switch provider blocking error details. + + :ivar error_code: The error code. + :vartype error_code: str + :ivar error_message: The error message. + :vartype error_message: str + :ivar possible_causes: The possible causes. + :vartype possible_causes: str + :ivar recommended_action: The recommended action. + :vartype recommended_action: str + :ivar error_message_parameters: The error message parameters. + :vartype error_message_parameters: dict[str, str] + :ivar error_tags: The error tags. + :vartype error_tags: dict[str, str] + """ + + error_code: Optional[str] = rest_field(name="errorCode", visibility=["read"]) + """The error code.""" + error_message: Optional[str] = rest_field(name="errorMessage", visibility=["read"]) + """The error message.""" + possible_causes: Optional[str] = rest_field(name="possibleCauses", visibility=["read"]) + """The possible causes.""" + recommended_action: Optional[str] = rest_field(name="recommendedAction", visibility=["read"]) + """The recommended action.""" + error_message_parameters: Optional[dict[str, str]] = rest_field(name="errorMessageParameters", visibility=["read"]) + """The error message parameters.""" + error_tags: Optional[dict[str, str]] = rest_field(name="errorTags", visibility=["read"]) + """The error tags.""" + + +class InMageRcmFailbackDiscoveredProtectedVmDetails(_Model): # pylint: disable=name-too-long + """InMageRcmFailback discovered VM details. + + :ivar v_center_id: The VCenter Id. + :vartype v_center_id: str + :ivar v_center_fqdn: The VCenter fqdn. + :vartype v_center_fqdn: str + :ivar datastores: The list of datastores. + :vartype datastores: list[str] + :ivar ip_addresses: The list of IP addresses. + :vartype ip_addresses: list[str] + :ivar vmware_tools_status: The VMware tools status. + :vartype vmware_tools_status: str + :ivar power_status: The VM power status. + :vartype power_status: str + :ivar vm_fqdn: The VM fqdn. + :vartype vm_fqdn: str + :ivar os_name: The VM's OS name. + :vartype os_name: str + :ivar created_timestamp: The SDS created timestamp. + :vartype created_timestamp: ~datetime.datetime + :ivar updated_timestamp: The SDS updated timestamp. + :vartype updated_timestamp: ~datetime.datetime + :ivar is_deleted: A value indicating whether the VM is deleted. + :vartype is_deleted: bool + :ivar last_discovery_time_in_utc: The last time when SDS information discovered in SRS. + :vartype last_discovery_time_in_utc: ~datetime.datetime + """ + + v_center_id: Optional[str] = rest_field(name="vCenterId", visibility=["read"]) + """The VCenter Id.""" + v_center_fqdn: Optional[str] = rest_field(name="vCenterFqdn", visibility=["read"]) + """The VCenter fqdn.""" + datastores: Optional[list[str]] = rest_field(visibility=["read"]) + """The list of datastores.""" + ip_addresses: Optional[list[str]] = rest_field(name="ipAddresses", visibility=["read"]) + """The list of IP addresses.""" + vmware_tools_status: Optional[str] = rest_field(name="vmwareToolsStatus", visibility=["read"]) + """The VMware tools status.""" + power_status: Optional[str] = rest_field(name="powerStatus", visibility=["read"]) + """The VM power status.""" + vm_fqdn: Optional[str] = rest_field(name="vmFqdn", visibility=["read"]) + """The VM fqdn.""" + os_name: Optional[str] = rest_field(name="osName", visibility=["read"]) + """The VM's OS name.""" + created_timestamp: Optional[datetime.datetime] = rest_field( + name="createdTimestamp", visibility=["read"], format="rfc3339" + ) + """The SDS created timestamp.""" + updated_timestamp: Optional[datetime.datetime] = rest_field( + name="updatedTimestamp", visibility=["read"], format="rfc3339" + ) + """The SDS updated timestamp.""" + is_deleted: Optional[bool] = rest_field(name="isDeleted", visibility=["read"]) + """A value indicating whether the VM is deleted.""" + last_discovery_time_in_utc: Optional[datetime.datetime] = rest_field( + name="lastDiscoveryTimeInUtc", visibility=["read"], format="rfc3339" + ) + """The last time when SDS information discovered in SRS.""" + + +class InMageRcmFailbackEventDetails(EventProviderSpecificDetails, discriminator="InMageRcmFailback"): + """Event details for InMageRcmFailback provider. + + :ivar protected_item_name: The protected item name. + :vartype protected_item_name: str + :ivar vm_name: The protected item name. + :vartype vm_name: str + :ivar appliance_name: The appliance name. + :vartype appliance_name: str + :ivar server_type: The server type. + :vartype server_type: str + :ivar component_display_name: The component display name. + :vartype component_display_name: str + :ivar instance_type: Gets the class type. Overridden in derived classes. Required. Default + value is "InMageRcmFailback". + :vartype instance_type: str + """ + + protected_item_name: Optional[str] = rest_field(name="protectedItemName", visibility=["read"]) + """The protected item name.""" + vm_name: Optional[str] = rest_field(name="vmName", visibility=["read"]) + """The protected item name.""" + appliance_name: Optional[str] = rest_field(name="applianceName", visibility=["read"]) + """The appliance name.""" + server_type: Optional[str] = rest_field(name="serverType", visibility=["read"]) + """The server type.""" + component_display_name: Optional[str] = rest_field(name="componentDisplayName", visibility=["read"]) + """The component display name.""" + instance_type: Literal["InMageRcmFailback"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets the class type. Overridden in derived classes. Required. Default value is + \"InMageRcmFailback\".""" + + @overload + def __init__( + self, + ) -> 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) + self.instance_type = "InMageRcmFailback" # type: ignore + + +class InMageRcmFailbackMobilityAgentDetails(_Model): + """InMageRcmFailback mobility agent details. + + :ivar version: The agent version. + :vartype version: str + :ivar latest_version: The latest agent version available. + :vartype latest_version: str + :ivar driver_version: The driver version. + :vartype driver_version: str + :ivar latest_upgradable_version_without_reboot: The latest upgradeable version available + without reboot. + :vartype latest_upgradable_version_without_reboot: str + :ivar agent_version_expiry_date: The agent version expiry date. + :vartype agent_version_expiry_date: ~datetime.datetime + :ivar driver_version_expiry_date: The driver version expiry date. + :vartype driver_version_expiry_date: ~datetime.datetime + :ivar last_heartbeat_utc: The time of the last heartbeat received from the agent. + :vartype last_heartbeat_utc: ~datetime.datetime + :ivar reasons_blocking_upgrade: The whether update is possible or not. + :vartype reasons_blocking_upgrade: list[str or + ~azure.mgmt.recoveryservicessiterecovery.models.AgentUpgradeBlockedReason] + :ivar is_upgradeable: A value indicating whether agent is upgradeable or not. + :vartype is_upgradeable: str + """ + + version: Optional[str] = rest_field(visibility=["read"]) + """The agent version.""" + latest_version: Optional[str] = rest_field(name="latestVersion", visibility=["read"]) + """The latest agent version available.""" + driver_version: Optional[str] = rest_field(name="driverVersion", visibility=["read"]) + """The driver version.""" + latest_upgradable_version_without_reboot: Optional[str] = rest_field( + name="latestUpgradableVersionWithoutReboot", visibility=["read"] + ) + """The latest upgradeable version available without reboot.""" + agent_version_expiry_date: Optional[datetime.datetime] = rest_field( + name="agentVersionExpiryDate", visibility=["read"], format="rfc3339" + ) + """The agent version expiry date.""" + driver_version_expiry_date: Optional[datetime.datetime] = rest_field( + name="driverVersionExpiryDate", visibility=["read"], format="rfc3339" + ) + """The driver version expiry date.""" + last_heartbeat_utc: Optional[datetime.datetime] = rest_field( + name="lastHeartbeatUtc", visibility=["read"], format="rfc3339" + ) + """The time of the last heartbeat received from the agent.""" + reasons_blocking_upgrade: Optional[list[Union[str, "_models.AgentUpgradeBlockedReason"]]] = rest_field( + name="reasonsBlockingUpgrade", visibility=["read"] + ) + """The whether update is possible or not.""" + is_upgradeable: Optional[str] = rest_field(name="isUpgradeable", visibility=["read"]) + """A value indicating whether agent is upgradeable or not.""" + + +class InMageRcmFailbackNicDetails(_Model): + """InMageRcmFailback NIC details. + + :ivar mac_address: The mac address. + :vartype mac_address: str + :ivar network_name: The network name. + :vartype network_name: str + :ivar adapter_type: The adapter type. + :vartype adapter_type: str + :ivar source_ip_address: The IP address. + :vartype source_ip_address: str + """ + + mac_address: Optional[str] = rest_field(name="macAddress", visibility=["read"]) + """The mac address.""" + network_name: Optional[str] = rest_field(name="networkName", visibility=["read"]) + """The network name.""" + adapter_type: Optional[str] = rest_field(name="adapterType", visibility=["read"]) + """The adapter type.""" + source_ip_address: Optional[str] = rest_field(name="sourceIpAddress", visibility=["read"]) + """The IP address.""" + + +class InMageRcmFailbackPlannedFailoverProviderInput( + PlannedFailoverProviderSpecificFailoverInput, discriminator="InMageRcmFailback" +): # pylint: disable=name-too-long + """Provider specific input for InMageRcmFailback failover. + + :ivar recovery_point_type: The recovery point type. Required. Known values are: + "ApplicationConsistent" and "CrashConsistent". + :vartype recovery_point_type: str or + ~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmFailbackRecoveryPointType + :ivar instance_type: The class type. Required. Default value is "InMageRcmFailback". + :vartype instance_type: str + """ + + recovery_point_type: Union[str, "_models.InMageRcmFailbackRecoveryPointType"] = rest_field( + name="recoveryPointType", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery point type. Required. Known values are: \"ApplicationConsistent\" and + \"CrashConsistent\".""" + instance_type: Literal["InMageRcmFailback"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The class type. Required. Default value is \"InMageRcmFailback\".""" + + @overload + def __init__( + self, + *, + recovery_point_type: Union[str, "_models.InMageRcmFailbackRecoveryPointType"], + ) -> 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) + self.instance_type = "InMageRcmFailback" # type: ignore + + +class InMageRcmFailbackPolicyCreationInput(PolicyProviderSpecificInput, discriminator="InMageRcmFailback"): + """InMageRcmFailback policy creation input. + + :ivar crash_consistent_frequency_in_minutes: The crash consistent snapshot frequency (in + minutes). + :vartype crash_consistent_frequency_in_minutes: int + :ivar app_consistent_frequency_in_minutes: The app consistent snapshot frequency (in minutes). + :vartype app_consistent_frequency_in_minutes: int + :ivar instance_type: The class type. Required. Default value is "InMageRcmFailback". + :vartype instance_type: str + """ + + crash_consistent_frequency_in_minutes: Optional[int] = rest_field( + name="crashConsistentFrequencyInMinutes", visibility=["read", "create", "update", "delete", "query"] + ) + """The crash consistent snapshot frequency (in minutes).""" + app_consistent_frequency_in_minutes: Optional[int] = rest_field( + name="appConsistentFrequencyInMinutes", visibility=["read", "create", "update", "delete", "query"] + ) + """The app consistent snapshot frequency (in minutes).""" + instance_type: Literal["InMageRcmFailback"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The class type. Required. Default value is \"InMageRcmFailback\".""" + + @overload + def __init__( + self, + *, + crash_consistent_frequency_in_minutes: Optional[int] = None, + app_consistent_frequency_in_minutes: 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) + self.instance_type = "InMageRcmFailback" # type: ignore + + +class InMageRcmFailbackPolicyDetails(PolicyProviderSpecificDetails, discriminator="InMageRcmFailback"): + """InMageRcm failback specific policy details. + + :ivar app_consistent_frequency_in_minutes: The app consistent snapshot frequency in minutes. + :vartype app_consistent_frequency_in_minutes: int + :ivar crash_consistent_frequency_in_minutes: The crash consistent snapshot frequency in + minutes. + :vartype crash_consistent_frequency_in_minutes: int + :ivar instance_type: Gets the class type. Overridden in derived classes. Required. Default + value is "InMageRcmFailback". + :vartype instance_type: str + """ + + app_consistent_frequency_in_minutes: Optional[int] = rest_field( + name="appConsistentFrequencyInMinutes", visibility=["read", "create", "update", "delete", "query"] + ) + """The app consistent snapshot frequency in minutes.""" + crash_consistent_frequency_in_minutes: Optional[int] = rest_field( + name="crashConsistentFrequencyInMinutes", visibility=["read", "create", "update", "delete", "query"] + ) + """The crash consistent snapshot frequency in minutes.""" + instance_type: Literal["InMageRcmFailback"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets the class type. Overridden in derived classes. Required. Default value is + \"InMageRcmFailback\".""" + + @overload + def __init__( + self, + *, + app_consistent_frequency_in_minutes: Optional[int] = None, + crash_consistent_frequency_in_minutes: 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) + self.instance_type = "InMageRcmFailback" # type: ignore + + +class InMageRcmFailbackProtectedDiskDetails(_Model): + """InMageRcmFailback protected disk details. + + :ivar disk_id: The disk Id (reported by source agent). + :vartype disk_id: str + :ivar disk_name: The disk name. + :vartype disk_name: str + :ivar is_os_disk: A value indicating whether the disk is the OS disk. + :vartype is_os_disk: str + :ivar capacity_in_bytes: The disk capacity in bytes. + :vartype capacity_in_bytes: int + :ivar disk_uuid: The disk Uuid (reported by vCenter). + :vartype disk_uuid: str + :ivar data_pending_in_log_data_store_in_mb: The data pending in log data store in MB. + :vartype data_pending_in_log_data_store_in_mb: float + :ivar data_pending_at_source_agent_in_mb: The data pending at source agent in MB. + :vartype data_pending_at_source_agent_in_mb: float + :ivar is_initial_replication_complete: A value indicating whether initial replication is + complete or not. + :vartype is_initial_replication_complete: str + :ivar ir_details: The initial replication details. + :vartype ir_details: + ~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmFailbackSyncDetails + :ivar resync_details: The resync details. + :vartype resync_details: + ~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmFailbackSyncDetails + :ivar last_sync_time: The last sync time. + :vartype last_sync_time: ~datetime.datetime + """ + + disk_id: Optional[str] = rest_field(name="diskId", visibility=["read"]) + """The disk Id (reported by source agent).""" + disk_name: Optional[str] = rest_field(name="diskName", visibility=["read"]) + """The disk name.""" + is_os_disk: Optional[str] = rest_field(name="isOSDisk", visibility=["read"]) + """A value indicating whether the disk is the OS disk.""" + capacity_in_bytes: Optional[int] = rest_field(name="capacityInBytes", visibility=["read"]) + """The disk capacity in bytes.""" + disk_uuid: Optional[str] = rest_field(name="diskUuid", visibility=["read"]) + """The disk Uuid (reported by vCenter).""" + data_pending_in_log_data_store_in_mb: Optional[float] = rest_field( + name="dataPendingInLogDataStoreInMB", visibility=["read"] + ) + """The data pending in log data store in MB.""" + data_pending_at_source_agent_in_mb: Optional[float] = rest_field( + name="dataPendingAtSourceAgentInMB", visibility=["read"] + ) + """The data pending at source agent in MB.""" + is_initial_replication_complete: Optional[str] = rest_field( + name="isInitialReplicationComplete", visibility=["read"] + ) + """A value indicating whether initial replication is complete or not.""" + ir_details: Optional["_models.InMageRcmFailbackSyncDetails"] = rest_field( + name="irDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """The initial replication details.""" + resync_details: Optional["_models.InMageRcmFailbackSyncDetails"] = rest_field( + name="resyncDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """The resync details.""" + last_sync_time: Optional[datetime.datetime] = rest_field(name="lastSyncTime", visibility=["read"], format="rfc3339") + """The last sync time.""" + + @overload + def __init__( + self, + *, + ir_details: Optional["_models.InMageRcmFailbackSyncDetails"] = None, + resync_details: Optional["_models.InMageRcmFailbackSyncDetails"] = 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 InMageRcmFailbackReplicationDetails(ReplicationProviderSpecificSettings, discriminator="InMageRcmFailback"): + """InMageRcmFailback provider specific details. + + :ivar internal_identifier: The virtual machine internal identifier. + :vartype internal_identifier: str + :ivar azure_virtual_machine_id: The ARM Id of the azure VM. + :vartype azure_virtual_machine_id: str + :ivar multi_vm_group_name: The multi VM group name. + :vartype multi_vm_group_name: str + :ivar reprotect_agent_id: The reprotect agent Id. + :vartype reprotect_agent_id: str + :ivar reprotect_agent_name: The reprotect agent name. + :vartype reprotect_agent_name: str + :ivar os_type: The type of the OS on the VM. + :vartype os_type: str + :ivar log_storage_account_id: The log storage account ARM Id. + :vartype log_storage_account_id: str + :ivar targetv_center_id: The target vCenter Id. + :vartype targetv_center_id: str + :ivar target_data_store_name: The target datastore name. + :vartype target_data_store_name: str + :ivar target_vm_name: The target VM name. + :vartype target_vm_name: str + :ivar initial_replication_progress_percentage: The initial replication progress percentage. + :vartype initial_replication_progress_percentage: int + :ivar initial_replication_processed_bytes: The initial replication processed bytes. This + includes sum of total bytes transferred and matched bytes on all selected disks in source VM. + :vartype initial_replication_processed_bytes: int + :ivar initial_replication_transferred_bytes: The initial replication transferred bytes from + source VM to target for all selected disks on source VM. + :vartype initial_replication_transferred_bytes: int + :ivar initial_replication_progress_health: The initial replication progress health. Known + values are: "None", "InProgress", "SlowProgress", and "NoProgress". + :vartype initial_replication_progress_health: str or + ~azure.mgmt.recoveryservicessiterecovery.models.VmReplicationProgressHealth + :ivar resync_progress_percentage: The resync progress percentage. + :vartype resync_progress_percentage: int + :ivar resync_processed_bytes: The resync processed bytes. This includes sum of total bytes + transferred and matched bytes on all selected disks in source VM. + :vartype resync_processed_bytes: int + :ivar resync_transferred_bytes: The resync transferred bytes from source VM to target for all + selected disks on source VM. + :vartype resync_transferred_bytes: int + :ivar resync_progress_health: The resync progress health. Known values are: "None", + "InProgress", "SlowProgress", and "NoProgress". + :vartype resync_progress_health: str or + ~azure.mgmt.recoveryservicessiterecovery.models.VmReplicationProgressHealth + :ivar resync_required: A value indicating whether resync is required. + :vartype resync_required: str + :ivar resync_state: The resync state. Known values are: "None", "PreparedForResynchronization", + and "StartedResynchronization". + :vartype resync_state: str or ~azure.mgmt.recoveryservicessiterecovery.models.ResyncState + :ivar protected_disks: The list of protected disks. + :vartype protected_disks: + list[~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmFailbackProtectedDiskDetails] + :ivar mobility_agent_details: The mobility agent information. + :vartype mobility_agent_details: + ~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmFailbackMobilityAgentDetails + :ivar vm_nics: The network details. + :vartype vm_nics: + list[~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmFailbackNicDetails] + :ivar last_planned_failover_start_time: The last planned failover start time. + :vartype last_planned_failover_start_time: ~datetime.datetime + :ivar last_planned_failover_status: The last planned failover status. Known values are: + "Succeeded", "Failed", "Cancelled", and "Unknown". + :vartype last_planned_failover_status: str or + ~azure.mgmt.recoveryservicessiterecovery.models.PlannedFailoverStatus + :ivar discovered_vm_details: The discovered VM information. + :vartype discovered_vm_details: + ~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmFailbackDiscoveredProtectedVmDetails + :ivar last_used_policy_id: The policy Id used by the forward replication. + :vartype last_used_policy_id: str + :ivar last_used_policy_friendly_name: The policy friendly name used by the forward replication. + :vartype last_used_policy_friendly_name: str + :ivar is_agent_registration_successful_after_failover: A value indicating whether agent + registration was successful after failover. + :vartype is_agent_registration_successful_after_failover: bool + :ivar instance_type: Gets the Instance type. Required. Default value is "InMageRcmFailback". + :vartype instance_type: str + """ + + internal_identifier: Optional[str] = rest_field(name="internalIdentifier", visibility=["read"]) + """The virtual machine internal identifier.""" + azure_virtual_machine_id: Optional[str] = rest_field(name="azureVirtualMachineId", visibility=["read"]) + """The ARM Id of the azure VM.""" + multi_vm_group_name: Optional[str] = rest_field(name="multiVmGroupName", visibility=["read"]) + """The multi VM group name.""" + reprotect_agent_id: Optional[str] = rest_field(name="reprotectAgentId", visibility=["read"]) + """The reprotect agent Id.""" + reprotect_agent_name: Optional[str] = rest_field(name="reprotectAgentName", visibility=["read"]) + """The reprotect agent name.""" + os_type: Optional[str] = rest_field(name="osType", visibility=["read"]) + """The type of the OS on the VM.""" + log_storage_account_id: Optional[str] = rest_field(name="logStorageAccountId", visibility=["read"]) + """The log storage account ARM Id.""" + targetv_center_id: Optional[str] = rest_field(name="targetvCenterId", visibility=["read"]) + """The target vCenter Id.""" + target_data_store_name: Optional[str] = rest_field(name="targetDataStoreName", visibility=["read"]) + """The target datastore name.""" + target_vm_name: Optional[str] = rest_field(name="targetVmName", visibility=["read"]) + """The target VM name.""" + initial_replication_progress_percentage: Optional[int] = rest_field( + name="initialReplicationProgressPercentage", visibility=["read"] + ) + """The initial replication progress percentage.""" + initial_replication_processed_bytes: Optional[int] = rest_field( + name="initialReplicationProcessedBytes", visibility=["read"] + ) + """The initial replication processed bytes. This includes sum of total bytes transferred and + matched bytes on all selected disks in source VM.""" + initial_replication_transferred_bytes: Optional[int] = rest_field( + name="initialReplicationTransferredBytes", visibility=["read"] + ) + """The initial replication transferred bytes from source VM to target for all selected disks on + source VM.""" + initial_replication_progress_health: Optional[Union[str, "_models.VmReplicationProgressHealth"]] = rest_field( + name="initialReplicationProgressHealth", visibility=["read"] + ) + """The initial replication progress health. Known values are: \"None\", \"InProgress\", + \"SlowProgress\", and \"NoProgress\".""" + resync_progress_percentage: Optional[int] = rest_field(name="resyncProgressPercentage", visibility=["read"]) + """The resync progress percentage.""" + resync_processed_bytes: Optional[int] = rest_field(name="resyncProcessedBytes", visibility=["read"]) + """The resync processed bytes. This includes sum of total bytes transferred and matched bytes on + all selected disks in source VM.""" + resync_transferred_bytes: Optional[int] = rest_field(name="resyncTransferredBytes", visibility=["read"]) + """The resync transferred bytes from source VM to target for all selected disks on source VM.""" + resync_progress_health: Optional[Union[str, "_models.VmReplicationProgressHealth"]] = rest_field( + name="resyncProgressHealth", visibility=["read"] + ) + """The resync progress health. Known values are: \"None\", \"InProgress\", \"SlowProgress\", and + \"NoProgress\".""" + resync_required: Optional[str] = rest_field(name="resyncRequired", visibility=["read"]) + """A value indicating whether resync is required.""" + resync_state: Optional[Union[str, "_models.ResyncState"]] = rest_field(name="resyncState", visibility=["read"]) + """The resync state. Known values are: \"None\", \"PreparedForResynchronization\", and + \"StartedResynchronization\".""" + protected_disks: Optional[list["_models.InMageRcmFailbackProtectedDiskDetails"]] = rest_field( + name="protectedDisks", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of protected disks.""" + mobility_agent_details: Optional["_models.InMageRcmFailbackMobilityAgentDetails"] = rest_field( + name="mobilityAgentDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """The mobility agent information.""" + vm_nics: Optional[list["_models.InMageRcmFailbackNicDetails"]] = rest_field( + name="vmNics", visibility=["read", "create", "update", "delete", "query"] + ) + """The network details.""" + last_planned_failover_start_time: Optional[datetime.datetime] = rest_field( + name="lastPlannedFailoverStartTime", visibility=["read"], format="rfc3339" + ) + """The last planned failover start time.""" + last_planned_failover_status: Optional[Union[str, "_models.PlannedFailoverStatus"]] = rest_field( + name="lastPlannedFailoverStatus", visibility=["read"] + ) + """The last planned failover status. Known values are: \"Succeeded\", \"Failed\", \"Cancelled\", + and \"Unknown\".""" + discovered_vm_details: Optional["_models.InMageRcmFailbackDiscoveredProtectedVmDetails"] = rest_field( + name="discoveredVmDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """The discovered VM information.""" + last_used_policy_id: Optional[str] = rest_field(name="lastUsedPolicyId", visibility=["read"]) + """The policy Id used by the forward replication.""" + last_used_policy_friendly_name: Optional[str] = rest_field(name="lastUsedPolicyFriendlyName", visibility=["read"]) + """The policy friendly name used by the forward replication.""" + is_agent_registration_successful_after_failover: Optional[bool] = rest_field( + name="isAgentRegistrationSuccessfulAfterFailover", visibility=["read"] + ) + """A value indicating whether agent registration was successful after failover.""" + instance_type: Literal["InMageRcmFailback"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets the Instance type. Required. Default value is \"InMageRcmFailback\".""" + + @overload + def __init__( # pylint: disable=too-many-locals + self, + *, + protected_disks: Optional[list["_models.InMageRcmFailbackProtectedDiskDetails"]] = None, + mobility_agent_details: Optional["_models.InMageRcmFailbackMobilityAgentDetails"] = None, + vm_nics: Optional[list["_models.InMageRcmFailbackNicDetails"]] = None, + discovered_vm_details: Optional["_models.InMageRcmFailbackDiscoveredProtectedVmDetails"] = 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) + self.instance_type = "InMageRcmFailback" # type: ignore + + +class InMageRcmFailbackReprotectInput(ReverseReplicationProviderSpecificInput, discriminator="InMageRcmFailback"): + """InMageRcmFailback specific provider input. + + :ivar process_server_id: The process server Id. Required. + :vartype process_server_id: str + :ivar run_as_account_id: The run as account Id. + :vartype run_as_account_id: str + :ivar policy_id: The Policy Id. Required. + :vartype policy_id: str + :ivar instance_type: The class type. Required. Default value is "InMageRcmFailback". + :vartype instance_type: str + """ + + process_server_id: str = rest_field( + name="processServerId", visibility=["read", "create", "update", "delete", "query"] + ) + """The process server Id. Required.""" + run_as_account_id: Optional[str] = rest_field( + name="runAsAccountId", visibility=["read", "create", "update", "delete", "query"] + ) + """The run as account Id.""" + policy_id: str = rest_field(name="policyId", visibility=["read", "create", "update", "delete", "query"]) + """The Policy Id. Required.""" + instance_type: Literal["InMageRcmFailback"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The class type. Required. Default value is \"InMageRcmFailback\".""" + + @overload + def __init__( + self, + *, + process_server_id: str, + policy_id: str, + run_as_account_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) + self.instance_type = "InMageRcmFailback" # type: ignore + + +class InMageRcmFailbackSyncDetails(_Model): + """InMageRcmFailback disk level sync details. + + :ivar progress_health: The progress health. Known values are: "None", "InProgress", + "SlowProgress", "NoProgress", and "Queued". + :vartype progress_health: str or + ~azure.mgmt.recoveryservicessiterecovery.models.DiskReplicationProgressHealth + :ivar transferred_bytes: The transferred bytes from source VM to azure for the disk. + :vartype transferred_bytes: int + :ivar last15_minutes_transferred_bytes: The bytes transferred in last 15 minutes from source VM + to target. + :vartype last15_minutes_transferred_bytes: int + :ivar last_data_transfer_time_utc: The time of the last data transfer from source VM to target. + :vartype last_data_transfer_time_utc: str + :ivar processed_bytes: The total processed bytes. This includes bytes that are transferred from + source VM to target and matched bytes. + :vartype processed_bytes: int + :ivar start_time: The start time. + :vartype start_time: str + :ivar last_refresh_time: The last refresh time. + :vartype last_refresh_time: str + :ivar progress_percentage: Progress in percentage. Progress percentage is calculated based on + processed bytes. + :vartype progress_percentage: int + """ + + progress_health: Optional[Union[str, "_models.DiskReplicationProgressHealth"]] = rest_field( + name="progressHealth", visibility=["read"] + ) + """The progress health. Known values are: \"None\", \"InProgress\", \"SlowProgress\", + \"NoProgress\", and \"Queued\".""" + transferred_bytes: Optional[int] = rest_field(name="transferredBytes", visibility=["read"]) + """The transferred bytes from source VM to azure for the disk.""" + last15_minutes_transferred_bytes: Optional[int] = rest_field( + name="last15MinutesTransferredBytes", visibility=["read"] + ) + """The bytes transferred in last 15 minutes from source VM to target.""" + last_data_transfer_time_utc: Optional[str] = rest_field(name="lastDataTransferTimeUtc", visibility=["read"]) + """The time of the last data transfer from source VM to target.""" + processed_bytes: Optional[int] = rest_field(name="processedBytes", visibility=["read"]) + """The total processed bytes. This includes bytes that are transferred from source VM to target + and matched bytes.""" + start_time: Optional[str] = rest_field(name="startTime", visibility=["read"]) + """The start time.""" + last_refresh_time: Optional[str] = rest_field(name="lastRefreshTime", visibility=["read"]) + """The last refresh time.""" + progress_percentage: Optional[int] = rest_field(name="progressPercentage", visibility=["read"]) + """Progress in percentage. Progress percentage is calculated based on processed bytes.""" + + +class InMageRcmLastAgentUpgradeErrorDetails(_Model): + """InMageRcm last source agent upgrade error details. + + :ivar error_code: The error code. + :vartype error_code: str + :ivar error_message: The error message. + :vartype error_message: str + :ivar possible_causes: The possible causes. + :vartype possible_causes: str + :ivar recommended_action: The recommended action. + :vartype recommended_action: str + :ivar error_message_parameters: The error message parameters. + :vartype error_message_parameters: dict[str, str] + :ivar error_tags: The error tags. + :vartype error_tags: dict[str, str] + """ + + error_code: Optional[str] = rest_field(name="errorCode", visibility=["read"]) + """The error code.""" + error_message: Optional[str] = rest_field(name="errorMessage", visibility=["read"]) + """The error message.""" + possible_causes: Optional[str] = rest_field(name="possibleCauses", visibility=["read"]) + """The possible causes.""" + recommended_action: Optional[str] = rest_field(name="recommendedAction", visibility=["read"]) + """The recommended action.""" + error_message_parameters: Optional[dict[str, str]] = rest_field(name="errorMessageParameters", visibility=["read"]) + """The error message parameters.""" + error_tags: Optional[dict[str, str]] = rest_field(name="errorTags", visibility=["read"]) + """The error tags.""" + + +class InMageRcmMobilityAgentDetails(_Model): + """InMageRcm mobility agent details. + + :ivar version: The agent version. + :vartype version: str + :ivar latest_version: The latest agent version available. + :vartype latest_version: str + :ivar latest_agent_release_date: The latest agent version release date. + :vartype latest_agent_release_date: str + :ivar driver_version: The driver version. + :vartype driver_version: str + :ivar latest_upgradable_version_without_reboot: The latest upgradeable version available + without reboot. + :vartype latest_upgradable_version_without_reboot: str + :ivar agent_version_expiry_date: The agent version expiry date. + :vartype agent_version_expiry_date: ~datetime.datetime + :ivar driver_version_expiry_date: The driver version expiry date. + :vartype driver_version_expiry_date: ~datetime.datetime + :ivar last_heartbeat_utc: The time of the last heartbeat received from the agent. + :vartype last_heartbeat_utc: ~datetime.datetime + :ivar reasons_blocking_upgrade: The whether update is possible or not. + :vartype reasons_blocking_upgrade: list[str or + ~azure.mgmt.recoveryservicessiterecovery.models.AgentUpgradeBlockedReason] + :ivar is_upgradeable: A value indicating whether agent is upgradeable or not. + :vartype is_upgradeable: str + :ivar agent_reinstall_state: The agent auto reinstall state. + :vartype agent_reinstall_state: list[str or + ~azure.mgmt.recoveryservicessiterecovery.models.MobilityAgentReinstallType] + :ivar last_agent_reinstall_type: The last agent reinstall type. + :vartype last_agent_reinstall_type: str + :ivar agent_reinstall_job_id: The agent reinstall job Id. + :vartype agent_reinstall_job_id: str + :ivar agent_reinstall_attempt_to_version: The last agent reinstall type. + :vartype agent_reinstall_attempt_to_version: str + :ivar os_family_name: The OS family name. + :vartype os_family_name: str + :ivar distro_name: The distro name. + :vartype distro_name: str + :ivar distro_name_for_which_agent_is_installed: Distro name for which agent is installed. + :vartype distro_name_for_which_agent_is_installed: str + :ivar is_agent_upgradeable: A value indicating whether replication agent upgradeable. + :vartype is_agent_upgradeable: bool + :ivar is_agent_reinstall_required: A value indicating whether replication agent reinstallation + is required. + :vartype is_agent_reinstall_required: bool + :ivar is_last_reinstall_successful: A value indicating whether replication agent reinstallation + is required. + :vartype is_last_reinstall_successful: bool + :ivar reasons_blocking_reinstall: whether reinstall is possible or not. + :vartype reasons_blocking_reinstall: list[str or + ~azure.mgmt.recoveryservicessiterecovery.models.AgentReinstallBlockedReason] + :ivar reasons_blocking_reinstall_details: whether reinstall is possible or not. + :vartype reasons_blocking_reinstall_details: + list[~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmAgentReinstallBlockingErrorDetails] + """ + + version: Optional[str] = rest_field(visibility=["read"]) + """The agent version.""" + latest_version: Optional[str] = rest_field(name="latestVersion", visibility=["read"]) + """The latest agent version available.""" + latest_agent_release_date: Optional[str] = rest_field(name="latestAgentReleaseDate", visibility=["read"]) + """The latest agent version release date.""" + driver_version: Optional[str] = rest_field(name="driverVersion", visibility=["read"]) + """The driver version.""" + latest_upgradable_version_without_reboot: Optional[str] = rest_field( + name="latestUpgradableVersionWithoutReboot", visibility=["read"] + ) + """The latest upgradeable version available without reboot.""" + agent_version_expiry_date: Optional[datetime.datetime] = rest_field( + name="agentVersionExpiryDate", visibility=["read"], format="rfc3339" + ) + """The agent version expiry date.""" + driver_version_expiry_date: Optional[datetime.datetime] = rest_field( + name="driverVersionExpiryDate", visibility=["read"], format="rfc3339" + ) + """The driver version expiry date.""" + last_heartbeat_utc: Optional[datetime.datetime] = rest_field( + name="lastHeartbeatUtc", visibility=["read"], format="rfc3339" + ) + """The time of the last heartbeat received from the agent.""" + reasons_blocking_upgrade: Optional[list[Union[str, "_models.AgentUpgradeBlockedReason"]]] = rest_field( + name="reasonsBlockingUpgrade", visibility=["read"] + ) + """The whether update is possible or not.""" + is_upgradeable: Optional[str] = rest_field(name="isUpgradeable", visibility=["read"]) + """A value indicating whether agent is upgradeable or not.""" + agent_reinstall_state: Optional[list[Union[str, "_models.MobilityAgentReinstallType"]]] = rest_field( + name="agentReinstallState", visibility=["read"] + ) + """The agent auto reinstall state.""" + last_agent_reinstall_type: Optional[str] = rest_field(name="lastAgentReinstallType", visibility=["read"]) + """The last agent reinstall type.""" + agent_reinstall_job_id: Optional[str] = rest_field(name="agentReinstallJobId", visibility=["read"]) + """The agent reinstall job Id.""" + agent_reinstall_attempt_to_version: Optional[str] = rest_field( + name="agentReinstallAttemptToVersion", visibility=["read"] + ) + """The last agent reinstall type.""" + os_family_name: Optional[str] = rest_field( + name="osFamilyName", visibility=["read", "create", "update", "delete", "query"] + ) + """The OS family name.""" + distro_name: Optional[str] = rest_field( + name="distroName", visibility=["read", "create", "update", "delete", "query"] + ) + """The distro name.""" + distro_name_for_which_agent_is_installed: Optional[str] = rest_field( + name="distroNameForWhichAgentIsInstalled", visibility=["read", "create", "update", "delete", "query"] + ) + """Distro name for which agent is installed.""" + is_agent_upgradeable: Optional[bool] = rest_field( + name="isAgentUpgradeable", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether replication agent upgradeable.""" + is_agent_reinstall_required: Optional[bool] = rest_field( + name="isAgentReinstallRequired", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether replication agent reinstallation is required.""" + is_last_reinstall_successful: Optional[bool] = rest_field( + name="isLastReinstallSuccessful", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether replication agent reinstallation is required.""" + reasons_blocking_reinstall: Optional[list[Union[str, "_models.AgentReinstallBlockedReason"]]] = rest_field( + name="reasonsBlockingReinstall", visibility=["read"] + ) + """whether reinstall is possible or not.""" + reasons_blocking_reinstall_details: Optional[list["_models.InMageRcmAgentReinstallBlockingErrorDetails"]] = ( + rest_field(name="reasonsBlockingReinstallDetails", visibility=["read"]) + ) + """whether reinstall is possible or not.""" + + @overload + def __init__( + self, + *, + os_family_name: Optional[str] = None, + distro_name: Optional[str] = None, + distro_name_for_which_agent_is_installed: Optional[str] = None, + is_agent_upgradeable: Optional[bool] = None, + is_agent_reinstall_required: Optional[bool] = None, + is_last_reinstall_successful: 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 InMageRcmNicDetails(_Model): + """InMageRcm NIC details. + + :ivar nic_id: The NIC Id. + :vartype nic_id: str + :ivar is_primary_nic: A value indicating whether this is the primary NIC. + :vartype is_primary_nic: str + :ivar is_selected_for_failover: A value indicating whether this NIC is selected for failover. + :vartype is_selected_for_failover: str + :ivar source_ip_address: The source IP address. + :vartype source_ip_address: str + :ivar source_ip_address_type: The source IP address type. Known values are: "Dynamic" and + "Static". + :vartype source_ip_address_type: str or + ~azure.mgmt.recoveryservicessiterecovery.models.EthernetAddressType + :ivar source_network_id: Source network Id. + :vartype source_network_id: str + :ivar source_subnet_name: Source subnet name. + :vartype source_subnet_name: str + :ivar target_ip_address: The target IP address. + :vartype target_ip_address: str + :ivar target_ip_address_type: The target IP address type. Known values are: "Dynamic" and + "Static". + :vartype target_ip_address_type: str or + ~azure.mgmt.recoveryservicessiterecovery.models.EthernetAddressType + :ivar target_subnet_name: Target subnet name. + :vartype target_subnet_name: str + :ivar test_subnet_name: Test subnet name. + :vartype test_subnet_name: str + :ivar test_ip_address: The test IP address. + :vartype test_ip_address: str + :ivar test_ip_address_type: The test IP address type. Known values are: "Dynamic" and "Static". + :vartype test_ip_address_type: str or + ~azure.mgmt.recoveryservicessiterecovery.models.EthernetAddressType + :ivar target_nic_name: The target NIC name. + :vartype target_nic_name: str + """ + + nic_id: Optional[str] = rest_field(name="nicId", visibility=["read"]) + """The NIC Id.""" + is_primary_nic: Optional[str] = rest_field( + name="isPrimaryNic", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether this is the primary NIC.""" + is_selected_for_failover: Optional[str] = rest_field( + name="isSelectedForFailover", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether this NIC is selected for failover.""" + source_ip_address: Optional[str] = rest_field(name="sourceIPAddress", visibility=["read"]) + """The source IP address.""" + source_ip_address_type: Optional[Union[str, "_models.EthernetAddressType"]] = rest_field( + name="sourceIPAddressType", visibility=["read"] + ) + """The source IP address type. Known values are: \"Dynamic\" and \"Static\".""" + source_network_id: Optional[str] = rest_field(name="sourceNetworkId", visibility=["read"]) + """Source network Id.""" + source_subnet_name: Optional[str] = rest_field(name="sourceSubnetName", visibility=["read"]) + """Source subnet name.""" + target_ip_address: Optional[str] = rest_field( + name="targetIPAddress", visibility=["read", "create", "update", "delete", "query"] + ) + """The target IP address.""" + target_ip_address_type: Optional[Union[str, "_models.EthernetAddressType"]] = rest_field( + name="targetIPAddressType", visibility=["read", "create", "update", "delete", "query"] + ) + """The target IP address type. Known values are: \"Dynamic\" and \"Static\".""" + target_subnet_name: Optional[str] = rest_field( + name="targetSubnetName", visibility=["read", "create", "update", "delete", "query"] + ) + """Target subnet name.""" + test_subnet_name: Optional[str] = rest_field( + name="testSubnetName", visibility=["read", "create", "update", "delete", "query"] + ) + """Test subnet name.""" + test_ip_address: Optional[str] = rest_field( + name="testIPAddress", visibility=["read", "create", "update", "delete", "query"] + ) + """The test IP address.""" + test_ip_address_type: Optional[Union[str, "_models.EthernetAddressType"]] = rest_field( + name="testIPAddressType", visibility=["read", "create", "update", "delete", "query"] + ) + """The test IP address type. Known values are: \"Dynamic\" and \"Static\".""" + target_nic_name: Optional[str] = rest_field( + name="targetNicName", visibility=["read", "create", "update", "delete", "query"] + ) + """The target NIC name.""" + + @overload + def __init__( + self, + *, + is_primary_nic: Optional[str] = None, + is_selected_for_failover: Optional[str] = None, + target_ip_address: Optional[str] = None, + target_ip_address_type: Optional[Union[str, "_models.EthernetAddressType"]] = None, + target_subnet_name: Optional[str] = None, + test_subnet_name: Optional[str] = None, + test_ip_address: Optional[str] = None, + test_ip_address_type: Optional[Union[str, "_models.EthernetAddressType"]] = None, + target_nic_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 InMageRcmNicInput(_Model): + """InMageRcm NIC input. + + :ivar nic_id: The NIC Id. Required. + :vartype nic_id: str + :ivar is_primary_nic: A value indicating whether this is the primary NIC. Required. + :vartype is_primary_nic: str + :ivar is_selected_for_failover: A value indicating whether this NIC is selected for failover. + :vartype is_selected_for_failover: str + :ivar target_subnet_name: Target subnet name. + :vartype target_subnet_name: str + :ivar target_static_ip_address: The target static IP address. + :vartype target_static_ip_address: str + :ivar test_subnet_name: The test subnet name. + :vartype test_subnet_name: str + :ivar test_static_ip_address: The test static IP address. + :vartype test_static_ip_address: str + :ivar target_nic_name: The target NIC name. + :vartype target_nic_name: str + """ + + nic_id: str = rest_field(name="nicId", visibility=["read", "create", "update", "delete", "query"]) + """The NIC Id. Required.""" + is_primary_nic: str = rest_field(name="isPrimaryNic", visibility=["read", "create", "update", "delete", "query"]) + """A value indicating whether this is the primary NIC. Required.""" + is_selected_for_failover: Optional[str] = rest_field( + name="isSelectedForFailover", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether this NIC is selected for failover.""" + target_subnet_name: Optional[str] = rest_field( + name="targetSubnetName", visibility=["read", "create", "update", "delete", "query"] + ) + """Target subnet name.""" + target_static_ip_address: Optional[str] = rest_field( + name="targetStaticIPAddress", visibility=["read", "create", "update", "delete", "query"] + ) + """The target static IP address.""" + test_subnet_name: Optional[str] = rest_field( + name="testSubnetName", visibility=["read", "create", "update", "delete", "query"] + ) + """The test subnet name.""" + test_static_ip_address: Optional[str] = rest_field( + name="testStaticIPAddress", visibility=["read", "create", "update", "delete", "query"] + ) + """The test static IP address.""" + target_nic_name: Optional[str] = rest_field( + name="targetNicName", visibility=["read", "create", "update", "delete", "query"] + ) + """The target NIC name.""" + + @overload + def __init__( + self, + *, + nic_id: str, + is_primary_nic: str, + is_selected_for_failover: Optional[str] = None, + target_subnet_name: Optional[str] = None, + target_static_ip_address: Optional[str] = None, + test_subnet_name: Optional[str] = None, + test_static_ip_address: Optional[str] = None, + target_nic_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 InMageRcmPolicyCreationInput(PolicyProviderSpecificInput, discriminator="InMageRcm"): + """InMageRcm policy creation input. + + :ivar recovery_point_history_in_minutes: The duration in minutes until which the recovery + points need to be stored. + :vartype recovery_point_history_in_minutes: int + :ivar crash_consistent_frequency_in_minutes: The crash consistent snapshot frequency (in + minutes). + :vartype crash_consistent_frequency_in_minutes: int + :ivar app_consistent_frequency_in_minutes: The app consistent snapshot frequency (in minutes). + :vartype app_consistent_frequency_in_minutes: int + :ivar enable_multi_vm_sync: A value indicating whether multi-VM sync has to be enabled. + :vartype enable_multi_vm_sync: str + :ivar instance_type: The class type. Required. Default value is "InMageRcm". + :vartype instance_type: str + """ + + recovery_point_history_in_minutes: Optional[int] = rest_field( + name="recoveryPointHistoryInMinutes", visibility=["read", "create", "update", "delete", "query"] + ) + """The duration in minutes until which the recovery points need to be stored.""" + crash_consistent_frequency_in_minutes: Optional[int] = rest_field( + name="crashConsistentFrequencyInMinutes", visibility=["read", "create", "update", "delete", "query"] + ) + """The crash consistent snapshot frequency (in minutes).""" + app_consistent_frequency_in_minutes: Optional[int] = rest_field( + name="appConsistentFrequencyInMinutes", visibility=["read", "create", "update", "delete", "query"] + ) + """The app consistent snapshot frequency (in minutes).""" + enable_multi_vm_sync: Optional[str] = rest_field( + name="enableMultiVmSync", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether multi-VM sync has to be enabled.""" + instance_type: Literal["InMageRcm"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The class type. Required. Default value is \"InMageRcm\".""" + + @overload + def __init__( + self, + *, + recovery_point_history_in_minutes: Optional[int] = None, + crash_consistent_frequency_in_minutes: Optional[int] = None, + app_consistent_frequency_in_minutes: Optional[int] = None, + enable_multi_vm_sync: 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) + self.instance_type = "InMageRcm" # type: ignore + + +class InMageRcmPolicyDetails(PolicyProviderSpecificDetails, discriminator="InMageRcm"): + """InMageRcm specific policy details. + + :ivar recovery_point_history_in_minutes: The duration in minutes until which the recovery + points need to be stored. + :vartype recovery_point_history_in_minutes: int + :ivar app_consistent_frequency_in_minutes: The app consistent snapshot frequency in minutes. + :vartype app_consistent_frequency_in_minutes: int + :ivar crash_consistent_frequency_in_minutes: The crash consistent snapshot frequency in + minutes. + :vartype crash_consistent_frequency_in_minutes: int + :ivar enable_multi_vm_sync: A value indicating whether multi-VM sync has to be enabled. + :vartype enable_multi_vm_sync: str + :ivar instance_type: Gets the class type. Overridden in derived classes. Required. Default + value is "InMageRcm". + :vartype instance_type: str + """ + + recovery_point_history_in_minutes: Optional[int] = rest_field( + name="recoveryPointHistoryInMinutes", visibility=["read", "create", "update", "delete", "query"] + ) + """The duration in minutes until which the recovery points need to be stored.""" + app_consistent_frequency_in_minutes: Optional[int] = rest_field( + name="appConsistentFrequencyInMinutes", visibility=["read", "create", "update", "delete", "query"] + ) + """The app consistent snapshot frequency in minutes.""" + crash_consistent_frequency_in_minutes: Optional[int] = rest_field( + name="crashConsistentFrequencyInMinutes", visibility=["read", "create", "update", "delete", "query"] + ) + """The crash consistent snapshot frequency in minutes.""" + enable_multi_vm_sync: Optional[str] = rest_field( + name="enableMultiVmSync", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether multi-VM sync has to be enabled.""" + instance_type: Literal["InMageRcm"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets the class type. Overridden in derived classes. Required. Default value is \"InMageRcm\".""" + + @overload + def __init__( + self, + *, + recovery_point_history_in_minutes: Optional[int] = None, + app_consistent_frequency_in_minutes: Optional[int] = None, + crash_consistent_frequency_in_minutes: Optional[int] = None, + enable_multi_vm_sync: 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) + self.instance_type = "InMageRcm" # type: ignore + + +class InMageRcmProtectedDiskDetails(_Model): + """InMageRcm protected disk details. + + :ivar disk_id: The disk Id. + :vartype disk_id: str + :ivar disk_name: The disk name. + :vartype disk_name: str + :ivar is_os_disk: A value indicating whether the disk is the OS disk. + :vartype is_os_disk: str + :ivar capacity_in_bytes: The disk capacity in bytes. + :vartype capacity_in_bytes: int + :ivar disk_state: The disk state. Known values are: "Unavailable", "InitialReplicationPending", + "InitialReplicationFailed", and "Protected". + :vartype disk_state: str or ~azure.mgmt.recoveryservicessiterecovery.models.DiskState + :ivar log_storage_account_id: The log storage account ARM Id. + :vartype log_storage_account_id: str + :ivar disk_encryption_set_id: The DiskEncryptionSet ARM Id. + :vartype disk_encryption_set_id: str + :ivar seed_managed_disk_id: The ARM Id of the seed managed disk. + :vartype seed_managed_disk_id: str + :ivar seed_blob_uri: The uri of the seed blob. + :vartype seed_blob_uri: str + :ivar target_managed_disk_id: The ARM Id of the target managed disk. + :vartype target_managed_disk_id: str + :ivar disk_type: The disk type. Known values are: "Standard_LRS", "Premium_LRS", + "StandardSSD_LRS", "PremiumV2_LRS", "UltraSSD_LRS", "StandardSSD_ZRS", and "Premium_ZRS". + :vartype disk_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.DiskAccountType + :ivar data_pending_in_log_data_store_in_mb: The data pending in log data store in MB. + :vartype data_pending_in_log_data_store_in_mb: float + :ivar data_pending_at_source_agent_in_mb: The data pending at source agent in MB. + :vartype data_pending_at_source_agent_in_mb: float + :ivar is_initial_replication_complete: A value indicating whether initial replication is + complete or not. + :vartype is_initial_replication_complete: str + :ivar ir_details: The initial replication details. + :vartype ir_details: ~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmSyncDetails + :ivar resync_details: The resync details. + :vartype resync_details: ~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmSyncDetails + :ivar custom_target_disk_name: The custom target Azure disk name. + :vartype custom_target_disk_name: str + :ivar sector_size_in_bytes: The logical sector size (in bytes), 512 by default. + :vartype sector_size_in_bytes: int + :ivar iops: The number of IOPS allowed for Premium V2 and Ultra disks. + :vartype iops: int + :ivar throughput_in_mbps: The total throughput in Mbps for Premium V2 and Ultra disks. + :vartype throughput_in_mbps: int + :ivar disk_size_in_gb: The target disk size in GB. + :vartype disk_size_in_gb: int + """ + + disk_id: Optional[str] = rest_field(name="diskId", visibility=["read"]) + """The disk Id.""" + disk_name: Optional[str] = rest_field(name="diskName", visibility=["read"]) + """The disk name.""" + is_os_disk: Optional[str] = rest_field(name="isOSDisk", visibility=["read"]) + """A value indicating whether the disk is the OS disk.""" + capacity_in_bytes: Optional[int] = rest_field(name="capacityInBytes", visibility=["read"]) + """The disk capacity in bytes.""" + disk_state: Optional[Union[str, "_models.DiskState"]] = rest_field(name="diskState", visibility=["read"]) + """The disk state. Known values are: \"Unavailable\", \"InitialReplicationPending\", + \"InitialReplicationFailed\", and \"Protected\".""" + log_storage_account_id: Optional[str] = rest_field(name="logStorageAccountId", visibility=["read"]) + """The log storage account ARM Id.""" + disk_encryption_set_id: Optional[str] = rest_field(name="diskEncryptionSetId", visibility=["read"]) + """The DiskEncryptionSet ARM Id.""" + seed_managed_disk_id: Optional[str] = rest_field(name="seedManagedDiskId", visibility=["read"]) + """The ARM Id of the seed managed disk.""" + seed_blob_uri: Optional[str] = rest_field(name="seedBlobUri", visibility=["read"]) + """The uri of the seed blob.""" + target_managed_disk_id: Optional[str] = rest_field(name="targetManagedDiskId", visibility=["read"]) + """The ARM Id of the target managed disk.""" + disk_type: Optional[Union[str, "_models.DiskAccountType"]] = rest_field( + name="diskType", visibility=["read", "create", "update", "delete", "query"] + ) + """The disk type. Known values are: \"Standard_LRS\", \"Premium_LRS\", \"StandardSSD_LRS\", + \"PremiumV2_LRS\", \"UltraSSD_LRS\", \"StandardSSD_ZRS\", and \"Premium_ZRS\".""" + data_pending_in_log_data_store_in_mb: Optional[float] = rest_field( + name="dataPendingInLogDataStoreInMB", visibility=["read"] + ) + """The data pending in log data store in MB.""" + data_pending_at_source_agent_in_mb: Optional[float] = rest_field( + name="dataPendingAtSourceAgentInMB", visibility=["read"] + ) + """The data pending at source agent in MB.""" + is_initial_replication_complete: Optional[str] = rest_field( + name="isInitialReplicationComplete", visibility=["read"] + ) + """A value indicating whether initial replication is complete or not.""" + ir_details: Optional["_models.InMageRcmSyncDetails"] = rest_field( + name="irDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """The initial replication details.""" + resync_details: Optional["_models.InMageRcmSyncDetails"] = rest_field( + name="resyncDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """The resync details.""" + custom_target_disk_name: Optional[str] = rest_field( + name="customTargetDiskName", visibility=["read", "create", "update", "delete", "query"] + ) + """The custom target Azure disk name.""" + sector_size_in_bytes: Optional[int] = rest_field( + name="sectorSizeInBytes", visibility=["read", "create", "update", "delete", "query"] + ) + """The logical sector size (in bytes), 512 by default.""" + iops: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The number of IOPS allowed for Premium V2 and Ultra disks.""" + throughput_in_mbps: Optional[int] = rest_field( + name="throughputInMbps", visibility=["read", "create", "update", "delete", "query"] + ) + """The total throughput in Mbps for Premium V2 and Ultra disks.""" + disk_size_in_gb: Optional[int] = rest_field( + name="diskSizeInGB", visibility=["read", "create", "update", "delete", "query"] + ) + """The target disk size in GB.""" + + @overload + def __init__( + self, + *, + disk_type: Optional[Union[str, "_models.DiskAccountType"]] = None, + ir_details: Optional["_models.InMageRcmSyncDetails"] = None, + resync_details: Optional["_models.InMageRcmSyncDetails"] = None, + custom_target_disk_name: Optional[str] = None, + sector_size_in_bytes: Optional[int] = None, + iops: Optional[int] = None, + throughput_in_mbps: Optional[int] = None, + disk_size_in_gb: 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 InMageRcmProtectionContainerMappingDetails( + ProtectionContainerMappingProviderSpecificDetails, discriminator="InMageRcm" +): # pylint: disable=name-too-long + """InMageRcm provider specific container mapping details. + + :ivar enable_agent_auto_upgrade: A value indicating whether the flag for enable agent auto + upgrade. + :vartype enable_agent_auto_upgrade: str + :ivar instance_type: Gets the class type. Overridden in derived classes. Required. Default + value is "InMageRcm". + :vartype instance_type: str + """ + + enable_agent_auto_upgrade: Optional[str] = rest_field(name="enableAgentAutoUpgrade", visibility=["read"]) + """A value indicating whether the flag for enable agent auto upgrade.""" + instance_type: Literal["InMageRcm"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets the class type. Overridden in derived classes. Required. Default value is \"InMageRcm\".""" + + @overload + def __init__( + self, + ) -> 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) + self.instance_type = "InMageRcm" # type: ignore + + +class InMageRcmRecoveryPointDetails(ProviderSpecificRecoveryPointDetails, discriminator="InMageRcm"): + """InMageRcm provider specific recovery point details. + + :ivar is_multi_vm_sync_point: A value indicating whether the recovery point is multi VM + consistent. + :vartype is_multi_vm_sync_point: str + :ivar instance_type: Gets the provider type. Required. Default value is "InMageRcm". + :vartype instance_type: str + """ + + is_multi_vm_sync_point: Optional[str] = rest_field(name="isMultiVmSyncPoint", visibility=["read"]) + """A value indicating whether the recovery point is multi VM consistent.""" + instance_type: Literal["InMageRcm"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets the provider type. Required. Default value is \"InMageRcm\".""" + + @overload + def __init__( + self, + ) -> 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) + self.instance_type = "InMageRcm" # type: ignore + + +class InMageRcmReplicationDetails(ReplicationProviderSpecificSettings, discriminator="InMageRcm"): + """InMageRcm provider specific details. + + :ivar internal_identifier: The virtual machine internal identifier. + :vartype internal_identifier: str + :ivar fabric_discovery_machine_id: The ARM Id of the discovered VM. + :vartype fabric_discovery_machine_id: str + :ivar multi_vm_group_name: The multi VM group name. + :vartype multi_vm_group_name: str + :ivar discovery_type: The type of the discovered VM. + :vartype discovery_type: str + :ivar process_server_id: The process server Id. + :vartype process_server_id: str + :ivar processor_core_count: The processor core count. + :vartype processor_core_count: int + :ivar allocated_memory_in_mb: The allocated memory in MB. + :vartype allocated_memory_in_mb: float + :ivar process_server_name: The process server name. + :vartype process_server_name: str + :ivar run_as_account_id: The run-as account Id. + :vartype run_as_account_id: str + :ivar os_type: The type of the OS on the VM. + :vartype os_type: str + :ivar firmware_type: The firmware type. + :vartype firmware_type: str + :ivar primary_nic_ip_address: The IP address of the primary network interface. + :vartype primary_nic_ip_address: str + :ivar target_generation: The target generation. + :vartype target_generation: str + :ivar license_type: License Type of the VM to be used. + :vartype license_type: str + :ivar linux_license_type: The license type for Linux VM's. Known values are: "NotSpecified", + "NoLicenseType", and "LinuxServer". + :vartype linux_license_type: str or + ~azure.mgmt.recoveryservicessiterecovery.models.LinuxLicenseType + :ivar storage_account_id: The replication storage account ARM Id. This is applicable only for + the blob based replication test hook. + :vartype storage_account_id: str + :ivar target_vm_name: Target VM name. + :vartype target_vm_name: str + :ivar target_vm_size: The target VM size. + :vartype target_vm_size: str + :ivar target_resource_group_id: The target resource group Id. + :vartype target_resource_group_id: str + :ivar target_location: The target location. + :vartype target_location: str + :ivar target_availability_set_id: The target availability set Id. + :vartype target_availability_set_id: str + :ivar target_availability_zone: The target availability zone. + :vartype target_availability_zone: str + :ivar target_proximity_placement_group_id: The target proximity placement group Id. + :vartype target_proximity_placement_group_id: str + :ivar target_boot_diagnostics_storage_account_id: The target boot diagnostics storage account + ARM Id. + :vartype target_boot_diagnostics_storage_account_id: str + :ivar target_network_id: The target network Id. + :vartype target_network_id: str + :ivar test_network_id: The test network Id. + :vartype test_network_id: str + :ivar failover_recovery_point_id: The recovery point Id to which the VM was failed over. + :vartype failover_recovery_point_id: str + :ivar last_recovery_point_received: The last recovery point received time. + :vartype last_recovery_point_received: ~datetime.datetime + :ivar last_rpo_in_seconds: The last recovery point objective value. + :vartype last_rpo_in_seconds: int + :ivar last_rpo_calculated_time: The last recovery point objective calculated time. + :vartype last_rpo_calculated_time: ~datetime.datetime + :ivar last_recovery_point_id: The last recovery point Id. + :vartype last_recovery_point_id: str + :ivar initial_replication_progress_percentage: The initial replication progress percentage. + This is calculated based on total bytes processed for all disks in the source VM. + :vartype initial_replication_progress_percentage: int + :ivar initial_replication_processed_bytes: The initial replication processed bytes. This + includes sum of total bytes transferred and matched bytes on all selected disks in source VM. + :vartype initial_replication_processed_bytes: int + :ivar initial_replication_transferred_bytes: The initial replication transferred bytes from + source VM to azure for all selected disks on source VM. + :vartype initial_replication_transferred_bytes: int + :ivar initial_replication_progress_health: The initial replication progress health. Known + values are: "None", "InProgress", "SlowProgress", and "NoProgress". + :vartype initial_replication_progress_health: str or + ~azure.mgmt.recoveryservicessiterecovery.models.VmReplicationProgressHealth + :ivar resync_progress_percentage: The resync progress percentage. This is calculated based on + total bytes processed for all disks in the source VM. + :vartype resync_progress_percentage: int + :ivar resync_processed_bytes: The resync processed bytes. This includes sum of total bytes + transferred and matched bytes on all selected disks in source VM. + :vartype resync_processed_bytes: int + :ivar resync_transferred_bytes: The resync transferred bytes from source VM to azure for all + selected disks on source VM. + :vartype resync_transferred_bytes: int + :ivar resync_progress_health: The resync progress health. Known values are: "None", + "InProgress", "SlowProgress", and "NoProgress". + :vartype resync_progress_health: str or + ~azure.mgmt.recoveryservicessiterecovery.models.VmReplicationProgressHealth + :ivar resync_required: A value indicating whether resync is required. + :vartype resync_required: str + :ivar resync_state: The resync state. Known values are: "None", "PreparedForResynchronization", + and "StartedResynchronization". + :vartype resync_state: str or ~azure.mgmt.recoveryservicessiterecovery.models.ResyncState + :ivar agent_upgrade_state: The agent auto upgrade state. Known values are: "None", "Started", + "Completed", and "Commit". + :vartype agent_upgrade_state: str or + ~azure.mgmt.recoveryservicessiterecovery.models.MobilityAgentUpgradeState + :ivar last_agent_upgrade_type: The last agent upgrade type. + :vartype last_agent_upgrade_type: str + :ivar agent_upgrade_job_id: The agent upgrade job Id. + :vartype agent_upgrade_job_id: str + :ivar agent_upgrade_attempt_to_version: The agent version to which last agent upgrade was + attempted. + :vartype agent_upgrade_attempt_to_version: str + :ivar protected_disks: The list of protected disks. + :vartype protected_disks: + list[~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmProtectedDiskDetails] + :ivar unprotected_disks: The list of unprotected disks. + :vartype unprotected_disks: + list[~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmUnProtectedDiskDetails] + :ivar is_last_upgrade_successful: A value indicating whether last agent upgrade was successful + or not. + :vartype is_last_upgrade_successful: str + :ivar is_agent_registration_successful_after_failover: A value indicating whether agent + registration was successful after failover. + :vartype is_agent_registration_successful_after_failover: bool + :ivar mobility_agent_details: The mobility agent information. + :vartype mobility_agent_details: + ~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmMobilityAgentDetails + :ivar last_agent_upgrade_error_details: The last agent upgrade error information. + :vartype last_agent_upgrade_error_details: + list[~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmLastAgentUpgradeErrorDetails] + :ivar agent_upgrade_blocking_error_details: The agent upgrade blocking error information. + :vartype agent_upgrade_blocking_error_details: + list[~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmAgentUpgradeBlockingErrorDetails] + :ivar vm_nics: The network details. + :vartype vm_nics: list[~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmNicDetails] + :ivar discovered_vm_details: The discovered VM details. + :vartype discovered_vm_details: + ~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmDiscoveredProtectedVmDetails + :ivar target_vm_tags: The target VM tags. + :vartype target_vm_tags: + list[~azure.mgmt.recoveryservicessiterecovery.models.UserCreatedResourceTag] + :ivar seed_managed_disk_tags: The tags for the seed managed disks. + :vartype seed_managed_disk_tags: + list[~azure.mgmt.recoveryservicessiterecovery.models.UserCreatedResourceTag] + :ivar target_managed_disk_tags: The tags for the target managed disks. + :vartype target_managed_disk_tags: + list[~azure.mgmt.recoveryservicessiterecovery.models.UserCreatedResourceTag] + :ivar target_nic_tags: The tags for the target NICs. + :vartype target_nic_tags: + list[~azure.mgmt.recoveryservicessiterecovery.models.UserCreatedResourceTag] + :ivar sql_server_license_type: The SQL Server license type. + :vartype sql_server_license_type: str + :ivar supported_os_versions: A value indicating the inplace OS Upgrade version. + :vartype supported_os_versions: list[str] + :ivar os_name: The OS name associated with VM. + :vartype os_name: str + :ivar target_vm_security_profile: The target VM security profile. + :vartype target_vm_security_profile: + ~azure.mgmt.recoveryservicessiterecovery.models.SecurityProfileProperties + :ivar target_capacity_reservation_group_id: The target capacity reservation group ARM Id. + :vartype target_capacity_reservation_group_id: str + :ivar instance_type: Gets the Instance type. Required. Default value is "InMageRcm". + :vartype instance_type: str + """ + + internal_identifier: Optional[str] = rest_field(name="internalIdentifier", visibility=["read"]) + """The virtual machine internal identifier.""" + fabric_discovery_machine_id: Optional[str] = rest_field(name="fabricDiscoveryMachineId", visibility=["read"]) + """The ARM Id of the discovered VM.""" + multi_vm_group_name: Optional[str] = rest_field(name="multiVmGroupName", visibility=["read"]) + """The multi VM group name.""" + discovery_type: Optional[str] = rest_field(name="discoveryType", visibility=["read"]) + """The type of the discovered VM.""" + process_server_id: Optional[str] = rest_field(name="processServerId", visibility=["read"]) + """The process server Id.""" + processor_core_count: Optional[int] = rest_field(name="processorCoreCount", visibility=["read"]) + """The processor core count.""" + allocated_memory_in_mb: Optional[float] = rest_field(name="allocatedMemoryInMB", visibility=["read"]) + """The allocated memory in MB.""" + process_server_name: Optional[str] = rest_field(name="processServerName", visibility=["read"]) + """The process server name.""" + run_as_account_id: Optional[str] = rest_field(name="runAsAccountId", visibility=["read"]) + """The run-as account Id.""" + os_type: Optional[str] = rest_field(name="osType", visibility=["read"]) + """The type of the OS on the VM.""" + firmware_type: Optional[str] = rest_field(name="firmwareType", visibility=["read"]) + """The firmware type.""" + primary_nic_ip_address: Optional[str] = rest_field(name="primaryNicIpAddress", visibility=["read"]) + """The IP address of the primary network interface.""" + target_generation: Optional[str] = rest_field(name="targetGeneration", visibility=["read"]) + """The target generation.""" + license_type: Optional[str] = rest_field( + name="licenseType", visibility=["read", "create", "update", "delete", "query"] + ) + """License Type of the VM to be used.""" + linux_license_type: Optional[Union[str, "_models.LinuxLicenseType"]] = rest_field( + name="linuxLicenseType", visibility=["read", "create", "update", "delete", "query"] + ) + """The license type for Linux VM's. Known values are: \"NotSpecified\", \"NoLicenseType\", and + \"LinuxServer\".""" + storage_account_id: Optional[str] = rest_field(name="storageAccountId", visibility=["read"]) + """The replication storage account ARM Id. This is applicable only for the blob based replication + test hook.""" + target_vm_name: Optional[str] = rest_field( + name="targetVmName", visibility=["read", "create", "update", "delete", "query"] + ) + """Target VM name.""" + target_vm_size: Optional[str] = rest_field( + name="targetVmSize", visibility=["read", "create", "update", "delete", "query"] + ) + """The target VM size.""" + target_resource_group_id: Optional[str] = rest_field( + name="targetResourceGroupId", visibility=["read", "create", "update", "delete", "query"] + ) + """The target resource group Id.""" + target_location: Optional[str] = rest_field( + name="targetLocation", visibility=["read", "create", "update", "delete", "query"] + ) + """The target location.""" + target_availability_set_id: Optional[str] = rest_field( + name="targetAvailabilitySetId", visibility=["read", "create", "update", "delete", "query"] + ) + """The target availability set Id.""" + target_availability_zone: Optional[str] = rest_field( + name="targetAvailabilityZone", visibility=["read", "create", "update", "delete", "query"] + ) + """The target availability zone.""" + target_proximity_placement_group_id: Optional[str] = rest_field( + name="targetProximityPlacementGroupId", visibility=["read", "create", "update", "delete", "query"] + ) + """The target proximity placement group Id.""" + target_boot_diagnostics_storage_account_id: Optional[str] = rest_field( + name="targetBootDiagnosticsStorageAccountId", visibility=["read", "create", "update", "delete", "query"] + ) + """The target boot diagnostics storage account ARM Id.""" + target_network_id: Optional[str] = rest_field( + name="targetNetworkId", visibility=["read", "create", "update", "delete", "query"] + ) + """The target network Id.""" + test_network_id: Optional[str] = rest_field( + name="testNetworkId", visibility=["read", "create", "update", "delete", "query"] + ) + """The test network Id.""" + failover_recovery_point_id: Optional[str] = rest_field(name="failoverRecoveryPointId", visibility=["read"]) + """The recovery point Id to which the VM was failed over.""" + last_recovery_point_received: Optional[datetime.datetime] = rest_field( + name="lastRecoveryPointReceived", visibility=["read"], format="rfc3339" + ) + """The last recovery point received time.""" + last_rpo_in_seconds: Optional[int] = rest_field(name="lastRpoInSeconds", visibility=["read"]) + """The last recovery point objective value.""" + last_rpo_calculated_time: Optional[datetime.datetime] = rest_field( + name="lastRpoCalculatedTime", visibility=["read"], format="rfc3339" + ) + """The last recovery point objective calculated time.""" + last_recovery_point_id: Optional[str] = rest_field(name="lastRecoveryPointId", visibility=["read"]) + """The last recovery point Id.""" + initial_replication_progress_percentage: Optional[int] = rest_field( + name="initialReplicationProgressPercentage", visibility=["read"] + ) + """The initial replication progress percentage. This is calculated based on total bytes processed + for all disks in the source VM.""" + initial_replication_processed_bytes: Optional[int] = rest_field( + name="initialReplicationProcessedBytes", visibility=["read"] + ) + """The initial replication processed bytes. This includes sum of total bytes transferred and + matched bytes on all selected disks in source VM.""" + initial_replication_transferred_bytes: Optional[int] = rest_field( + name="initialReplicationTransferredBytes", visibility=["read"] + ) + """The initial replication transferred bytes from source VM to azure for all selected disks on + source VM.""" + initial_replication_progress_health: Optional[Union[str, "_models.VmReplicationProgressHealth"]] = rest_field( + name="initialReplicationProgressHealth", visibility=["read"] + ) + """The initial replication progress health. Known values are: \"None\", \"InProgress\", + \"SlowProgress\", and \"NoProgress\".""" + resync_progress_percentage: Optional[int] = rest_field(name="resyncProgressPercentage", visibility=["read"]) + """The resync progress percentage. This is calculated based on total bytes processed for all disks + in the source VM.""" + resync_processed_bytes: Optional[int] = rest_field(name="resyncProcessedBytes", visibility=["read"]) + """The resync processed bytes. This includes sum of total bytes transferred and matched bytes on + all selected disks in source VM.""" + resync_transferred_bytes: Optional[int] = rest_field(name="resyncTransferredBytes", visibility=["read"]) + """The resync transferred bytes from source VM to azure for all selected disks on source VM.""" + resync_progress_health: Optional[Union[str, "_models.VmReplicationProgressHealth"]] = rest_field( + name="resyncProgressHealth", visibility=["read"] + ) + """The resync progress health. Known values are: \"None\", \"InProgress\", \"SlowProgress\", and + \"NoProgress\".""" + resync_required: Optional[str] = rest_field(name="resyncRequired", visibility=["read"]) + """A value indicating whether resync is required.""" + resync_state: Optional[Union[str, "_models.ResyncState"]] = rest_field(name="resyncState", visibility=["read"]) + """The resync state. Known values are: \"None\", \"PreparedForResynchronization\", and + \"StartedResynchronization\".""" + agent_upgrade_state: Optional[Union[str, "_models.MobilityAgentUpgradeState"]] = rest_field( + name="agentUpgradeState", visibility=["read"] + ) + """The agent auto upgrade state. Known values are: \"None\", \"Started\", \"Completed\", and + \"Commit\".""" + last_agent_upgrade_type: Optional[str] = rest_field(name="lastAgentUpgradeType", visibility=["read"]) + """The last agent upgrade type.""" + agent_upgrade_job_id: Optional[str] = rest_field(name="agentUpgradeJobId", visibility=["read"]) + """The agent upgrade job Id.""" + agent_upgrade_attempt_to_version: Optional[str] = rest_field( + name="agentUpgradeAttemptToVersion", visibility=["read"] + ) + """The agent version to which last agent upgrade was attempted.""" + protected_disks: Optional[list["_models.InMageRcmProtectedDiskDetails"]] = rest_field( + name="protectedDisks", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of protected disks.""" + unprotected_disks: Optional[list["_models.InMageRcmUnProtectedDiskDetails"]] = rest_field( + name="unprotectedDisks", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of unprotected disks.""" + is_last_upgrade_successful: Optional[str] = rest_field(name="isLastUpgradeSuccessful", visibility=["read"]) + """A value indicating whether last agent upgrade was successful or not.""" + is_agent_registration_successful_after_failover: Optional[bool] = rest_field( + name="isAgentRegistrationSuccessfulAfterFailover", visibility=["read"] + ) + """A value indicating whether agent registration was successful after failover.""" + mobility_agent_details: Optional["_models.InMageRcmMobilityAgentDetails"] = rest_field( + name="mobilityAgentDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """The mobility agent information.""" + last_agent_upgrade_error_details: Optional[list["_models.InMageRcmLastAgentUpgradeErrorDetails"]] = rest_field( + name="lastAgentUpgradeErrorDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """The last agent upgrade error information.""" + agent_upgrade_blocking_error_details: Optional[list["_models.InMageRcmAgentUpgradeBlockingErrorDetails"]] = ( + rest_field(name="agentUpgradeBlockingErrorDetails", visibility=["read", "create", "update", "delete", "query"]) + ) + """The agent upgrade blocking error information.""" + vm_nics: Optional[list["_models.InMageRcmNicDetails"]] = rest_field( + name="vmNics", visibility=["read", "create", "update", "delete", "query"] + ) + """The network details.""" + discovered_vm_details: Optional["_models.InMageRcmDiscoveredProtectedVmDetails"] = rest_field( + name="discoveredVmDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """The discovered VM details.""" + target_vm_tags: Optional[list["_models.UserCreatedResourceTag"]] = rest_field( + name="targetVmTags", visibility=["read", "create", "update", "delete", "query"] + ) + """The target VM tags.""" + seed_managed_disk_tags: Optional[list["_models.UserCreatedResourceTag"]] = rest_field( + name="seedManagedDiskTags", visibility=["read", "create", "update", "delete", "query"] + ) + """The tags for the seed managed disks.""" + target_managed_disk_tags: Optional[list["_models.UserCreatedResourceTag"]] = rest_field( + name="targetManagedDiskTags", visibility=["read", "create", "update", "delete", "query"] + ) + """The tags for the target managed disks.""" + target_nic_tags: Optional[list["_models.UserCreatedResourceTag"]] = rest_field( + name="targetNicTags", visibility=["read", "create", "update", "delete", "query"] + ) + """The tags for the target NICs.""" + sql_server_license_type: Optional[str] = rest_field( + name="sqlServerLicenseType", visibility=["read", "create", "update", "delete", "query"] + ) + """The SQL Server license type.""" + supported_os_versions: Optional[list[str]] = rest_field( + name="supportedOSVersions", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating the inplace OS Upgrade version.""" + os_name: Optional[str] = rest_field(name="osName", visibility=["read", "create", "update", "delete", "query"]) + """The OS name associated with VM.""" + target_vm_security_profile: Optional["_models.SecurityProfileProperties"] = rest_field( + name="targetVmSecurityProfile", visibility=["read", "create", "update", "delete", "query"] + ) + """The target VM security profile.""" + target_capacity_reservation_group_id: Optional[str] = rest_field( + name="targetCapacityReservationGroupId", visibility=["read", "create", "update", "delete", "query"] + ) + """The target capacity reservation group ARM Id.""" + instance_type: Literal["InMageRcm"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets the Instance type. Required. Default value is \"InMageRcm\".""" + + @overload + def __init__( # pylint: disable=too-many-locals + self, + *, + license_type: Optional[str] = None, + linux_license_type: Optional[Union[str, "_models.LinuxLicenseType"]] = None, + target_vm_name: Optional[str] = None, + target_vm_size: Optional[str] = None, + target_resource_group_id: Optional[str] = None, + target_location: Optional[str] = None, + target_availability_set_id: Optional[str] = None, + target_availability_zone: Optional[str] = None, + target_proximity_placement_group_id: Optional[str] = None, + target_boot_diagnostics_storage_account_id: Optional[str] = None, + target_network_id: Optional[str] = None, + test_network_id: Optional[str] = None, + protected_disks: Optional[list["_models.InMageRcmProtectedDiskDetails"]] = None, + unprotected_disks: Optional[list["_models.InMageRcmUnProtectedDiskDetails"]] = None, + mobility_agent_details: Optional["_models.InMageRcmMobilityAgentDetails"] = None, + last_agent_upgrade_error_details: Optional[list["_models.InMageRcmLastAgentUpgradeErrorDetails"]] = None, + agent_upgrade_blocking_error_details: Optional[ + list["_models.InMageRcmAgentUpgradeBlockingErrorDetails"] + ] = None, + vm_nics: Optional[list["_models.InMageRcmNicDetails"]] = None, + discovered_vm_details: Optional["_models.InMageRcmDiscoveredProtectedVmDetails"] = None, + target_vm_tags: Optional[list["_models.UserCreatedResourceTag"]] = None, + seed_managed_disk_tags: Optional[list["_models.UserCreatedResourceTag"]] = None, + target_managed_disk_tags: Optional[list["_models.UserCreatedResourceTag"]] = None, + target_nic_tags: Optional[list["_models.UserCreatedResourceTag"]] = None, + sql_server_license_type: Optional[str] = None, + supported_os_versions: Optional[list[str]] = None, + os_name: Optional[str] = None, + target_vm_security_profile: Optional["_models.SecurityProfileProperties"] = None, + target_capacity_reservation_group_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) + self.instance_type = "InMageRcm" # type: ignore + + +class InMageRcmReprotectInput(ReverseReplicationProviderSpecificInput, discriminator="InMageRcm"): + """InMageRcm specific provider input. + + :ivar reprotect_agent_id: The reprotect agent Id. Required. + :vartype reprotect_agent_id: str + :ivar datastore_name: The target datastore name. Required. + :vartype datastore_name: str + :ivar log_storage_account_id: The log storage account ARM Id. Required. + :vartype log_storage_account_id: str + :ivar policy_id: The Policy Id. + :vartype policy_id: str + :ivar instance_type: The class type. Required. Default value is "InMageRcm". + :vartype instance_type: str + """ + + reprotect_agent_id: str = rest_field( + name="reprotectAgentId", visibility=["read", "create", "update", "delete", "query"] + ) + """The reprotect agent Id. Required.""" + datastore_name: str = rest_field(name="datastoreName", visibility=["read", "create", "update", "delete", "query"]) + """The target datastore name. Required.""" + log_storage_account_id: str = rest_field( + name="logStorageAccountId", visibility=["read", "create", "update", "delete", "query"] + ) + """The log storage account ARM Id. Required.""" + policy_id: Optional[str] = rest_field(name="policyId", visibility=["read", "create", "update", "delete", "query"]) + """The Policy Id.""" + instance_type: Literal["InMageRcm"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The class type. Required. Default value is \"InMageRcm\".""" + + @overload + def __init__( + self, + *, + reprotect_agent_id: str, + datastore_name: str, + log_storage_account_id: str, + policy_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) + self.instance_type = "InMageRcm" # type: ignore + + +class InMageRcmSyncDetails(_Model): + """InMageRcm disk level sync details. + + :ivar progress_health: The progress health. Known values are: "None", "InProgress", + "SlowProgress", "NoProgress", and "Queued". + :vartype progress_health: str or + ~azure.mgmt.recoveryservicessiterecovery.models.DiskReplicationProgressHealth + :ivar transferred_bytes: The transferred bytes from source VM to azure for the disk. + :vartype transferred_bytes: int + :ivar last15_minutes_transferred_bytes: The bytes transferred in last 15 minutes from source VM + to azure. + :vartype last15_minutes_transferred_bytes: int + :ivar last_data_transfer_time_utc: The time of the last data transfer from source VM to azure. + :vartype last_data_transfer_time_utc: str + :ivar processed_bytes: The total processed bytes. This includes bytes that are transferred from + source VM to azure and matched bytes. + :vartype processed_bytes: int + :ivar start_time: The start time. + :vartype start_time: str + :ivar last_refresh_time: The last refresh time. + :vartype last_refresh_time: str + :ivar progress_percentage: Progress in percentage. Progress percentage is calculated based on + processed bytes. + :vartype progress_percentage: int + """ + + progress_health: Optional[Union[str, "_models.DiskReplicationProgressHealth"]] = rest_field( + name="progressHealth", visibility=["read"] + ) + """The progress health. Known values are: \"None\", \"InProgress\", \"SlowProgress\", + \"NoProgress\", and \"Queued\".""" + transferred_bytes: Optional[int] = rest_field(name="transferredBytes", visibility=["read"]) + """The transferred bytes from source VM to azure for the disk.""" + last15_minutes_transferred_bytes: Optional[int] = rest_field( + name="last15MinutesTransferredBytes", visibility=["read"] + ) + """The bytes transferred in last 15 minutes from source VM to azure.""" + last_data_transfer_time_utc: Optional[str] = rest_field(name="lastDataTransferTimeUtc", visibility=["read"]) + """The time of the last data transfer from source VM to azure.""" + processed_bytes: Optional[int] = rest_field(name="processedBytes", visibility=["read"]) + """The total processed bytes. This includes bytes that are transferred from source VM to azure and + matched bytes.""" + start_time: Optional[str] = rest_field(name="startTime", visibility=["read"]) + """The start time.""" + last_refresh_time: Optional[str] = rest_field(name="lastRefreshTime", visibility=["read"]) + """The last refresh time.""" + progress_percentage: Optional[int] = rest_field(name="progressPercentage", visibility=["read"]) + """Progress in percentage. Progress percentage is calculated based on processed bytes.""" + + +class InMageRcmTestFailoverInput(TestFailoverProviderSpecificInput, discriminator="InMageRcm"): + """InMageRcm provider specific input for test failover. + + :ivar network_id: The test network Id. + :vartype network_id: str + :ivar recovery_point_id: The recovery point id to be passed to test failover to a particular + recovery point. In case of latest recovery point, null should be passed. + :vartype recovery_point_id: str + :ivar os_upgrade_version: A value indicating the inplace OS Upgrade version. + :vartype os_upgrade_version: str + :ivar instance_type: The class type. Required. Default value is "InMageRcm". + :vartype instance_type: str + """ + + network_id: Optional[str] = rest_field(name="networkId", visibility=["read", "create", "update", "delete", "query"]) + """The test network Id.""" + recovery_point_id: Optional[str] = rest_field( + name="recoveryPointId", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery point id to be passed to test failover to a particular recovery point. In case of + latest recovery point, null should be passed.""" + os_upgrade_version: Optional[str] = rest_field( + name="osUpgradeVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating the inplace OS Upgrade version.""" + instance_type: Literal["InMageRcm"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The class type. Required. Default value is \"InMageRcm\".""" + + @overload + def __init__( + self, + *, + network_id: Optional[str] = None, + recovery_point_id: Optional[str] = None, + os_upgrade_version: 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) + self.instance_type = "InMageRcm" # type: ignore + + +class InMageRcmUnplannedFailoverInput(UnplannedFailoverProviderSpecificInput, discriminator="InMageRcm"): + """InMageRcm provider specific input for unplanned failover. + + :ivar perform_shutdown: A value indicating whether VM is to be shutdown. Required. + :vartype perform_shutdown: str + :ivar recovery_point_id: The recovery point id to be passed to failover to a particular + recovery point. In case of latest recovery point, null should be passed. + :vartype recovery_point_id: str + :ivar os_upgrade_version: A value indicating the inplace OS Upgrade version. + :vartype os_upgrade_version: str + :ivar target_capacity_reservation_group_id: The target capacity reservation group ARM Id. + :vartype target_capacity_reservation_group_id: str + :ivar instance_type: The class type. Required. Default value is "InMageRcm". + :vartype instance_type: str + """ + + perform_shutdown: str = rest_field( + name="performShutdown", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether VM is to be shutdown. Required.""" + recovery_point_id: Optional[str] = rest_field( + name="recoveryPointId", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery point id to be passed to failover to a particular recovery point. In case of + latest recovery point, null should be passed.""" + os_upgrade_version: Optional[str] = rest_field( + name="osUpgradeVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating the inplace OS Upgrade version.""" + target_capacity_reservation_group_id: Optional[str] = rest_field( + name="targetCapacityReservationGroupId", visibility=["read", "create", "update", "delete", "query"] + ) + """The target capacity reservation group ARM Id.""" + instance_type: Literal["InMageRcm"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The class type. Required. Default value is \"InMageRcm\".""" + + @overload + def __init__( + self, + *, + perform_shutdown: str, + recovery_point_id: Optional[str] = None, + os_upgrade_version: Optional[str] = None, + target_capacity_reservation_group_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) + self.instance_type = "InMageRcm" # type: ignore + + +class InMageRcmUnProtectedDiskDetails(_Model): + """InMageRcm un-protected disk details. + + :ivar disk_id: The disk Id. + :vartype disk_id: str + :ivar disk_name: The disk name. + :vartype disk_name: str + :ivar capacity_in_bytes: The disk capacity in bytes. + :vartype capacity_in_bytes: int + """ + + disk_id: Optional[str] = rest_field(name="diskId", visibility=["read"]) + """The disk Id.""" + disk_name: Optional[str] = rest_field(name="diskName", visibility=["read"]) + """The disk name.""" + capacity_in_bytes: Optional[int] = rest_field(name="capacityInBytes", visibility=["read"]) + """The disk capacity in bytes.""" + + +class UpdateApplianceForReplicationProtectedItemProviderSpecificInput(_Model): # pylint: disable=name-too-long + """Update replication protected item provider specific input. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + InMageRcmUpdateApplianceForReplicationProtectedItemInput + + :ivar instance_type: The class type. Required. Default value is None. + :vartype instance_type: str + """ + + __mapping__: dict[str, _Model] = {} + instance_type: str = rest_discriminator( + name="instanceType", visibility=["read", "create", "update", "delete", "query"] + ) + """The class type. Required. Default value is None.""" + + @overload + def __init__( + self, + *, + instance_type: str, + ) -> 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 InMageRcmUpdateApplianceForReplicationProtectedItemInput( + UpdateApplianceForReplicationProtectedItemProviderSpecificInput, discriminator="InMageRcm" +): # pylint: disable=name-too-long + """InMageRcm provider specific input to update appliance for replication protected item. + + :ivar run_as_account_id: The run as account Id. + :vartype run_as_account_id: str + :ivar instance_type: The class type. Required. Default value is "InMageRcm". + :vartype instance_type: str + """ + + run_as_account_id: Optional[str] = rest_field( + name="runAsAccountId", visibility=["read", "create", "update", "delete", "query"] + ) + """The run as account Id.""" + instance_type: Literal["InMageRcm"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The class type. Required. Default value is \"InMageRcm\".""" + + @overload + def __init__( + self, + *, + run_as_account_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) + self.instance_type = "InMageRcm" # type: ignore + + +class InMageRcmUpdateContainerMappingInput( + ReplicationProviderSpecificUpdateContainerMappingInput, discriminator="InMageRcm" +): + """InMageRcm update protection container mapping. + + :ivar enable_agent_auto_upgrade: A value indicating whether agent auto upgrade has to be + enabled. Required. + :vartype enable_agent_auto_upgrade: str + :ivar instance_type: The class type. Required. Default value is "InMageRcm". + :vartype instance_type: str + """ + + enable_agent_auto_upgrade: str = rest_field( + name="enableAgentAutoUpgrade", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether agent auto upgrade has to be enabled. Required.""" + instance_type: Literal["InMageRcm"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The class type. Required. Default value is \"InMageRcm\".""" + + @overload + def __init__( + self, + *, + enable_agent_auto_upgrade: str, + ) -> 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) + self.instance_type = "InMageRcm" # type: ignore + + +class InMageRcmUpdateReplicationProtectedItemInput( + UpdateReplicationProtectedItemProviderInput, discriminator="InMageRcm" +): # pylint: disable=name-too-long + """InMageRcm provider specific input to update replication protected item. + + :ivar target_vm_name: The target VM name. + :vartype target_vm_name: str + :ivar target_vm_size: The target VM size. + :vartype target_vm_size: str + :ivar target_resource_group_id: The target resource group ARM Id. + :vartype target_resource_group_id: str + :ivar target_availability_set_id: The target availability set ARM Id. + :vartype target_availability_set_id: str + :ivar target_availability_zone: The target availability zone. + :vartype target_availability_zone: str + :ivar target_proximity_placement_group_id: The target proximity placement group Id. + :vartype target_proximity_placement_group_id: str + :ivar target_boot_diagnostics_storage_account_id: The target boot diagnostics storage account + ARM Id. + :vartype target_boot_diagnostics_storage_account_id: str + :ivar target_network_id: The target network ARM Id. + :vartype target_network_id: str + :ivar test_network_id: The test network ARM Id. + :vartype test_network_id: str + :ivar vm_nics: The list of NIC details. + :vartype vm_nics: list[~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmNicInput] + :ivar license_type: The license type. Known values are: "NotSpecified", "NoLicenseType", and + "WindowsServer". + :vartype license_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.LicenseType + :ivar sql_server_license_type: The SQL Server license type. Known values are: "NotSpecified", + "NoLicenseType", "PAYG", and "AHUB". + :vartype sql_server_license_type: str or + ~azure.mgmt.recoveryservicessiterecovery.models.SqlServerLicenseType + :ivar linux_license_type: The license type for Linux VM's. Known values are: "NotSpecified", + "NoLicenseType", and "LinuxServer". + :vartype linux_license_type: str or + ~azure.mgmt.recoveryservicessiterecovery.models.LinuxLicenseType + :ivar user_selected_os_name: The OS name selected by user. + :vartype user_selected_os_name: str + :ivar target_vm_tags: The target VM tags. + :vartype target_vm_tags: + list[~azure.mgmt.recoveryservicessiterecovery.models.UserCreatedResourceTag] + :ivar target_managed_disk_tags: The tags for the target managed disks. + :vartype target_managed_disk_tags: + list[~azure.mgmt.recoveryservicessiterecovery.models.UserCreatedResourceTag] + :ivar target_nic_tags: The tags for the target NICs. + :vartype target_nic_tags: + list[~azure.mgmt.recoveryservicessiterecovery.models.UserCreatedResourceTag] + :ivar vm_disks: The list of disk update properties. + :vartype vm_disks: list[~azure.mgmt.recoveryservicessiterecovery.models.UpdateDiskInput] + :ivar target_capacity_reservation_group_id: The target capacity reservation group ARM Id. + :vartype target_capacity_reservation_group_id: str + :ivar instance_type: The class type. Required. Default value is "InMageRcm". + :vartype instance_type: str + """ + + target_vm_name: Optional[str] = rest_field( + name="targetVmName", visibility=["read", "create", "update", "delete", "query"] + ) + """The target VM name.""" + target_vm_size: Optional[str] = rest_field( + name="targetVmSize", visibility=["read", "create", "update", "delete", "query"] + ) + """The target VM size.""" + target_resource_group_id: Optional[str] = rest_field( + name="targetResourceGroupId", visibility=["read", "create", "update", "delete", "query"] + ) + """The target resource group ARM Id.""" + target_availability_set_id: Optional[str] = rest_field( + name="targetAvailabilitySetId", visibility=["read", "create", "update", "delete", "query"] + ) + """The target availability set ARM Id.""" + target_availability_zone: Optional[str] = rest_field( + name="targetAvailabilityZone", visibility=["read", "create", "update", "delete", "query"] + ) + """The target availability zone.""" + target_proximity_placement_group_id: Optional[str] = rest_field( + name="targetProximityPlacementGroupId", visibility=["read", "create", "update", "delete", "query"] + ) + """The target proximity placement group Id.""" + target_boot_diagnostics_storage_account_id: Optional[str] = rest_field( + name="targetBootDiagnosticsStorageAccountId", visibility=["read", "create", "update", "delete", "query"] + ) + """The target boot diagnostics storage account ARM Id.""" + target_network_id: Optional[str] = rest_field( + name="targetNetworkId", visibility=["read", "create", "update", "delete", "query"] + ) + """The target network ARM Id.""" + test_network_id: Optional[str] = rest_field( + name="testNetworkId", visibility=["read", "create", "update", "delete", "query"] + ) + """The test network ARM Id.""" + vm_nics: Optional[list["_models.InMageRcmNicInput"]] = rest_field( + name="vmNics", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of NIC details.""" + license_type: Optional[Union[str, "_models.LicenseType"]] = rest_field( + name="licenseType", visibility=["read", "create", "update", "delete", "query"] + ) + """The license type. Known values are: \"NotSpecified\", \"NoLicenseType\", and \"WindowsServer\".""" + sql_server_license_type: Optional[Union[str, "_models.SqlServerLicenseType"]] = rest_field( + name="sqlServerLicenseType", visibility=["read", "create", "update", "delete", "query"] + ) + """The SQL Server license type. Known values are: \"NotSpecified\", \"NoLicenseType\", \"PAYG\", + and \"AHUB\".""" + linux_license_type: Optional[Union[str, "_models.LinuxLicenseType"]] = rest_field( + name="linuxLicenseType", visibility=["read", "create", "update", "delete", "query"] + ) + """The license type for Linux VM's. Known values are: \"NotSpecified\", \"NoLicenseType\", and + \"LinuxServer\".""" + user_selected_os_name: Optional[str] = rest_field( + name="userSelectedOSName", visibility=["read", "create", "update", "delete", "query"] + ) + """The OS name selected by user.""" + target_vm_tags: Optional[list["_models.UserCreatedResourceTag"]] = rest_field( + name="targetVmTags", visibility=["read", "create", "update", "delete", "query"] + ) + """The target VM tags.""" + target_managed_disk_tags: Optional[list["_models.UserCreatedResourceTag"]] = rest_field( + name="targetManagedDiskTags", visibility=["read", "create", "update", "delete", "query"] + ) + """The tags for the target managed disks.""" + target_nic_tags: Optional[list["_models.UserCreatedResourceTag"]] = rest_field( + name="targetNicTags", visibility=["read", "create", "update", "delete", "query"] + ) + """The tags for the target NICs.""" + vm_disks: Optional[list["_models.UpdateDiskInput"]] = rest_field( + name="vmDisks", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of disk update properties.""" + target_capacity_reservation_group_id: Optional[str] = rest_field( + name="targetCapacityReservationGroupId", visibility=["read", "create", "update", "delete", "query"] + ) + """The target capacity reservation group ARM Id.""" + instance_type: Literal["InMageRcm"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The class type. Required. Default value is \"InMageRcm\".""" + + @overload + def __init__( + self, + *, + target_vm_name: Optional[str] = None, + target_vm_size: Optional[str] = None, + target_resource_group_id: Optional[str] = None, + target_availability_set_id: Optional[str] = None, + target_availability_zone: Optional[str] = None, + target_proximity_placement_group_id: Optional[str] = None, + target_boot_diagnostics_storage_account_id: Optional[str] = None, + target_network_id: Optional[str] = None, + test_network_id: Optional[str] = None, + vm_nics: Optional[list["_models.InMageRcmNicInput"]] = None, + license_type: Optional[Union[str, "_models.LicenseType"]] = None, + sql_server_license_type: Optional[Union[str, "_models.SqlServerLicenseType"]] = None, + linux_license_type: Optional[Union[str, "_models.LinuxLicenseType"]] = None, + user_selected_os_name: Optional[str] = None, + target_vm_tags: Optional[list["_models.UserCreatedResourceTag"]] = None, + target_managed_disk_tags: Optional[list["_models.UserCreatedResourceTag"]] = None, + target_nic_tags: Optional[list["_models.UserCreatedResourceTag"]] = None, + vm_disks: Optional[list["_models.UpdateDiskInput"]] = None, + target_capacity_reservation_group_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) + self.instance_type = "InMageRcm" # type: ignore + + +class InMageReplicationDetails(ReplicationProviderSpecificSettings, discriminator="InMage"): + """InMage provider specific settings. + + :ivar active_site_type: The active location of the VM. If the VM is being protected from Azure, + this field will take values from { Azure, OnPrem }. If the VM is being protected between two + data-centers, this field will be OnPrem always. + :vartype active_site_type: str + :ivar source_vm_cpu_count: The CPU count of the VM on the primary side. + :vartype source_vm_cpu_count: int + :ivar source_vm_ram_size_in_mb: The RAM size of the VM on the primary side. + :vartype source_vm_ram_size_in_mb: int + :ivar os_details: The OS details. + :vartype os_details: ~azure.mgmt.recoveryservicessiterecovery.models.OSDiskDetails + :ivar protection_stage: The protection stage. + :vartype protection_stage: str + :ivar vm_id: The virtual machine Id. + :vartype vm_id: str + :ivar vm_protection_state: The protection state for the vm. + :vartype vm_protection_state: str + :ivar vm_protection_state_description: The protection state description for the vm. + :vartype vm_protection_state_description: str + :ivar resync_details: The resync details of the machine. + :vartype resync_details: + ~azure.mgmt.recoveryservicessiterecovery.models.InitialReplicationDetails + :ivar retention_window_start: The retention window start time. + :vartype retention_window_start: ~datetime.datetime + :ivar retention_window_end: The retention window end time. + :vartype retention_window_end: ~datetime.datetime + :ivar compressed_data_rate_in_mb: The compressed data change rate in MB. + :vartype compressed_data_rate_in_mb: float + :ivar uncompressed_data_rate_in_mb: The uncompressed data change rate in MB. + :vartype uncompressed_data_rate_in_mb: float + :ivar rpo_in_seconds: The RPO in seconds. + :vartype rpo_in_seconds: int + :ivar protected_disks: The list of protected disks. + :vartype protected_disks: + list[~azure.mgmt.recoveryservicessiterecovery.models.InMageProtectedDiskDetails] + :ivar ip_address: The source IP address. + :vartype ip_address: str + :ivar last_heartbeat: The last heartbeat received from the source server. + :vartype last_heartbeat: ~datetime.datetime + :ivar process_server_id: The process server Id. + :vartype process_server_id: str + :ivar master_target_id: The master target Id. + :vartype master_target_id: str + :ivar consistency_points: The collection of Consistency points. + :vartype consistency_points: dict[str, ~datetime.datetime] + :ivar disk_resized: A value indicating whether any disk is resized for this VM. + :vartype disk_resized: str + :ivar reboot_after_update_status: A value indicating whether the source server requires a + restart after update. + :vartype reboot_after_update_status: str + :ivar multi_vm_group_id: The multi vm group Id, if any. + :vartype multi_vm_group_id: str + :ivar multi_vm_group_name: The multi vm group name, if any. + :vartype multi_vm_group_name: str + :ivar multi_vm_sync_status: A value indicating whether the multi vm sync is enabled or + disabled. + :vartype multi_vm_sync_status: str + :ivar agent_details: The agent details. + :vartype agent_details: ~azure.mgmt.recoveryservicessiterecovery.models.InMageAgentDetails + :ivar v_center_infrastructure_id: The vCenter infrastructure Id. + :vartype v_center_infrastructure_id: str + :ivar infrastructure_vm_id: The infrastructure VM Id. + :vartype infrastructure_vm_id: str + :ivar vm_nics: The PE Network details. + :vartype vm_nics: list[~azure.mgmt.recoveryservicessiterecovery.models.VMNicDetails] + :ivar discovery_type: A value indicating the discovery type of the machine. + :vartype discovery_type: str + :ivar azure_storage_account_id: A value indicating the underlying Azure storage account. If the + VM is not running in Azure, this value shall be set to null. + :vartype azure_storage_account_id: str + :ivar datastores: The datastores of the on-premise machine Value can be list of strings that + contain datastore names. + :vartype datastores: list[str] + :ivar validation_errors: The validation errors of the on-premise machine Value can be list of + validation errors. + :vartype validation_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] + :ivar last_rpo_calculated_time: The last RPO calculated time. + :vartype last_rpo_calculated_time: ~datetime.datetime + :ivar last_update_received_time: The last update time received from on-prem components. + :vartype last_update_received_time: ~datetime.datetime + :ivar replica_id: The replica id of the protected item. + :vartype replica_id: str + :ivar os_version: The OS Version of the protected item. + :vartype os_version: str + :ivar is_additional_stats_available: A value indicating whether additional IR stats are + available or not. + :vartype is_additional_stats_available: bool + :ivar total_data_transferred: The total transferred data in bytes. + :vartype total_data_transferred: int + :ivar total_progress_health: The progress health. + :vartype total_progress_health: str + :ivar instance_type: Gets the Instance type. Required. Default value is "InMage". + :vartype instance_type: str + """ + + active_site_type: Optional[str] = rest_field( + name="activeSiteType", visibility=["read", "create", "update", "delete", "query"] + ) + """The active location of the VM. If the VM is being protected from Azure, this field will take + values from { Azure, OnPrem }. If the VM is being protected between two data-centers, this + field will be OnPrem always.""" + source_vm_cpu_count: Optional[int] = rest_field( + name="sourceVmCpuCount", visibility=["read", "create", "update", "delete", "query"] + ) + """The CPU count of the VM on the primary side.""" + source_vm_ram_size_in_mb: Optional[int] = rest_field( + name="sourceVmRamSizeInMB", visibility=["read", "create", "update", "delete", "query"] + ) + """The RAM size of the VM on the primary side.""" + os_details: Optional["_models.OSDiskDetails"] = rest_field( + name="osDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """The OS details.""" + protection_stage: Optional[str] = rest_field( + name="protectionStage", visibility=["read", "create", "update", "delete", "query"] + ) + """The protection stage.""" + vm_id: Optional[str] = rest_field(name="vmId", visibility=["read", "create", "update", "delete", "query"]) + """The virtual machine Id.""" + vm_protection_state: Optional[str] = rest_field( + name="vmProtectionState", visibility=["read", "create", "update", "delete", "query"] + ) + """The protection state for the vm.""" + vm_protection_state_description: Optional[str] = rest_field( + name="vmProtectionStateDescription", visibility=["read", "create", "update", "delete", "query"] + ) + """The protection state description for the vm.""" + resync_details: Optional["_models.InitialReplicationDetails"] = rest_field( + name="resyncDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """The resync details of the machine.""" + retention_window_start: Optional[datetime.datetime] = rest_field( + name="retentionWindowStart", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The retention window start time.""" + retention_window_end: Optional[datetime.datetime] = rest_field( + name="retentionWindowEnd", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The retention window end time.""" + compressed_data_rate_in_mb: Optional[float] = rest_field( + name="compressedDataRateInMB", visibility=["read", "create", "update", "delete", "query"] + ) + """The compressed data change rate in MB.""" + uncompressed_data_rate_in_mb: Optional[float] = rest_field( + name="uncompressedDataRateInMB", visibility=["read", "create", "update", "delete", "query"] + ) + """The uncompressed data change rate in MB.""" + rpo_in_seconds: Optional[int] = rest_field( + name="rpoInSeconds", visibility=["read", "create", "update", "delete", "query"] + ) + """The RPO in seconds.""" + protected_disks: Optional[list["_models.InMageProtectedDiskDetails"]] = rest_field( + name="protectedDisks", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of protected disks.""" + ip_address: Optional[str] = rest_field(name="ipAddress", visibility=["read", "create", "update", "delete", "query"]) + """The source IP address.""" + last_heartbeat: Optional[datetime.datetime] = rest_field( + name="lastHeartbeat", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The last heartbeat received from the source server.""" + process_server_id: Optional[str] = rest_field( + name="processServerId", visibility=["read", "create", "update", "delete", "query"] + ) + """The process server Id.""" + master_target_id: Optional[str] = rest_field( + name="masterTargetId", visibility=["read", "create", "update", "delete", "query"] + ) + """The master target Id.""" + consistency_points: Optional[dict[str, datetime.datetime]] = rest_field( + name="consistencyPoints", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The collection of Consistency points.""" + disk_resized: Optional[str] = rest_field( + name="diskResized", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether any disk is resized for this VM.""" + reboot_after_update_status: Optional[str] = rest_field( + name="rebootAfterUpdateStatus", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether the source server requires a restart after update.""" + multi_vm_group_id: Optional[str] = rest_field( + name="multiVmGroupId", visibility=["read", "create", "update", "delete", "query"] + ) + """The multi vm group Id, if any.""" + multi_vm_group_name: Optional[str] = rest_field( + name="multiVmGroupName", visibility=["read", "create", "update", "delete", "query"] + ) + """The multi vm group name, if any.""" + multi_vm_sync_status: Optional[str] = rest_field( + name="multiVmSyncStatus", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether the multi vm sync is enabled or disabled.""" + agent_details: Optional["_models.InMageAgentDetails"] = rest_field( + name="agentDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """The agent details.""" + v_center_infrastructure_id: Optional[str] = rest_field( + name="vCenterInfrastructureId", visibility=["read", "create", "update", "delete", "query"] + ) + """The vCenter infrastructure Id.""" + infrastructure_vm_id: Optional[str] = rest_field( + name="infrastructureVmId", visibility=["read", "create", "update", "delete", "query"] + ) + """The infrastructure VM Id.""" + vm_nics: Optional[list["_models.VMNicDetails"]] = rest_field( + name="vmNics", visibility=["read", "create", "update", "delete", "query"] + ) + """The PE Network details.""" + discovery_type: Optional[str] = rest_field( + name="discoveryType", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating the discovery type of the machine.""" + azure_storage_account_id: Optional[str] = rest_field( + name="azureStorageAccountId", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating the underlying Azure storage account. If the VM is not running in Azure, + this value shall be set to null.""" + datastores: Optional[list[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The datastores of the on-premise machine Value can be list of strings that contain datastore + names.""" + validation_errors: Optional[list["_models.HealthError"]] = rest_field( + name="validationErrors", visibility=["read", "create", "update", "delete", "query"] + ) + """The validation errors of the on-premise machine Value can be list of validation errors.""" + last_rpo_calculated_time: Optional[datetime.datetime] = rest_field( + name="lastRpoCalculatedTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The last RPO calculated time.""" + last_update_received_time: Optional[datetime.datetime] = rest_field( + name="lastUpdateReceivedTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The last update time received from on-prem components.""" + replica_id: Optional[str] = rest_field(name="replicaId", visibility=["read", "create", "update", "delete", "query"]) + """The replica id of the protected item.""" + os_version: Optional[str] = rest_field(name="osVersion", visibility=["read", "create", "update", "delete", "query"]) + """The OS Version of the protected item.""" + is_additional_stats_available: Optional[bool] = rest_field( + name="isAdditionalStatsAvailable", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether additional IR stats are available or not.""" + total_data_transferred: Optional[int] = rest_field( + name="totalDataTransferred", visibility=["read", "create", "update", "delete", "query"] + ) + """The total transferred data in bytes.""" + total_progress_health: Optional[str] = rest_field( + name="totalProgressHealth", visibility=["read", "create", "update", "delete", "query"] + ) + """The progress health.""" + instance_type: Literal["InMage"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets the Instance type. Required. Default value is \"InMage\".""" + + @overload + def __init__( # pylint: disable=too-many-locals + self, + *, + active_site_type: Optional[str] = None, + source_vm_cpu_count: Optional[int] = None, + source_vm_ram_size_in_mb: Optional[int] = None, + os_details: Optional["_models.OSDiskDetails"] = None, + protection_stage: Optional[str] = None, + vm_id: Optional[str] = None, + vm_protection_state: Optional[str] = None, + vm_protection_state_description: Optional[str] = None, + resync_details: Optional["_models.InitialReplicationDetails"] = None, + retention_window_start: Optional[datetime.datetime] = None, + retention_window_end: Optional[datetime.datetime] = None, + compressed_data_rate_in_mb: Optional[float] = None, + uncompressed_data_rate_in_mb: Optional[float] = None, + rpo_in_seconds: Optional[int] = None, + protected_disks: Optional[list["_models.InMageProtectedDiskDetails"]] = None, + ip_address: Optional[str] = None, + last_heartbeat: Optional[datetime.datetime] = None, + process_server_id: Optional[str] = None, + master_target_id: Optional[str] = None, + consistency_points: Optional[dict[str, datetime.datetime]] = None, + disk_resized: Optional[str] = None, + reboot_after_update_status: Optional[str] = None, + multi_vm_group_id: Optional[str] = None, + multi_vm_group_name: Optional[str] = None, + multi_vm_sync_status: Optional[str] = None, + agent_details: Optional["_models.InMageAgentDetails"] = None, + v_center_infrastructure_id: Optional[str] = None, + infrastructure_vm_id: Optional[str] = None, + vm_nics: Optional[list["_models.VMNicDetails"]] = None, + discovery_type: Optional[str] = None, + azure_storage_account_id: Optional[str] = None, + datastores: Optional[list[str]] = None, + validation_errors: Optional[list["_models.HealthError"]] = None, + last_rpo_calculated_time: Optional[datetime.datetime] = None, + last_update_received_time: Optional[datetime.datetime] = None, + replica_id: Optional[str] = None, + os_version: Optional[str] = None, + is_additional_stats_available: Optional[bool] = None, + total_data_transferred: Optional[int] = None, + total_progress_health: 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) + self.instance_type = "InMage" # type: ignore + + +class InMageReprotectInput(ReverseReplicationProviderSpecificInput, discriminator="InMage"): + """InMageAzureV2 specific provider input. + + :ivar master_target_id: The Master Target Id. Required. + :vartype master_target_id: str + :ivar process_server_id: The Process Server Id. Required. + :vartype process_server_id: str + :ivar retention_drive: The retention drive to use on the MT. Required. + :vartype retention_drive: str + :ivar run_as_account_id: The CS account Id. + :vartype run_as_account_id: str + :ivar datastore_name: The target datastore name. + :vartype datastore_name: str + :ivar disk_exclusion_input: The enable disk exclusion input. + :vartype disk_exclusion_input: + ~azure.mgmt.recoveryservicessiterecovery.models.InMageDiskExclusionInput + :ivar profile_id: The Policy Id. Required. + :vartype profile_id: str + :ivar disks_to_include: The disks to include list. + :vartype disks_to_include: list[str] + :ivar instance_type: The class type. Required. Default value is "InMage". + :vartype instance_type: str + """ + + master_target_id: str = rest_field( + name="masterTargetId", visibility=["read", "create", "update", "delete", "query"] + ) + """The Master Target Id. Required.""" + process_server_id: str = rest_field( + name="processServerId", visibility=["read", "create", "update", "delete", "query"] + ) + """The Process Server Id. Required.""" + retention_drive: str = rest_field(name="retentionDrive", visibility=["read", "create", "update", "delete", "query"]) + """The retention drive to use on the MT. Required.""" + run_as_account_id: Optional[str] = rest_field( + name="runAsAccountId", visibility=["read", "create", "update", "delete", "query"] + ) + """The CS account Id.""" + datastore_name: Optional[str] = rest_field( + name="datastoreName", visibility=["read", "create", "update", "delete", "query"] + ) + """The target datastore name.""" + disk_exclusion_input: Optional["_models.InMageDiskExclusionInput"] = rest_field( + name="diskExclusionInput", visibility=["read", "create", "update", "delete", "query"] + ) + """The enable disk exclusion input.""" + profile_id: str = rest_field(name="profileId", visibility=["read", "create", "update", "delete", "query"]) + """The Policy Id. Required.""" + disks_to_include: Optional[list[str]] = rest_field( + name="disksToInclude", visibility=["read", "create", "update", "delete", "query"] + ) + """The disks to include list.""" + instance_type: Literal["InMage"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The class type. Required. Default value is \"InMage\".""" + + @overload + def __init__( + self, + *, + master_target_id: str, + process_server_id: str, + retention_drive: str, + profile_id: str, + run_as_account_id: Optional[str] = None, + datastore_name: Optional[str] = None, + disk_exclusion_input: Optional["_models.InMageDiskExclusionInput"] = None, + disks_to_include: 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) + self.instance_type = "InMage" # type: ignore + + +class InMageTestFailoverInput(TestFailoverProviderSpecificInput, discriminator="InMage"): + """Provider specific input for InMage test failover. + + :ivar recovery_point_type: The recovery point type. Values from LatestTime, LatestTag or + Custom. In the case of custom, the recovery point provided by RecoveryPointId will be used. In + the other two cases, recovery point id will be ignored. Known values are: "LatestTime", + "LatestTag", and "Custom". + :vartype recovery_point_type: str or + ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPointType + :ivar recovery_point_id: The recovery point id to be passed to test failover to a particular + recovery point. In case of latest recovery point, null should be passed. + :vartype recovery_point_id: str + :ivar instance_type: The class type. Required. Default value is "InMage". + :vartype instance_type: str + """ + + recovery_point_type: Optional[Union[str, "_models.RecoveryPointType"]] = rest_field( + name="recoveryPointType", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery point type. Values from LatestTime, LatestTag or Custom. In the case of custom, + the recovery point provided by RecoveryPointId will be used. In the other two cases, recovery + point id will be ignored. Known values are: \"LatestTime\", \"LatestTag\", and \"Custom\".""" + recovery_point_id: Optional[str] = rest_field( + name="recoveryPointId", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery point id to be passed to test failover to a particular recovery point. In case of + latest recovery point, null should be passed.""" + instance_type: Literal["InMage"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The class type. Required. Default value is \"InMage\".""" + + @overload + def __init__( + self, + *, + recovery_point_type: Optional[Union[str, "_models.RecoveryPointType"]] = None, + recovery_point_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) + self.instance_type = "InMage" # type: ignore + + +class InMageUnplannedFailoverInput(UnplannedFailoverProviderSpecificInput, discriminator="InMage"): + """Provider specific input for InMage unplanned failover. + + :ivar recovery_point_type: The recovery point type. Values from LatestTime, LatestTag or + Custom. In the case of custom, the recovery point provided by RecoveryPointId will be used. In + the other two cases, recovery point id will be ignored. Known values are: "LatestTime", + "LatestTag", and "Custom". + :vartype recovery_point_type: str or + ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPointType + :ivar recovery_point_id: The recovery point id to be passed to failover to a particular + recovery point. In case of latest recovery point, null should be passed. + :vartype recovery_point_id: str + :ivar instance_type: The class type. Required. Default value is "InMage". + :vartype instance_type: str + """ + + recovery_point_type: Optional[Union[str, "_models.RecoveryPointType"]] = rest_field( + name="recoveryPointType", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery point type. Values from LatestTime, LatestTag or Custom. In the case of custom, + the recovery point provided by RecoveryPointId will be used. In the other two cases, recovery + point id will be ignored. Known values are: \"LatestTime\", \"LatestTag\", and \"Custom\".""" + recovery_point_id: Optional[str] = rest_field( + name="recoveryPointId", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery point id to be passed to failover to a particular recovery point. In case of + latest recovery point, null should be passed.""" + instance_type: Literal["InMage"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The class type. Required. Default value is \"InMage\".""" + + @overload + def __init__( + self, + *, + recovery_point_type: Optional[Union[str, "_models.RecoveryPointType"]] = None, + recovery_point_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) + self.instance_type = "InMage" # type: ignore + + +class InMageVolumeExclusionOptions(_Model): + """Guest disk signature based disk exclusion option when doing enable protection of virtual + machine in InMage provider. + + :ivar volume_label: The volume label. The disk having any volume with this label will be + excluded from replication. + :vartype volume_label: str + :ivar only_exclude_if_single_volume: The value indicating whether to exclude multi volume disk + or not. If a disk has multiple volumes and one of the volume has label matching with + VolumeLabel this disk will be excluded from replication if OnlyExcludeIfSingleVolume is false. + :vartype only_exclude_if_single_volume: str + """ + + volume_label: Optional[str] = rest_field( + name="volumeLabel", visibility=["read", "create", "update", "delete", "query"] + ) + """The volume label. The disk having any volume with this label will be excluded from replication.""" + only_exclude_if_single_volume: Optional[str] = rest_field( + name="onlyExcludeIfSingleVolume", visibility=["read", "create", "update", "delete", "query"] + ) + """The value indicating whether to exclude multi volume disk or not. If a disk has multiple + volumes and one of the volume has label matching with VolumeLabel this disk will be excluded + from replication if OnlyExcludeIfSingleVolume is false.""" + + @overload + def __init__( + self, + *, + volume_label: Optional[str] = None, + only_exclude_if_single_volume: 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 InnerHealthError(_Model): + """Implements InnerHealthError class. HealthError object has a list of InnerHealthErrors as child + errors. InnerHealthError is used because this will prevent an infinite loop of structures when + Hydra tries to auto-generate the contract. We are exposing the related health errors as inner + health errors and all API consumers can utilize this in the same fashion as Exception -> + InnerException. + + :ivar error_source: Source of error. + :vartype error_source: str + :ivar error_type: Type of error. + :vartype error_type: str + :ivar error_level: Level of error. + :vartype error_level: str + :ivar error_category: Category of error. + :vartype error_category: str + :ivar error_code: Error code. + :vartype error_code: str + :ivar summary_message: Summary message of the entity. + :vartype summary_message: str + :ivar error_message: Error message. + :vartype error_message: str + :ivar possible_causes: Possible causes of error. + :vartype possible_causes: str + :ivar recommended_action: Recommended action to resolve error. + :vartype recommended_action: str + :ivar creation_time_utc: Error creation time (UTC). + :vartype creation_time_utc: ~datetime.datetime + :ivar recovery_provider_error_message: DRA error message. + :vartype recovery_provider_error_message: str + :ivar entity_id: ID of the entity. + :vartype entity_id: str + :ivar error_id: The health error unique id. + :vartype error_id: str + :ivar customer_resolvability: Value indicating whether the health error is customer resolvable. + Known values are: "Allowed" and "NotAllowed". + :vartype customer_resolvability: str or + ~azure.mgmt.recoveryservicessiterecovery.models.HealthErrorCustomerResolvability + """ + + error_source: Optional[str] = rest_field( + name="errorSource", visibility=["read", "create", "update", "delete", "query"] + ) + """Source of error.""" + error_type: Optional[str] = rest_field(name="errorType", visibility=["read", "create", "update", "delete", "query"]) + """Type of error.""" + error_level: Optional[str] = rest_field( + name="errorLevel", visibility=["read", "create", "update", "delete", "query"] + ) + """Level of error.""" + error_category: Optional[str] = rest_field( + name="errorCategory", visibility=["read", "create", "update", "delete", "query"] + ) + """Category of error.""" + error_code: Optional[str] = rest_field(name="errorCode", visibility=["read", "create", "update", "delete", "query"]) + """Error code.""" + summary_message: Optional[str] = rest_field( + name="summaryMessage", visibility=["read", "create", "update", "delete", "query"] + ) + """Summary message of the entity.""" + error_message: Optional[str] = rest_field( + name="errorMessage", visibility=["read", "create", "update", "delete", "query"] + ) + """Error message.""" + possible_causes: Optional[str] = rest_field( + name="possibleCauses", visibility=["read", "create", "update", "delete", "query"] + ) + """Possible causes of error.""" + recommended_action: Optional[str] = rest_field( + name="recommendedAction", visibility=["read", "create", "update", "delete", "query"] + ) + """Recommended action to resolve error.""" + creation_time_utc: Optional[datetime.datetime] = rest_field( + name="creationTimeUtc", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """Error creation time (UTC).""" + recovery_provider_error_message: Optional[str] = rest_field( + name="recoveryProviderErrorMessage", visibility=["read", "create", "update", "delete", "query"] + ) + """DRA error message.""" + entity_id: Optional[str] = rest_field(name="entityId", visibility=["read", "create", "update", "delete", "query"]) + """ID of the entity.""" + error_id: Optional[str] = rest_field(name="errorId", visibility=["read", "create", "update", "delete", "query"]) + """The health error unique id.""" + customer_resolvability: Optional[Union[str, "_models.HealthErrorCustomerResolvability"]] = rest_field( + name="customerResolvability", visibility=["read", "create", "update", "delete", "query"] + ) + """Value indicating whether the health error is customer resolvable. Known values are: \"Allowed\" + and \"NotAllowed\".""" + + @overload + def __init__( + self, + *, + error_source: Optional[str] = None, + error_type: Optional[str] = None, + error_level: Optional[str] = None, + error_category: Optional[str] = None, + error_code: Optional[str] = None, + summary_message: Optional[str] = None, + error_message: Optional[str] = None, + possible_causes: Optional[str] = None, + recommended_action: Optional[str] = None, + creation_time_utc: Optional[datetime.datetime] = None, + recovery_provider_error_message: Optional[str] = None, + entity_id: Optional[str] = None, + error_id: Optional[str] = None, + customer_resolvability: Optional[Union[str, "_models.HealthErrorCustomerResolvability"]] = 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 InputEndpoint(_Model): + """InputEndpoint. + + :ivar endpoint_name: + :vartype endpoint_name: str + :ivar private_port: + :vartype private_port: int + :ivar public_port: + :vartype public_port: int + :ivar protocol: + :vartype protocol: str + """ + + endpoint_name: Optional[str] = rest_field( + name="endpointName", visibility=["read", "create", "update", "delete", "query"] + ) + private_port: Optional[int] = rest_field( + name="privatePort", visibility=["read", "create", "update", "delete", "query"] + ) + public_port: Optional[int] = rest_field( + name="publicPort", visibility=["read", "create", "update", "delete", "query"] + ) + protocol: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + + @overload + def __init__( + self, + *, + endpoint_name: Optional[str] = None, + private_port: Optional[int] = None, + public_port: Optional[int] = None, + protocol: 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 IPConfigDetails(_Model): + """IPConfigDetails. + + :ivar name: + :vartype name: str + :ivar is_primary: + :vartype is_primary: bool + :ivar subnet_name: + :vartype subnet_name: str + :ivar static_ip_address: + :vartype static_ip_address: str + :ivar ip_address_type: + :vartype ip_address_type: str + :ivar is_seleted_for_failover: + :vartype is_seleted_for_failover: bool + :ivar recovery_subnet_name: + :vartype recovery_subnet_name: str + :ivar recovery_static_ip_address: + :vartype recovery_static_ip_address: str + :ivar recovery_ip_address_type: + :vartype recovery_ip_address_type: str + :ivar recovery_public_ip_address_id: + :vartype recovery_public_ip_address_id: str + :ivar recovery_lb_backend_address_pool_ids: + :vartype recovery_lb_backend_address_pool_ids: list[str] + :ivar tfo_subnet_name: + :vartype tfo_subnet_name: str + :ivar tfo_static_ip_address: + :vartype tfo_static_ip_address: str + :ivar tfo_public_ip_address_id: + :vartype tfo_public_ip_address_id: str + :ivar tfo_lb_backend_address_pool_ids: + :vartype tfo_lb_backend_address_pool_ids: list[str] + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + is_primary: Optional[bool] = rest_field( + name="isPrimary", visibility=["read", "create", "update", "delete", "query"] + ) + subnet_name: Optional[str] = rest_field( + name="subnetName", visibility=["read", "create", "update", "delete", "query"] + ) + static_ip_address: Optional[str] = rest_field( + name="staticIPAddress", visibility=["read", "create", "update", "delete", "query"] + ) + ip_address_type: Optional[str] = rest_field( + name="ipAddressType", visibility=["read", "create", "update", "delete", "query"] + ) + is_seleted_for_failover: Optional[bool] = rest_field( + name="isSeletedForFailover", visibility=["read", "create", "update", "delete", "query"] + ) + recovery_subnet_name: Optional[str] = rest_field( + name="recoverySubnetName", visibility=["read", "create", "update", "delete", "query"] + ) + recovery_static_ip_address: Optional[str] = rest_field( + name="recoveryStaticIPAddress", visibility=["read", "create", "update", "delete", "query"] + ) + recovery_ip_address_type: Optional[str] = rest_field( + name="recoveryIPAddressType", visibility=["read", "create", "update", "delete", "query"] + ) + recovery_public_ip_address_id: Optional[str] = rest_field( + name="recoveryPublicIPAddressId", visibility=["read", "create", "update", "delete", "query"] + ) + recovery_lb_backend_address_pool_ids: Optional[list[str]] = rest_field( + name="recoveryLBBackendAddressPoolIds", visibility=["read", "create", "update", "delete", "query"] + ) + tfo_subnet_name: Optional[str] = rest_field( + name="tfoSubnetName", visibility=["read", "create", "update", "delete", "query"] + ) + tfo_static_ip_address: Optional[str] = rest_field( + name="tfoStaticIPAddress", visibility=["read", "create", "update", "delete", "query"] + ) + tfo_public_ip_address_id: Optional[str] = rest_field( + name="tfoPublicIPAddressId", visibility=["read", "create", "update", "delete", "query"] + ) + tfo_lb_backend_address_pool_ids: Optional[list[str]] = rest_field( + name="tfoLBBackendAddressPoolIds", visibility=["read", "create", "update", "delete", "query"] + ) + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + is_primary: Optional[bool] = None, + subnet_name: Optional[str] = None, + static_ip_address: Optional[str] = None, + ip_address_type: Optional[str] = None, + is_seleted_for_failover: Optional[bool] = None, + recovery_subnet_name: Optional[str] = None, + recovery_static_ip_address: Optional[str] = None, + recovery_ip_address_type: Optional[str] = None, + recovery_public_ip_address_id: Optional[str] = None, + recovery_lb_backend_address_pool_ids: Optional[list[str]] = None, + tfo_subnet_name: Optional[str] = None, + tfo_static_ip_address: Optional[str] = None, + tfo_public_ip_address_id: Optional[str] = None, + tfo_lb_backend_address_pool_ids: 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 IPConfigInputDetails(_Model): + """IPConfigInputDetails. + + :ivar ip_config_name: + :vartype ip_config_name: str + :ivar is_primary: + :vartype is_primary: bool + :ivar is_seleted_for_failover: + :vartype is_seleted_for_failover: bool + :ivar recovery_subnet_name: + :vartype recovery_subnet_name: str + :ivar recovery_static_ip_address: + :vartype recovery_static_ip_address: str + :ivar recovery_public_ip_address_id: + :vartype recovery_public_ip_address_id: str + :ivar recovery_lb_backend_address_pool_ids: + :vartype recovery_lb_backend_address_pool_ids: list[str] + :ivar tfo_subnet_name: + :vartype tfo_subnet_name: str + :ivar tfo_static_ip_address: + :vartype tfo_static_ip_address: str + :ivar tfo_public_ip_address_id: + :vartype tfo_public_ip_address_id: str + :ivar tfo_lb_backend_address_pool_ids: + :vartype tfo_lb_backend_address_pool_ids: list[str] + """ + + ip_config_name: Optional[str] = rest_field( + name="ipConfigName", visibility=["read", "create", "update", "delete", "query"] + ) + is_primary: Optional[bool] = rest_field( + name="isPrimary", visibility=["read", "create", "update", "delete", "query"] + ) + is_seleted_for_failover: Optional[bool] = rest_field( + name="isSeletedForFailover", visibility=["read", "create", "update", "delete", "query"] + ) + recovery_subnet_name: Optional[str] = rest_field( + name="recoverySubnetName", visibility=["read", "create", "update", "delete", "query"] + ) + recovery_static_ip_address: Optional[str] = rest_field( + name="recoveryStaticIPAddress", visibility=["read", "create", "update", "delete", "query"] + ) + recovery_public_ip_address_id: Optional[str] = rest_field( + name="recoveryPublicIPAddressId", visibility=["read", "create", "update", "delete", "query"] + ) + recovery_lb_backend_address_pool_ids: Optional[list[str]] = rest_field( + name="recoveryLBBackendAddressPoolIds", visibility=["read", "create", "update", "delete", "query"] + ) + tfo_subnet_name: Optional[str] = rest_field( + name="tfoSubnetName", visibility=["read", "create", "update", "delete", "query"] + ) + tfo_static_ip_address: Optional[str] = rest_field( + name="tfoStaticIPAddress", visibility=["read", "create", "update", "delete", "query"] + ) + tfo_public_ip_address_id: Optional[str] = rest_field( + name="tfoPublicIPAddressId", visibility=["read", "create", "update", "delete", "query"] + ) + tfo_lb_backend_address_pool_ids: Optional[list[str]] = rest_field( + name="tfoLBBackendAddressPoolIds", visibility=["read", "create", "update", "delete", "query"] + ) + + @overload + def __init__( + self, + *, + ip_config_name: Optional[str] = None, + is_primary: Optional[bool] = None, + is_seleted_for_failover: Optional[bool] = None, + recovery_subnet_name: Optional[str] = None, + recovery_static_ip_address: Optional[str] = None, + recovery_public_ip_address_id: Optional[str] = None, + recovery_lb_backend_address_pool_ids: Optional[list[str]] = None, + tfo_subnet_name: Optional[str] = None, + tfo_static_ip_address: Optional[str] = None, + tfo_public_ip_address_id: Optional[str] = None, + tfo_lb_backend_address_pool_ids: 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 Job(ProxyResource): + """Job details. + + :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.recoveryservicessiterecovery.models.SystemData + :ivar properties: The custom data. + :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.JobProperties + :ivar location: Resource Location. + :vartype location: str + """ + + properties: Optional["_models.JobProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The custom data.""" + location: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource Location.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.JobProperties"] = None, + location: 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 JobEntity(_Model): + """This class contains the minimal job details required to navigate to the desired drill down. + + :ivar job_id: The job id. + :vartype job_id: str + :ivar job_friendly_name: The job display name. + :vartype job_friendly_name: str + :ivar target_object_id: The object id. + :vartype target_object_id: str + :ivar target_object_name: The object name. + :vartype target_object_name: str + :ivar target_instance_type: The workflow affected object type. + :vartype target_instance_type: str + :ivar job_scenario_name: The job name. Enum type ScenarioName. + :vartype job_scenario_name: str + """ + + job_id: Optional[str] = rest_field(name="jobId", visibility=["read", "create", "update", "delete", "query"]) + """The job id.""" + job_friendly_name: Optional[str] = rest_field( + name="jobFriendlyName", visibility=["read", "create", "update", "delete", "query"] + ) + """The job display name.""" + target_object_id: Optional[str] = rest_field( + name="targetObjectId", visibility=["read", "create", "update", "delete", "query"] + ) + """The object id.""" + target_object_name: Optional[str] = rest_field( + name="targetObjectName", visibility=["read", "create", "update", "delete", "query"] + ) + """The object name.""" + target_instance_type: Optional[str] = rest_field( + name="targetInstanceType", visibility=["read", "create", "update", "delete", "query"] + ) + """The workflow affected object type.""" + job_scenario_name: Optional[str] = rest_field( + name="jobScenarioName", visibility=["read", "create", "update", "delete", "query"] + ) + """The job name. Enum type ScenarioName.""" + + @overload + def __init__( + self, + *, + job_id: Optional[str] = None, + job_friendly_name: Optional[str] = None, + target_object_id: Optional[str] = None, + target_object_name: Optional[str] = None, + target_instance_type: Optional[str] = None, + job_scenario_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 JobErrorDetails(_Model): + """This class contains the error details per object. + + :ivar service_error_details: The Service error details. + :vartype service_error_details: ~azure.mgmt.recoveryservicessiterecovery.models.ServiceError + :ivar provider_error_details: The Provider error details. + :vartype provider_error_details: ~azure.mgmt.recoveryservicessiterecovery.models.ProviderError + :ivar error_level: Error level of error. + :vartype error_level: str + :ivar creation_time: The creation time of job error. + :vartype creation_time: ~datetime.datetime + :ivar task_id: The Id of the task. + :vartype task_id: str + """ + + service_error_details: Optional["_models.ServiceError"] = rest_field( + name="serviceErrorDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """The Service error details.""" + provider_error_details: Optional["_models.ProviderError"] = rest_field( + name="providerErrorDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """The Provider error details.""" + error_level: Optional[str] = rest_field( + name="errorLevel", visibility=["read", "create", "update", "delete", "query"] + ) + """Error level of error.""" + creation_time: Optional[datetime.datetime] = rest_field( + name="creationTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The creation time of job error.""" + task_id: Optional[str] = rest_field(name="taskId", visibility=["read", "create", "update", "delete", "query"]) + """The Id of the task.""" + + @overload + def __init__( + self, + *, + service_error_details: Optional["_models.ServiceError"] = None, + provider_error_details: Optional["_models.ProviderError"] = None, + error_level: Optional[str] = None, + creation_time: Optional[datetime.datetime] = None, + task_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 JobProperties(_Model): + """Job custom data details. + + :ivar activity_id: The activity id. + :vartype activity_id: str + :ivar scenario_name: The ScenarioName. + :vartype scenario_name: str + :ivar friendly_name: The DisplayName. + :vartype friendly_name: str + :ivar state: The status of the Job. It is one of these values - NotStarted, InProgress, + Succeeded, Failed, Cancelled, Suspended or Other. + :vartype state: str + :ivar state_description: The description of the state of the Job. For e.g. - For Succeeded + state, description can be Completed, PartiallySucceeded, CompletedWithInformation or Skipped. + :vartype state_description: str + :ivar tasks: The tasks. + :vartype tasks: list[~azure.mgmt.recoveryservicessiterecovery.models.ASRTask] + :ivar errors: The errors. + :vartype errors: list[~azure.mgmt.recoveryservicessiterecovery.models.JobErrorDetails] + :ivar start_time: The start time. + :vartype start_time: ~datetime.datetime + :ivar end_time: The end time. + :vartype end_time: ~datetime.datetime + :ivar allowed_actions: The Allowed action the job. + :vartype allowed_actions: list[str] + :ivar target_object_id: The affected Object Id. + :vartype target_object_id: str + :ivar target_object_name: The name of the affected object. + :vartype target_object_name: str + :ivar target_instance_type: The type of the affected object which is of + Microsoft.Azure.SiteRecovery.V2015_11_10.AffectedObjectType class. + :vartype target_instance_type: str + :ivar custom_details: The custom job details like test failover job details. + :vartype custom_details: ~azure.mgmt.recoveryservicessiterecovery.models.JobDetails + """ + + activity_id: Optional[str] = rest_field( + name="activityId", visibility=["read", "create", "update", "delete", "query"] + ) + """The activity id.""" + scenario_name: Optional[str] = rest_field( + name="scenarioName", visibility=["read", "create", "update", "delete", "query"] + ) + """The ScenarioName.""" + friendly_name: Optional[str] = rest_field( + name="friendlyName", visibility=["read", "create", "update", "delete", "query"] + ) + """The DisplayName.""" + state: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The status of the Job. It is one of these values - NotStarted, InProgress, Succeeded, Failed, + Cancelled, Suspended or Other.""" + state_description: Optional[str] = rest_field( + name="stateDescription", visibility=["read", "create", "update", "delete", "query"] + ) + """The description of the state of the Job. For e.g. - For Succeeded state, description can be + Completed, PartiallySucceeded, CompletedWithInformation or Skipped.""" + tasks: Optional[list["_models.ASRTask"]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The tasks.""" + errors: Optional[list["_models.JobErrorDetails"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The errors.""" + start_time: Optional[datetime.datetime] = rest_field( + name="startTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The start time.""" + end_time: Optional[datetime.datetime] = rest_field( + name="endTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The end time.""" + allowed_actions: Optional[list[str]] = rest_field( + name="allowedActions", visibility=["read", "create", "update", "delete", "query"] + ) + """The Allowed action the job.""" + target_object_id: Optional[str] = rest_field( + name="targetObjectId", visibility=["read", "create", "update", "delete", "query"] + ) + """The affected Object Id.""" + target_object_name: Optional[str] = rest_field( + name="targetObjectName", visibility=["read", "create", "update", "delete", "query"] + ) + """The name of the affected object.""" + target_instance_type: Optional[str] = rest_field( + name="targetInstanceType", visibility=["read", "create", "update", "delete", "query"] + ) + """The type of the affected object which is of + Microsoft.Azure.SiteRecovery.V2015_11_10.AffectedObjectType class.""" + custom_details: Optional["_models.JobDetails"] = rest_field( + name="customDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """The custom job details like test failover job details.""" + + @overload + def __init__( + self, + *, + activity_id: Optional[str] = None, + scenario_name: Optional[str] = None, + friendly_name: Optional[str] = None, + state: Optional[str] = None, + state_description: Optional[str] = None, + tasks: Optional[list["_models.ASRTask"]] = None, + errors: Optional[list["_models.JobErrorDetails"]] = None, + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + allowed_actions: Optional[list[str]] = None, + target_object_id: Optional[str] = None, + target_object_name: Optional[str] = None, + target_instance_type: Optional[str] = None, + custom_details: Optional["_models.JobDetails"] = 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 JobQueryParameter(_Model): + """Query parameter to enumerate jobs. + + :ivar start_time: Date time to get jobs from. + :vartype start_time: str + :ivar end_time: Date time to get jobs upto. + :vartype end_time: str + :ivar fabric_id: The Id of the fabric to search jobs under. + :vartype fabric_id: str + :ivar affected_object_types: The type of objects. + :vartype affected_object_types: str + :ivar job_status: The states of the job to be filtered can be in. + :vartype job_status: str + :ivar job_output_type: The output type of the jobs. Known values are: "Json", "Xml", and + "Excel". + :vartype job_output_type: str or + ~azure.mgmt.recoveryservicessiterecovery.models.ExportJobOutputSerializationType + :ivar job_name: The job Name. + :vartype job_name: str + :ivar timezone_offset: The timezone offset for the location of the request (in minutes). + :vartype timezone_offset: float + """ + + start_time: Optional[str] = rest_field(name="startTime", visibility=["read", "create", "update", "delete", "query"]) + """Date time to get jobs from.""" + end_time: Optional[str] = rest_field(name="endTime", visibility=["read", "create", "update", "delete", "query"]) + """Date time to get jobs upto.""" + fabric_id: Optional[str] = rest_field(name="fabricId", visibility=["read", "create", "update", "delete", "query"]) + """The Id of the fabric to search jobs under.""" + affected_object_types: Optional[str] = rest_field( + name="affectedObjectTypes", visibility=["read", "create", "update", "delete", "query"] + ) + """The type of objects.""" + job_status: Optional[str] = rest_field(name="jobStatus", visibility=["read", "create", "update", "delete", "query"]) + """The states of the job to be filtered can be in.""" + job_output_type: Optional[Union[str, "_models.ExportJobOutputSerializationType"]] = rest_field( + name="jobOutputType", visibility=["read", "create", "update", "delete", "query"] + ) + """The output type of the jobs. Known values are: \"Json\", \"Xml\", and \"Excel\".""" + job_name: Optional[str] = rest_field(name="jobName", visibility=["read", "create", "update", "delete", "query"]) + """The job Name.""" + timezone_offset: Optional[float] = rest_field( + name="timezoneOffset", visibility=["read", "create", "update", "delete", "query"] + ) + """The timezone offset for the location of the request (in minutes).""" + + @overload + def __init__( + self, + *, + start_time: Optional[str] = None, + end_time: Optional[str] = None, + fabric_id: Optional[str] = None, + affected_object_types: Optional[str] = None, + job_status: Optional[str] = None, + job_output_type: Optional[Union[str, "_models.ExportJobOutputSerializationType"]] = None, + job_name: Optional[str] = None, + timezone_offset: Optional[float] = 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 JobStatusEventDetails(EventSpecificDetails, discriminator="JobStatus"): + """Model class for event details of a job status event. + + :ivar job_id: Job arm id for the event. + :vartype job_id: str + :ivar job_friendly_name: JobName for the Event. + :vartype job_friendly_name: str + :ivar job_status: JobStatus for the Event. + :vartype job_status: str + :ivar affected_object_type: AffectedObjectType for the event. + :vartype affected_object_type: str + :ivar instance_type: Gets the class type. Overridden in derived classes. Required. Default + value is "JobStatus". + :vartype instance_type: str + """ + + job_id: Optional[str] = rest_field(name="jobId", visibility=["read", "create", "update", "delete", "query"]) + """Job arm id for the event.""" + job_friendly_name: Optional[str] = rest_field( + name="jobFriendlyName", visibility=["read", "create", "update", "delete", "query"] + ) + """JobName for the Event.""" + job_status: Optional[str] = rest_field(name="jobStatus", visibility=["read", "create", "update", "delete", "query"]) + """JobStatus for the Event.""" + affected_object_type: Optional[str] = rest_field( + name="affectedObjectType", visibility=["read", "create", "update", "delete", "query"] + ) + """AffectedObjectType for the event.""" + instance_type: Literal["JobStatus"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets the class type. Overridden in derived classes. Required. Default value is \"JobStatus\".""" + + @overload + def __init__( + self, + *, + job_id: Optional[str] = None, + job_friendly_name: Optional[str] = None, + job_status: Optional[str] = None, + affected_object_type: 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) + self.instance_type = "JobStatus" # type: ignore + + +class KeyEncryptionKeyInfo(_Model): + """Key Encryption Key (KEK) information. + + :ivar key_identifier: The key URL / identifier. + :vartype key_identifier: str + :ivar key_vault_resource_arm_id: The KeyVault resource ARM Id for key. + :vartype key_vault_resource_arm_id: str + """ + + key_identifier: Optional[str] = rest_field( + name="keyIdentifier", visibility=["read", "create", "update", "delete", "query"] + ) + """The key URL / identifier.""" + key_vault_resource_arm_id: Optional[str] = rest_field( + name="keyVaultResourceArmId", visibility=["read", "create", "update", "delete", "query"] + ) + """The KeyVault resource ARM Id for key.""" + + @overload + def __init__( + self, + *, + key_identifier: Optional[str] = None, + key_vault_resource_arm_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 LogicalNetwork(ProxyResource): + """Logical network data model. + + :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.recoveryservicessiterecovery.models.SystemData + :ivar properties: The Logical Network Properties. + :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.LogicalNetworkProperties + :ivar location: Resource Location. + :vartype location: str + """ + + properties: Optional["_models.LogicalNetworkProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The Logical Network Properties.""" + location: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource Location.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.LogicalNetworkProperties"] = None, + location: 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 LogicalNetworkProperties(_Model): + """Logical Network Properties. + + :ivar friendly_name: The Friendly Name. + :vartype friendly_name: str + :ivar network_virtualization_status: A value indicating whether Network Virtualization is + enabled for the logical network. + :vartype network_virtualization_status: str + :ivar logical_network_usage: A value indicating whether logical network is used as private test + network by test failover. + :vartype logical_network_usage: str + :ivar logical_network_definitions_status: A value indicating whether logical network + definitions are isolated. + :vartype logical_network_definitions_status: str + """ + + friendly_name: Optional[str] = rest_field( + name="friendlyName", visibility=["read", "create", "update", "delete", "query"] + ) + """The Friendly Name.""" + network_virtualization_status: Optional[str] = rest_field( + name="networkVirtualizationStatus", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether Network Virtualization is enabled for the logical network.""" + logical_network_usage: Optional[str] = rest_field( + name="logicalNetworkUsage", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether logical network is used as private test network by test failover.""" + logical_network_definitions_status: Optional[str] = rest_field( + name="logicalNetworkDefinitionsStatus", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether logical network definitions are isolated.""" + + @overload + def __init__( + self, + *, + friendly_name: Optional[str] = None, + network_virtualization_status: Optional[str] = None, + logical_network_usage: Optional[str] = None, + logical_network_definitions_status: 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 ManagedRunCommandScriptInput(_Model): + """Managed RunCommand script input. + + :ivar step_name: The step name. Required. + :vartype step_name: str + :ivar script_url: The script url. Required. + :vartype script_url: str + :ivar script_parameters: The script parameters. Required. + :vartype script_parameters: str + """ + + step_name: str = rest_field(name="stepName", visibility=["read", "create", "update", "delete", "query"]) + """The step name. Required.""" + script_url: str = rest_field(name="scriptUrl", visibility=["read", "create", "update", "delete", "query"]) + """The script url. Required.""" + script_parameters: str = rest_field( + name="scriptParameters", visibility=["read", "create", "update", "delete", "query"] + ) + """The script parameters. Required.""" + + @overload + def __init__( + self, + *, + step_name: str, + script_url: str, + script_parameters: str, + ) -> 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 ManualActionTaskDetails(TaskTypeDetails, discriminator="ManualActionTaskDetails"): + """This class represents the manual action task details. + + :ivar name: The name. + :vartype name: str + :ivar instructions: The instructions. + :vartype instructions: str + :ivar observation: The observation. + :vartype observation: str + :ivar instance_type: The type of task details. Required. Default value is + "ManualActionTaskDetails". + :vartype instance_type: str + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name.""" + instructions: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The instructions.""" + observation: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The observation.""" + instance_type: Literal["ManualActionTaskDetails"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The type of task details. Required. Default value is \"ManualActionTaskDetails\".""" + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + instructions: Optional[str] = None, + observation: 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) + self.instance_type = "ManualActionTaskDetails" # type: ignore + + +class MarsAgentDetails(_Model): + """Mars agent details. + + :ivar id: The Mars agent Id. + :vartype id: str + :ivar name: The Mars agent name. + :vartype name: str + :ivar bios_id: The Mars agent Bios Id. + :vartype bios_id: str + :ivar fabric_object_id: The fabric object Id. + :vartype fabric_object_id: str + :ivar fqdn: The Mars agent Fqdn. + :vartype fqdn: str + :ivar version: The version. + :vartype version: str + :ivar last_heartbeat_utc: The last heartbeat received from the Mars agent. + :vartype last_heartbeat_utc: ~datetime.datetime + :ivar health: The health of the Mars agent. Known values are: "None", "Normal", "Warning", and + "Critical". + :vartype health: str or ~azure.mgmt.recoveryservicessiterecovery.models.ProtectionHealth + :ivar health_errors: The health errors. + :vartype health_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] + """ + + id: Optional[str] = rest_field(visibility=["read"]) + """The Mars agent Id.""" + name: Optional[str] = rest_field(visibility=["read"]) + """The Mars agent name.""" + bios_id: Optional[str] = rest_field(name="biosId", visibility=["read"]) + """The Mars agent Bios Id.""" + fabric_object_id: Optional[str] = rest_field(name="fabricObjectId", visibility=["read"]) + """The fabric object Id.""" + fqdn: Optional[str] = rest_field(visibility=["read"]) + """The Mars agent Fqdn.""" + version: Optional[str] = rest_field(visibility=["read"]) + """The version.""" + last_heartbeat_utc: Optional[datetime.datetime] = rest_field( + name="lastHeartbeatUtc", visibility=["read"], format="rfc3339" + ) + """The last heartbeat received from the Mars agent.""" + health: Optional[Union[str, "_models.ProtectionHealth"]] = rest_field(visibility=["read"]) + """The health of the Mars agent. Known values are: \"None\", \"Normal\", \"Warning\", and + \"Critical\".""" + health_errors: Optional[list["_models.HealthError"]] = rest_field(name="healthErrors", visibility=["read"]) + """The health errors.""" + + +class MasterTargetServer(_Model): + """Details of a Master Target Server. + + :ivar id: The server Id. + :vartype id: str + :ivar ip_address: The IP address of the server. + :vartype ip_address: str + :ivar name: The server name. + :vartype name: str + :ivar os_type: The OS type of the server. + :vartype os_type: str + :ivar agent_version: The version of the scout component on the server. + :vartype agent_version: str + :ivar last_heartbeat: The last heartbeat received from the server. + :vartype last_heartbeat: ~datetime.datetime + :ivar version_status: Version status. + :vartype version_status: str + :ivar retention_volumes: The retention volumes of Master target Server. + :vartype retention_volumes: + list[~azure.mgmt.recoveryservicessiterecovery.models.RetentionVolume] + :ivar data_stores: The list of data stores in the fabric. + :vartype data_stores: list[~azure.mgmt.recoveryservicessiterecovery.models.DataStore] + :ivar validation_errors: Validation errors. + :vartype validation_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] + :ivar health_errors: Health errors. + :vartype health_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] + :ivar disk_count: Disk count of the master target. + :vartype disk_count: int + :ivar os_version: OS Version of the master target. + :vartype os_version: str + :ivar agent_expiry_date: Agent expiry date. + :vartype agent_expiry_date: ~datetime.datetime + :ivar mars_agent_version: MARS agent version. + :vartype mars_agent_version: str + :ivar mars_agent_expiry_date: MARS agent expiry date. + :vartype mars_agent_expiry_date: ~datetime.datetime + :ivar agent_version_details: Agent version details. + :vartype agent_version_details: ~azure.mgmt.recoveryservicessiterecovery.models.VersionDetails + :ivar mars_agent_version_details: Mars agent version details. + :vartype mars_agent_version_details: + ~azure.mgmt.recoveryservicessiterecovery.models.VersionDetails + """ + + id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The server Id.""" + ip_address: Optional[str] = rest_field(name="ipAddress", visibility=["read", "create", "update", "delete", "query"]) + """The IP address of the server.""" + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The server name.""" + os_type: Optional[str] = rest_field(name="osType", visibility=["read", "create", "update", "delete", "query"]) + """The OS type of the server.""" + agent_version: Optional[str] = rest_field( + name="agentVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """The version of the scout component on the server.""" + last_heartbeat: Optional[datetime.datetime] = rest_field( + name="lastHeartbeat", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The last heartbeat received from the server.""" + version_status: Optional[str] = rest_field( + name="versionStatus", visibility=["read", "create", "update", "delete", "query"] + ) + """Version status.""" + retention_volumes: Optional[list["_models.RetentionVolume"]] = rest_field( + name="retentionVolumes", visibility=["read", "create", "update", "delete", "query"] + ) + """The retention volumes of Master target Server.""" + data_stores: Optional[list["_models.DataStore"]] = rest_field( + name="dataStores", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of data stores in the fabric.""" + validation_errors: Optional[list["_models.HealthError"]] = rest_field( + name="validationErrors", visibility=["read", "create", "update", "delete", "query"] + ) + """Validation errors.""" + health_errors: Optional[list["_models.HealthError"]] = rest_field( + name="healthErrors", visibility=["read", "create", "update", "delete", "query"] + ) + """Health errors.""" + disk_count: Optional[int] = rest_field(name="diskCount", visibility=["read", "create", "update", "delete", "query"]) + """Disk count of the master target.""" + os_version: Optional[str] = rest_field(name="osVersion", visibility=["read", "create", "update", "delete", "query"]) + """OS Version of the master target.""" + agent_expiry_date: Optional[datetime.datetime] = rest_field( + name="agentExpiryDate", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """Agent expiry date.""" + mars_agent_version: Optional[str] = rest_field( + name="marsAgentVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """MARS agent version.""" + mars_agent_expiry_date: Optional[datetime.datetime] = rest_field( + name="marsAgentExpiryDate", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """MARS agent expiry date.""" + agent_version_details: Optional["_models.VersionDetails"] = rest_field( + name="agentVersionDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """Agent version details.""" + mars_agent_version_details: Optional["_models.VersionDetails"] = rest_field( + name="marsAgentVersionDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """Mars agent version details.""" + + @overload + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + ip_address: Optional[str] = None, + name: Optional[str] = None, + os_type: Optional[str] = None, + agent_version: Optional[str] = None, + last_heartbeat: Optional[datetime.datetime] = None, + version_status: Optional[str] = None, + retention_volumes: Optional[list["_models.RetentionVolume"]] = None, + data_stores: Optional[list["_models.DataStore"]] = None, + validation_errors: Optional[list["_models.HealthError"]] = None, + health_errors: Optional[list["_models.HealthError"]] = None, + disk_count: Optional[int] = None, + os_version: Optional[str] = None, + agent_expiry_date: Optional[datetime.datetime] = None, + mars_agent_version: Optional[str] = None, + mars_agent_expiry_date: Optional[datetime.datetime] = None, + agent_version_details: Optional["_models.VersionDetails"] = None, + mars_agent_version_details: Optional["_models.VersionDetails"] = 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 MigrateInput(_Model): + """Input for migrate. + + :ivar properties: Migrate input properties. Required. + :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.MigrateInputProperties + """ + + properties: "_models.MigrateInputProperties" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Migrate input properties. Required.""" + + @overload + def __init__( + self, + *, + properties: "_models.MigrateInputProperties", + ) -> 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 MigrateInputProperties(_Model): + """Migrate input properties. + + :ivar provider_specific_details: The provider specific details. Required. + :vartype provider_specific_details: + ~azure.mgmt.recoveryservicessiterecovery.models.MigrateProviderSpecificInput + """ + + provider_specific_details: "_models.MigrateProviderSpecificInput" = rest_field( + name="providerSpecificDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """The provider specific details. Required.""" + + @overload + def __init__( + self, + *, + provider_specific_details: "_models.MigrateProviderSpecificInput", + ) -> 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 MigrateProviderSpecificInput(_Model): + """Migrate provider specific input. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + VMwareCbtMigrateInput + + :ivar instance_type: The class type. Required. Default value is None. + :vartype instance_type: str + """ + + __mapping__: dict[str, _Model] = {} + instance_type: str = rest_discriminator( + name="instanceType", visibility=["read", "create", "update", "delete", "query"] + ) + """The class type. Required. Default value is None.""" + + @overload + def __init__( + self, + *, + instance_type: str, + ) -> 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 MigrationItem(ProxyResource): + """Migration item. + + :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.recoveryservicessiterecovery.models.SystemData + :ivar properties: The migration item properties. + :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.MigrationItemProperties + :ivar location: Resource Location. + :vartype location: str + """ + + properties: Optional["_models.MigrationItemProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The migration item properties.""" + location: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource Location.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.MigrationItemProperties"] = None, + location: 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 MigrationItemProperties(_Model): + """Migration item properties. + + :ivar machine_name: The on-premise virtual machine name. + :vartype machine_name: str + :ivar policy_id: The ARM Id of policy governing this item. + :vartype policy_id: str + :ivar policy_friendly_name: The name of policy governing this item. + :vartype policy_friendly_name: str + :ivar recovery_services_provider_id: The recovery services provider ARM Id. + :vartype recovery_services_provider_id: str + :ivar replication_status: The replication status. + :vartype replication_status: str + :ivar migration_state: The migration status. Known values are: "None", + "EnableMigrationInProgress", "EnableMigrationFailed", "DisableMigrationInProgress", + "DisableMigrationFailed", "InitialSeedingInProgress", "InitialSeedingFailed", "Replicating", + "MigrationInProgress", "MigrationSucceeded", "MigrationFailed", "ResumeInProgress", + "ResumeInitiated", "SuspendingProtection", "ProtectionSuspended", + "MigrationCompletedWithInformation", and "MigrationPartiallySucceeded". + :vartype migration_state: str or ~azure.mgmt.recoveryservicessiterecovery.models.MigrationState + :ivar migration_state_description: The migration state description. + :vartype migration_state_description: str + :ivar last_test_migration_time: The last test migration time. + :vartype last_test_migration_time: ~datetime.datetime + :ivar last_test_migration_status: The status of the last test migration. + :vartype last_test_migration_status: str + :ivar last_migration_time: The last migration time. + :vartype last_migration_time: ~datetime.datetime + :ivar last_migration_status: The status of the last migration. + :vartype last_migration_status: str + :ivar test_migrate_state: The test migrate state. Known values are: "None", + "TestMigrationInProgress", "TestMigrationSucceeded", "TestMigrationFailed", + "TestMigrationCleanupInProgress", "TestMigrationCompletedWithInformation", and + "TestMigrationPartiallySucceeded". + :vartype test_migrate_state: str or + ~azure.mgmt.recoveryservicessiterecovery.models.TestMigrationState + :ivar test_migrate_state_description: The test migrate state description. + :vartype test_migrate_state_description: str + :ivar health: The consolidated health. Known values are: "None", "Normal", "Warning", and + "Critical". + :vartype health: str or ~azure.mgmt.recoveryservicessiterecovery.models.ProtectionHealth + :ivar health_errors: The list of health errors. + :vartype health_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] + :ivar allowed_operations: The allowed operations on the migration item based on the current + migration state of the item. + :vartype allowed_operations: list[str or + ~azure.mgmt.recoveryservicessiterecovery.models.MigrationItemOperation] + :ivar current_job: The current job details. + :vartype current_job: ~azure.mgmt.recoveryservicessiterecovery.models.CurrentJobDetails + :ivar critical_job_history: The critical past job details. + :vartype critical_job_history: + list[~azure.mgmt.recoveryservicessiterecovery.models.CriticalJobHistoryDetails] + :ivar event_correlation_id: The correlation Id for events associated with this migration item. + :vartype event_correlation_id: str + :ivar provider_specific_details: The migration provider custom settings. + :vartype provider_specific_details: + ~azure.mgmt.recoveryservicessiterecovery.models.MigrationProviderSpecificSettings + """ + + machine_name: Optional[str] = rest_field(name="machineName", visibility=["read"]) + """The on-premise virtual machine name.""" + policy_id: Optional[str] = rest_field(name="policyId", visibility=["read"]) + """The ARM Id of policy governing this item.""" + policy_friendly_name: Optional[str] = rest_field(name="policyFriendlyName", visibility=["read"]) + """The name of policy governing this item.""" + recovery_services_provider_id: Optional[str] = rest_field(name="recoveryServicesProviderId", visibility=["read"]) + """The recovery services provider ARM Id.""" + replication_status: Optional[str] = rest_field(name="replicationStatus", visibility=["read"]) + """The replication status.""" + migration_state: Optional[Union[str, "_models.MigrationState"]] = rest_field( + name="migrationState", visibility=["read"] + ) + """The migration status. Known values are: \"None\", \"EnableMigrationInProgress\", + \"EnableMigrationFailed\", \"DisableMigrationInProgress\", \"DisableMigrationFailed\", + \"InitialSeedingInProgress\", \"InitialSeedingFailed\", \"Replicating\", + \"MigrationInProgress\", \"MigrationSucceeded\", \"MigrationFailed\", \"ResumeInProgress\", + \"ResumeInitiated\", \"SuspendingProtection\", \"ProtectionSuspended\", + \"MigrationCompletedWithInformation\", and \"MigrationPartiallySucceeded\".""" + migration_state_description: Optional[str] = rest_field(name="migrationStateDescription", visibility=["read"]) + """The migration state description.""" + last_test_migration_time: Optional[datetime.datetime] = rest_field( + name="lastTestMigrationTime", visibility=["read"], format="rfc3339" + ) + """The last test migration time.""" + last_test_migration_status: Optional[str] = rest_field(name="lastTestMigrationStatus", visibility=["read"]) + """The status of the last test migration.""" + last_migration_time: Optional[datetime.datetime] = rest_field( + name="lastMigrationTime", visibility=["read"], format="rfc3339" + ) + """The last migration time.""" + last_migration_status: Optional[str] = rest_field(name="lastMigrationStatus", visibility=["read"]) + """The status of the last migration.""" + test_migrate_state: Optional[Union[str, "_models.TestMigrationState"]] = rest_field( + name="testMigrateState", visibility=["read"] + ) + """The test migrate state. Known values are: \"None\", \"TestMigrationInProgress\", + \"TestMigrationSucceeded\", \"TestMigrationFailed\", \"TestMigrationCleanupInProgress\", + \"TestMigrationCompletedWithInformation\", and \"TestMigrationPartiallySucceeded\".""" + test_migrate_state_description: Optional[str] = rest_field(name="testMigrateStateDescription", visibility=["read"]) + """The test migrate state description.""" + health: Optional[Union[str, "_models.ProtectionHealth"]] = rest_field(visibility=["read"]) + """The consolidated health. Known values are: \"None\", \"Normal\", \"Warning\", and \"Critical\".""" + health_errors: Optional[list["_models.HealthError"]] = rest_field(name="healthErrors", visibility=["read"]) + """The list of health errors.""" + allowed_operations: Optional[list[Union[str, "_models.MigrationItemOperation"]]] = rest_field( + name="allowedOperations", visibility=["read"] + ) + """The allowed operations on the migration item based on the current migration state of the item.""" + current_job: Optional["_models.CurrentJobDetails"] = rest_field(name="currentJob", visibility=["read"]) + """The current job details.""" + critical_job_history: Optional[list["_models.CriticalJobHistoryDetails"]] = rest_field( + name="criticalJobHistory", visibility=["read"] + ) + """The critical past job details.""" + event_correlation_id: Optional[str] = rest_field(name="eventCorrelationId", visibility=["read"]) + """The correlation Id for events associated with this migration item.""" + provider_specific_details: Optional["_models.MigrationProviderSpecificSettings"] = rest_field( + name="providerSpecificDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """The migration provider custom settings.""" + + @overload + def __init__( + self, + *, + provider_specific_details: Optional["_models.MigrationProviderSpecificSettings"] = 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 MigrationProviderSpecificSettings(_Model): + """Migration provider specific settings. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + VMwareCbtMigrationDetails + + :ivar instance_type: Gets the instance type. Required. Default value is None. + :vartype instance_type: str + """ + + __mapping__: dict[str, _Model] = {} + instance_type: str = rest_discriminator( + name="instanceType", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets the instance type. Required. Default value is None.""" + + @overload + def __init__( + self, + *, + instance_type: str, + ) -> 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 MigrationRecoveryPoint(ProxyResource): + """Recovery point for a migration item. + + :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.recoveryservicessiterecovery.models.SystemData + :ivar properties: Recovery point properties. + :vartype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.MigrationRecoveryPointProperties + :ivar location: Resource Location. + :vartype location: str + """ + + properties: Optional["_models.MigrationRecoveryPointProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Recovery point properties.""" + location: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource Location.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.MigrationRecoveryPointProperties"] = None, + location: 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 MigrationRecoveryPointProperties(_Model): + """Migration item recovery point properties. + + :ivar recovery_point_time: The recovery point time. + :vartype recovery_point_time: ~datetime.datetime + :ivar recovery_point_type: The recovery point type. Known values are: "NotSpecified", + "ApplicationConsistent", and "CrashConsistent". + :vartype recovery_point_type: str or + ~azure.mgmt.recoveryservicessiterecovery.models.MigrationRecoveryPointType + """ + + recovery_point_time: Optional[datetime.datetime] = rest_field( + name="recoveryPointTime", visibility=["read"], format="rfc3339" + ) + """The recovery point time.""" + recovery_point_type: Optional[Union[str, "_models.MigrationRecoveryPointType"]] = rest_field( + name="recoveryPointType", visibility=["read"] + ) + """The recovery point type. Known values are: \"NotSpecified\", \"ApplicationConsistent\", and + \"CrashConsistent\".""" + + +class MobilityServiceUpdate(_Model): + """The Mobility Service update details. + + :ivar version: The version of the latest update. + :vartype version: str + :ivar reboot_status: The reboot status of the update - whether it is required or not. + :vartype reboot_status: str + :ivar os_type: The OS type. + :vartype os_type: str + """ + + version: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The version of the latest update.""" + reboot_status: Optional[str] = rest_field( + name="rebootStatus", visibility=["read", "create", "update", "delete", "query"] + ) + """The reboot status of the update - whether it is required or not.""" + os_type: Optional[str] = rest_field(name="osType", visibility=["read", "create", "update", "delete", "query"]) + """The OS type.""" + + @overload + def __init__( + self, + *, + version: Optional[str] = None, + reboot_status: Optional[str] = None, + os_type: 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 Network(ProxyResource): + """Network model. + + :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.recoveryservicessiterecovery.models.SystemData + :ivar properties: The Network Properties. + :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.NetworkProperties + :ivar location: Resource Location. + :vartype location: str + """ + + properties: Optional["_models.NetworkProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The Network Properties.""" + location: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource Location.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.NetworkProperties"] = None, + location: 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 NetworkMapping(ProxyResource): + """Network Mapping model. Ideally it should have been possible to inherit this class from prev + version in InheritedModels as long as there is no difference in structure or method signature. + Since there were no base Models for certain fields and methods viz NetworkMappingProperties and + Load with required return type, the class has been introduced in its entirety with references + to base models to facilitate extensions in subsequent versions. + + :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.recoveryservicessiterecovery.models.SystemData + :ivar properties: The Network Mapping Properties. + :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.NetworkMappingProperties + :ivar location: Resource Location. + :vartype location: str + """ + + properties: Optional["_models.NetworkMappingProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The Network Mapping Properties.""" + location: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource Location.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.NetworkMappingProperties"] = None, + location: 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 NetworkMappingProperties(_Model): + """Network Mapping Properties. + + :ivar state: The pairing state for network mapping. + :vartype state: str + :ivar primary_network_friendly_name: The primary network friendly name. + :vartype primary_network_friendly_name: str + :ivar primary_network_id: The primary network id for network mapping. + :vartype primary_network_id: str + :ivar primary_fabric_friendly_name: The primary fabric friendly name. + :vartype primary_fabric_friendly_name: str + :ivar recovery_network_friendly_name: The recovery network friendly name. + :vartype recovery_network_friendly_name: str + :ivar recovery_network_id: The recovery network id for network mapping. + :vartype recovery_network_id: str + :ivar recovery_fabric_arm_id: The recovery fabric ARM id. + :vartype recovery_fabric_arm_id: str + :ivar recovery_fabric_friendly_name: The recovery fabric friendly name. + :vartype recovery_fabric_friendly_name: str + :ivar fabric_specific_settings: The fabric specific settings. + :vartype fabric_specific_settings: + ~azure.mgmt.recoveryservicessiterecovery.models.NetworkMappingFabricSpecificSettings + """ + + state: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The pairing state for network mapping.""" + primary_network_friendly_name: Optional[str] = rest_field( + name="primaryNetworkFriendlyName", visibility=["read", "create", "update", "delete", "query"] + ) + """The primary network friendly name.""" + primary_network_id: Optional[str] = rest_field( + name="primaryNetworkId", visibility=["read", "create", "update", "delete", "query"] + ) + """The primary network id for network mapping.""" + primary_fabric_friendly_name: Optional[str] = rest_field( + name="primaryFabricFriendlyName", visibility=["read", "create", "update", "delete", "query"] + ) + """The primary fabric friendly name.""" + recovery_network_friendly_name: Optional[str] = rest_field( + name="recoveryNetworkFriendlyName", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery network friendly name.""" + recovery_network_id: Optional[str] = rest_field( + name="recoveryNetworkId", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery network id for network mapping.""" + recovery_fabric_arm_id: Optional[str] = rest_field( + name="recoveryFabricArmId", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery fabric ARM id.""" + recovery_fabric_friendly_name: Optional[str] = rest_field( + name="recoveryFabricFriendlyName", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery fabric friendly name.""" + fabric_specific_settings: Optional["_models.NetworkMappingFabricSpecificSettings"] = rest_field( + name="fabricSpecificSettings", visibility=["read", "create", "update", "delete", "query"] + ) + """The fabric specific settings.""" + + @overload + def __init__( + self, + *, + state: Optional[str] = None, + primary_network_friendly_name: Optional[str] = None, + primary_network_id: Optional[str] = None, + primary_fabric_friendly_name: Optional[str] = None, + recovery_network_friendly_name: Optional[str] = None, + recovery_network_id: Optional[str] = None, + recovery_fabric_arm_id: Optional[str] = None, + recovery_fabric_friendly_name: Optional[str] = None, + fabric_specific_settings: Optional["_models.NetworkMappingFabricSpecificSettings"] = 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 NetworkProperties(_Model): + """Network Properties. + + :ivar fabric_type: The Fabric Type. + :vartype fabric_type: str + :ivar subnets: The List of subnets. + :vartype subnets: list[~azure.mgmt.recoveryservicessiterecovery.models.Subnet] + :ivar friendly_name: The Friendly Name. + :vartype friendly_name: str + :ivar network_type: The Network Type. + :vartype network_type: str + """ + + fabric_type: Optional[str] = rest_field( + name="fabricType", visibility=["read", "create", "update", "delete", "query"] + ) + """The Fabric Type.""" + subnets: Optional[list["_models.Subnet"]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The List of subnets.""" + friendly_name: Optional[str] = rest_field( + name="friendlyName", visibility=["read", "create", "update", "delete", "query"] + ) + """The Friendly Name.""" + network_type: Optional[str] = rest_field( + name="networkType", visibility=["read", "create", "update", "delete", "query"] + ) + """The Network Type.""" + + @overload + def __init__( + self, + *, + fabric_type: Optional[str] = None, + subnets: Optional[list["_models.Subnet"]] = None, + friendly_name: Optional[str] = None, + network_type: 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 NewProtectionProfile(ProtectionProfileCustomDetails, discriminator="New"): + """New Protection profile input. + + :ivar policy_name: The protection profile input. Required. + :vartype policy_name: str + :ivar recovery_point_history: The duration in minutes until which the recovery points need to + be stored. + :vartype recovery_point_history: int + :ivar crash_consistent_frequency_in_minutes: The crash consistent snapshot frequency (in + minutes). + :vartype crash_consistent_frequency_in_minutes: int + :ivar app_consistent_frequency_in_minutes: The app consistent snapshot frequency (in minutes). + :vartype app_consistent_frequency_in_minutes: int + :ivar multi_vm_sync_status: A value indicating whether multi-VM sync has to be enabled. Value + should be 'Enabled' or 'Disabled'. Required. Known values are: "Enable" and "Disable". + :vartype multi_vm_sync_status: str or + ~azure.mgmt.recoveryservicessiterecovery.models.SetMultiVmSyncStatus + :ivar resource_type: The class type. Required. Default value is "New". + :vartype resource_type: str + """ + + policy_name: str = rest_field(name="policyName", visibility=["read", "create", "update", "delete", "query"]) + """The protection profile input. Required.""" + recovery_point_history: Optional[int] = rest_field( + name="recoveryPointHistory", visibility=["read", "create", "update", "delete", "query"] + ) + """The duration in minutes until which the recovery points need to be stored.""" + crash_consistent_frequency_in_minutes: Optional[int] = rest_field( + name="crashConsistentFrequencyInMinutes", visibility=["read", "create", "update", "delete", "query"] + ) + """The crash consistent snapshot frequency (in minutes).""" + app_consistent_frequency_in_minutes: Optional[int] = rest_field( + name="appConsistentFrequencyInMinutes", visibility=["read", "create", "update", "delete", "query"] + ) + """The app consistent snapshot frequency (in minutes).""" + multi_vm_sync_status: Union[str, "_models.SetMultiVmSyncStatus"] = rest_field( + name="multiVmSyncStatus", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether multi-VM sync has to be enabled. Value should be 'Enabled' or + 'Disabled'. Required. Known values are: \"Enable\" and \"Disable\".""" + resource_type: Literal["New"] = rest_discriminator(name="resourceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The class type. Required. Default value is \"New\".""" + + @overload + def __init__( + self, + *, + policy_name: str, + multi_vm_sync_status: Union[str, "_models.SetMultiVmSyncStatus"], + recovery_point_history: Optional[int] = None, + crash_consistent_frequency_in_minutes: Optional[int] = None, + app_consistent_frequency_in_minutes: 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) + self.resource_type = "New" # type: ignore + + +class NewRecoveryVirtualNetwork(RecoveryVirtualNetworkCustomDetails, discriminator="New"): + """Recovery virtual network input to create new virtual network from given source network. + + :ivar recovery_virtual_network_resource_group_name: The name of the resource group to be used + to create the recovery virtual network. If absent, target network would be created in the same + resource group as target VM. + :vartype recovery_virtual_network_resource_group_name: str + :ivar recovery_virtual_network_name: The recovery virtual network name. + :vartype recovery_virtual_network_name: str + :ivar resource_type: The class type. Required. Default value is "New". + :vartype resource_type: str + """ + + recovery_virtual_network_resource_group_name: Optional[str] = rest_field( + name="recoveryVirtualNetworkResourceGroupName", visibility=["read", "create", "update", "delete", "query"] + ) + """The name of the resource group to be used to create the recovery virtual network. If absent, + target network would be created in the same resource group as target VM.""" + recovery_virtual_network_name: Optional[str] = rest_field( + name="recoveryVirtualNetworkName", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery virtual network name.""" + resource_type: Literal["New"] = rest_discriminator(name="resourceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The class type. Required. Default value is \"New\".""" + + @overload + def __init__( + self, + *, + recovery_virtual_network_resource_group_name: Optional[str] = None, + recovery_virtual_network_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) + self.resource_type = "New" # type: ignore + + +class OperationsDiscovery(_Model): + """Operations discovery class. + + :ivar name: Name of the API. The name of the operation being performed on this particular + object. It should match the action name that appears in RBAC / the event service. Examples of + operations include: * Microsoft.Compute/virtualMachine/capture/action * + Microsoft.Compute/virtualMachine/restart/action * Microsoft.Compute/virtualMachine/write * + Microsoft.Compute/virtualMachine/read * Microsoft.Compute/virtualMachine/delete Each action + should include, in order: (1) Resource Provider Namespace (2) Type hierarchy for which the + action applies (e.g. server/databases for a SQL Azure database) (3) Read, Write, Action or + Delete indicating which type applies. If it is a PUT/PATCH on a collection or named value, + Write should be used. If it is a GET, Read should be used. If it is a DELETE, Delete should be + used. If it is a POST, Action should be used. As a note: all resource providers would need to + include the "{Resource Provider Namespace}/register/action" operation in their response. This + API is used to register for their service, and should include details about the operation (e.g. + a localized name for the resource provider + any special considerations like PII release). + :vartype name: str + :ivar display: Object type. + :vartype display: ~azure.mgmt.recoveryservicessiterecovery.models.Display + :ivar origin: Origin. The intended executor of the operation; governs the display of the + operation in the RBAC UX and the audit logs UX. Default value is "user,system". + :vartype origin: str + :ivar properties: Properties. Reserved for future use. + :vartype properties: any + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Name of the API. The name of the operation being performed on this particular object. It should + match the action name that appears in RBAC / the event service. Examples of operations include: + * Microsoft.Compute/virtualMachine/capture/action * + Microsoft.Compute/virtualMachine/restart/action * Microsoft.Compute/virtualMachine/write * + Microsoft.Compute/virtualMachine/read * Microsoft.Compute/virtualMachine/delete Each action + should include, in order: (1) Resource Provider Namespace (2) Type hierarchy for which the + action applies (e.g. server/databases for a SQL Azure database) (3) Read, Write, Action or + Delete indicating which type applies. If it is a PUT/PATCH on a collection or named value, + Write should be used. If it is a GET, Read should be used. If it is a DELETE, Delete should be + used. If it is a POST, Action should be used. As a note: all resource providers would need to + include the \"{Resource Provider Namespace}/register/action\" operation in their response. This + API is used to register for their service, and should include details about the operation (e.g. + a localized name for the resource provider + any special considerations like PII release).""" + display: Optional["_models.Display"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Object type.""" + origin: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Origin. The intended executor of the operation; governs the display of the operation in the + RBAC UX and the audit logs UX. Default value is \"user,system\".""" + properties: Optional[Any] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Properties. Reserved for future use.""" + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + display: Optional["_models.Display"] = None, + origin: Optional[str] = None, + 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: + super().__init__(*args, **kwargs) + + +class OSDetails(_Model): + """Disk Details. + + :ivar os_type: VM Disk details. + :vartype os_type: str + :ivar product_type: Product type. + :vartype product_type: str + :ivar os_edition: The OSEdition. + :vartype os_edition: str + :ivar o_s_version: The OS Version. + :vartype o_s_version: str + :ivar o_s_major_version: The OS Major Version. + :vartype o_s_major_version: str + :ivar o_s_minor_version: The OS Minor Version. + :vartype o_s_minor_version: str + :ivar user_selected_os_name: The OS name selected by user. + :vartype user_selected_os_name: str + """ + + os_type: Optional[str] = rest_field(name="osType", visibility=["read", "create", "update", "delete", "query"]) + """VM Disk details.""" + product_type: Optional[str] = rest_field( + name="productType", visibility=["read", "create", "update", "delete", "query"] + ) + """Product type.""" + os_edition: Optional[str] = rest_field(name="osEdition", visibility=["read", "create", "update", "delete", "query"]) + """The OSEdition.""" + o_s_version: Optional[str] = rest_field( + name="oSVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """The OS Version.""" + o_s_major_version: Optional[str] = rest_field( + name="oSMajorVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """The OS Major Version.""" + o_s_minor_version: Optional[str] = rest_field( + name="oSMinorVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """The OS Minor Version.""" + user_selected_os_name: Optional[str] = rest_field( + name="userSelectedOSName", visibility=["read", "create", "update", "delete", "query"] + ) + """The OS name selected by user.""" + + @overload + def __init__( + self, + *, + os_type: Optional[str] = None, + product_type: Optional[str] = None, + os_edition: Optional[str] = None, + o_s_version: Optional[str] = None, + o_s_major_version: Optional[str] = None, + o_s_minor_version: Optional[str] = None, + user_selected_os_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 OSDiskDetails(_Model): + """Details of the OS Disk. + + :ivar os_vhd_id: The id of the disk containing the OS. + :vartype os_vhd_id: str + :ivar os_type: The type of the OS on the VM. + :vartype os_type: str + :ivar vhd_name: The OS disk VHD name. + :vartype vhd_name: str + """ + + os_vhd_id: Optional[str] = rest_field(name="osVhdId", visibility=["read", "create", "update", "delete", "query"]) + """The id of the disk containing the OS.""" + os_type: Optional[str] = rest_field(name="osType", visibility=["read", "create", "update", "delete", "query"]) + """The type of the OS on the VM.""" + vhd_name: Optional[str] = rest_field(name="vhdName", visibility=["read", "create", "update", "delete", "query"]) + """The OS disk VHD name.""" + + @overload + def __init__( + self, + *, + os_vhd_id: Optional[str] = None, + os_type: Optional[str] = None, + vhd_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 OSUpgradeSupportedVersions(_Model): + """Supported OS upgrade versions. + + :ivar supported_source_os_version: The source OS version name. + :vartype supported_source_os_version: str + :ivar supported_target_os_versions: The target OS version names. + :vartype supported_target_os_versions: list[str] + """ + + supported_source_os_version: Optional[str] = rest_field(name="supportedSourceOsVersion", visibility=["read"]) + """The source OS version name.""" + supported_target_os_versions: Optional[list[str]] = rest_field( + name="supportedTargetOsVersions", visibility=["read"] + ) + """The target OS version names.""" + + +class OSVersionWrapper(_Model): + """Wrapper model for OSVersion to include version and service pack info. + + :ivar version: The version. + :vartype version: str + :ivar service_pack: The service pack. + :vartype service_pack: str + """ + + version: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The version.""" + service_pack: Optional[str] = rest_field( + name="servicePack", visibility=["read", "create", "update", "delete", "query"] + ) + """The service pack.""" + + @overload + def __init__( + self, + *, + version: Optional[str] = None, + service_pack: 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 PauseReplicationInput(_Model): + """Pause replication input. + + :ivar properties: Pause replication input properties. Required. + :vartype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.PauseReplicationInputProperties + """ + + properties: "_models.PauseReplicationInputProperties" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Pause replication input properties. Required.""" + + @overload + def __init__( + self, + *, + properties: "_models.PauseReplicationInputProperties", + ) -> 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 PauseReplicationInputProperties(_Model): + """Pause replication input properties. + + :ivar instance_type: The class type. Required. + :vartype instance_type: str + """ + + instance_type: str = rest_field(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) + """The class type. Required.""" + + @overload + def __init__( + self, + *, + instance_type: str, + ) -> 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 PlannedFailoverInput(_Model): + """Input definition for planned failover. + + :ivar properties: Planned failover input properties. + :vartype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.PlannedFailoverInputProperties + """ + + properties: Optional["_models.PlannedFailoverInputProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Planned failover input properties.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.PlannedFailoverInputProperties"] = 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 PlannedFailoverInputProperties(_Model): + """Input definition for planned failover input properties. + + :ivar failover_direction: Failover direction. + :vartype failover_direction: str + :ivar provider_specific_details: Provider specific settings. + :vartype provider_specific_details: + ~azure.mgmt.recoveryservicessiterecovery.models.PlannedFailoverProviderSpecificFailoverInput + """ + + failover_direction: Optional[str] = rest_field( + name="failoverDirection", visibility=["read", "create", "update", "delete", "query"] + ) + """Failover direction.""" + provider_specific_details: Optional["_models.PlannedFailoverProviderSpecificFailoverInput"] = rest_field( + name="providerSpecificDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """Provider specific settings.""" + + @overload + def __init__( + self, + *, + failover_direction: Optional[str] = None, + provider_specific_details: Optional["_models.PlannedFailoverProviderSpecificFailoverInput"] = 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 Policy(ProxyResource): + """Protection profile details. + + :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.recoveryservicessiterecovery.models.SystemData + :ivar properties: The custom data. + :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.PolicyProperties + :ivar location: Resource Location. + :vartype location: str + """ + + properties: Optional["_models.PolicyProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The custom data.""" + location: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource Location.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.PolicyProperties"] = None, + location: 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 PolicyProperties(_Model): + """Protection profile custom data details. + + :ivar friendly_name: The FriendlyName. + :vartype friendly_name: str + :ivar provider_specific_details: The ReplicationChannelSetting. + :vartype provider_specific_details: + ~azure.mgmt.recoveryservicessiterecovery.models.PolicyProviderSpecificDetails + """ + + friendly_name: Optional[str] = rest_field( + name="friendlyName", visibility=["read", "create", "update", "delete", "query"] + ) + """The FriendlyName.""" + provider_specific_details: Optional["_models.PolicyProviderSpecificDetails"] = rest_field( + name="providerSpecificDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """The ReplicationChannelSetting.""" + + @overload + def __init__( + self, + *, + friendly_name: Optional[str] = None, + provider_specific_details: Optional["_models.PolicyProviderSpecificDetails"] = 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 ProcessServer(_Model): + """Details of the Process Server. + + :ivar friendly_name: The Process Server's friendly name. + :vartype friendly_name: str + :ivar id: The Process Server Id. + :vartype id: str + :ivar ip_address: The IP address of the server. + :vartype ip_address: str + :ivar os_type: The OS type of the server. + :vartype os_type: str + :ivar agent_version: The version of the scout component on the server. + :vartype agent_version: str + :ivar last_heartbeat: The last heartbeat received from the server. + :vartype last_heartbeat: ~datetime.datetime + :ivar version_status: Version status. + :vartype version_status: str + :ivar mobility_service_updates: The list of the mobility service updates available on the + Process Server. + :vartype mobility_service_updates: + list[~azure.mgmt.recoveryservicessiterecovery.models.MobilityServiceUpdate] + :ivar host_id: The agent generated Id. + :vartype host_id: str + :ivar machine_count: The servers configured with this PS. + :vartype machine_count: str + :ivar replication_pair_count: The number of replication pairs configured in this PS. + :vartype replication_pair_count: str + :ivar system_load: The percentage of the system load. + :vartype system_load: str + :ivar system_load_status: The system load status. + :vartype system_load_status: str + :ivar cpu_load: The percentage of the CPU load. + :vartype cpu_load: str + :ivar cpu_load_status: The CPU load status. + :vartype cpu_load_status: str + :ivar total_memory_in_bytes: The total memory. + :vartype total_memory_in_bytes: int + :ivar available_memory_in_bytes: The available memory. + :vartype available_memory_in_bytes: int + :ivar memory_usage_status: The memory usage status. + :vartype memory_usage_status: str + :ivar total_space_in_bytes: The total space. + :vartype total_space_in_bytes: int + :ivar available_space_in_bytes: The available space. + :vartype available_space_in_bytes: int + :ivar space_usage_status: The space usage status. + :vartype space_usage_status: str + :ivar ps_service_status: The PS service status. + :vartype ps_service_status: str + :ivar ssl_cert_expiry_date: The PS SSL cert expiry date. + :vartype ssl_cert_expiry_date: ~datetime.datetime + :ivar ssl_cert_expiry_remaining_days: CS SSL cert expiry date. + :vartype ssl_cert_expiry_remaining_days: int + :ivar os_version: OS Version of the process server. Note: This will get populated if user has + CS version greater than 9.12.0.0. + :vartype os_version: str + :ivar health_errors: Health errors. + :vartype health_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] + :ivar agent_expiry_date: Agent expiry date. + :vartype agent_expiry_date: ~datetime.datetime + :ivar agent_version_details: The agent version details. + :vartype agent_version_details: ~azure.mgmt.recoveryservicessiterecovery.models.VersionDetails + :ivar health: The health of Process Server. Known values are: "None", "Normal", "Warning", and + "Critical". + :vartype health: str or ~azure.mgmt.recoveryservicessiterecovery.models.ProtectionHealth + :ivar ps_stats_refresh_time: The process server stats refresh time. + :vartype ps_stats_refresh_time: ~datetime.datetime + :ivar throughput_upload_pending_data_in_bytes: The uploading pending data in bytes. + :vartype throughput_upload_pending_data_in_bytes: int + :ivar throughput_in_m_bps: The throughput in MBps. + :vartype throughput_in_m_bps: int + :ivar throughput_in_bytes: The throughput in bytes. + :vartype throughput_in_bytes: int + :ivar throughput_status: The throughput status. + :vartype throughput_status: str + :ivar mars_communication_status: The MARS communication status. + :vartype mars_communication_status: str + :ivar mars_registration_status: The MARS registration status. + :vartype mars_registration_status: str + """ + + friendly_name: Optional[str] = rest_field( + name="friendlyName", visibility=["read", "create", "update", "delete", "query"] + ) + """The Process Server's friendly name.""" + id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The Process Server Id.""" + ip_address: Optional[str] = rest_field(name="ipAddress", visibility=["read", "create", "update", "delete", "query"]) + """The IP address of the server.""" + os_type: Optional[str] = rest_field(name="osType", visibility=["read", "create", "update", "delete", "query"]) + """The OS type of the server.""" + agent_version: Optional[str] = rest_field( + name="agentVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """The version of the scout component on the server.""" + last_heartbeat: Optional[datetime.datetime] = rest_field( + name="lastHeartbeat", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The last heartbeat received from the server.""" + version_status: Optional[str] = rest_field( + name="versionStatus", visibility=["read", "create", "update", "delete", "query"] + ) + """Version status.""" + mobility_service_updates: Optional[list["_models.MobilityServiceUpdate"]] = rest_field( + name="mobilityServiceUpdates", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of the mobility service updates available on the Process Server.""" + host_id: Optional[str] = rest_field(name="hostId", visibility=["read", "create", "update", "delete", "query"]) + """The agent generated Id.""" + machine_count: Optional[str] = rest_field( + name="machineCount", visibility=["read", "create", "update", "delete", "query"] + ) + """The servers configured with this PS.""" + replication_pair_count: Optional[str] = rest_field( + name="replicationPairCount", visibility=["read", "create", "update", "delete", "query"] + ) + """The number of replication pairs configured in this PS.""" + system_load: Optional[str] = rest_field( + name="systemLoad", visibility=["read", "create", "update", "delete", "query"] + ) + """The percentage of the system load.""" + system_load_status: Optional[str] = rest_field( + name="systemLoadStatus", visibility=["read", "create", "update", "delete", "query"] + ) + """The system load status.""" + cpu_load: Optional[str] = rest_field(name="cpuLoad", visibility=["read", "create", "update", "delete", "query"]) + """The percentage of the CPU load.""" + cpu_load_status: Optional[str] = rest_field( + name="cpuLoadStatus", visibility=["read", "create", "update", "delete", "query"] + ) + """The CPU load status.""" + total_memory_in_bytes: Optional[int] = rest_field( + name="totalMemoryInBytes", visibility=["read", "create", "update", "delete", "query"] + ) + """The total memory.""" + available_memory_in_bytes: Optional[int] = rest_field( + name="availableMemoryInBytes", visibility=["read", "create", "update", "delete", "query"] + ) + """The available memory.""" + memory_usage_status: Optional[str] = rest_field( + name="memoryUsageStatus", visibility=["read", "create", "update", "delete", "query"] + ) + """The memory usage status.""" + total_space_in_bytes: Optional[int] = rest_field( + name="totalSpaceInBytes", visibility=["read", "create", "update", "delete", "query"] + ) + """The total space.""" + available_space_in_bytes: Optional[int] = rest_field( + name="availableSpaceInBytes", visibility=["read", "create", "update", "delete", "query"] + ) + """The available space.""" + space_usage_status: Optional[str] = rest_field( + name="spaceUsageStatus", visibility=["read", "create", "update", "delete", "query"] + ) + """The space usage status.""" + ps_service_status: Optional[str] = rest_field( + name="psServiceStatus", visibility=["read", "create", "update", "delete", "query"] + ) + """The PS service status.""" + ssl_cert_expiry_date: Optional[datetime.datetime] = rest_field( + name="sslCertExpiryDate", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The PS SSL cert expiry date.""" + ssl_cert_expiry_remaining_days: Optional[int] = rest_field( + name="sslCertExpiryRemainingDays", visibility=["read", "create", "update", "delete", "query"] + ) + """CS SSL cert expiry date.""" + os_version: Optional[str] = rest_field(name="osVersion", visibility=["read", "create", "update", "delete", "query"]) + """OS Version of the process server. Note: This will get populated if user has CS version greater + than 9.12.0.0.""" + health_errors: Optional[list["_models.HealthError"]] = rest_field( + name="healthErrors", visibility=["read", "create", "update", "delete", "query"] + ) + """Health errors.""" + agent_expiry_date: Optional[datetime.datetime] = rest_field( + name="agentExpiryDate", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """Agent expiry date.""" + agent_version_details: Optional["_models.VersionDetails"] = rest_field( + name="agentVersionDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """The agent version details.""" + health: Optional[Union[str, "_models.ProtectionHealth"]] = rest_field(visibility=["read"]) + """The health of Process Server. Known values are: \"None\", \"Normal\", \"Warning\", and + \"Critical\".""" + ps_stats_refresh_time: Optional[datetime.datetime] = rest_field( + name="psStatsRefreshTime", visibility=["read"], format="rfc3339" + ) + """The process server stats refresh time.""" + throughput_upload_pending_data_in_bytes: Optional[int] = rest_field( + name="throughputUploadPendingDataInBytes", visibility=["read"] + ) + """The uploading pending data in bytes.""" + throughput_in_m_bps: Optional[int] = rest_field(name="throughputInMBps", visibility=["read"]) + """The throughput in MBps.""" + throughput_in_bytes: Optional[int] = rest_field(name="throughputInBytes", visibility=["read"]) + """The throughput in bytes.""" + throughput_status: Optional[str] = rest_field(name="throughputStatus", visibility=["read"]) + """The throughput status.""" + mars_communication_status: Optional[str] = rest_field(name="marsCommunicationStatus", visibility=["read"]) + """The MARS communication status.""" + mars_registration_status: Optional[str] = rest_field(name="marsRegistrationStatus", visibility=["read"]) + """The MARS registration status.""" + + @overload + def __init__( # pylint: disable=too-many-locals + self, + *, + friendly_name: Optional[str] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin + ip_address: Optional[str] = None, + os_type: Optional[str] = None, + agent_version: Optional[str] = None, + last_heartbeat: Optional[datetime.datetime] = None, + version_status: Optional[str] = None, + mobility_service_updates: Optional[list["_models.MobilityServiceUpdate"]] = None, + host_id: Optional[str] = None, + machine_count: Optional[str] = None, + replication_pair_count: Optional[str] = None, + system_load: Optional[str] = None, + system_load_status: Optional[str] = None, + cpu_load: Optional[str] = None, + cpu_load_status: Optional[str] = None, + total_memory_in_bytes: Optional[int] = None, + available_memory_in_bytes: Optional[int] = None, + memory_usage_status: Optional[str] = None, + total_space_in_bytes: Optional[int] = None, + available_space_in_bytes: Optional[int] = None, + space_usage_status: Optional[str] = None, + ps_service_status: Optional[str] = None, + ssl_cert_expiry_date: Optional[datetime.datetime] = None, + ssl_cert_expiry_remaining_days: Optional[int] = None, + os_version: Optional[str] = None, + health_errors: Optional[list["_models.HealthError"]] = None, + agent_expiry_date: Optional[datetime.datetime] = None, + agent_version_details: Optional["_models.VersionDetails"] = 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 ProcessServerDetails(_Model): + """Process server details. + + :ivar id: The process server Id. + :vartype id: str + :ivar name: The process server name. + :vartype name: str + :ivar bios_id: The process server Bios Id. + :vartype bios_id: str + :ivar fabric_object_id: The fabric object Id. + :vartype fabric_object_id: str + :ivar fqdn: The process server Fqdn. + :vartype fqdn: str + :ivar ip_addresses: The list of IP addresses for communicating with the RCM component. + :vartype ip_addresses: list[str] + :ivar version: The version. + :vartype version: str + :ivar last_heartbeat_utc: The last heartbeat received from the process server. + :vartype last_heartbeat_utc: ~datetime.datetime + :ivar total_memory_in_bytes: The total memory. + :vartype total_memory_in_bytes: int + :ivar available_memory_in_bytes: The available memory. + :vartype available_memory_in_bytes: int + :ivar used_memory_in_bytes: The used memory. + :vartype used_memory_in_bytes: int + :ivar memory_usage_percentage: The memory usage percentage. + :vartype memory_usage_percentage: float + :ivar total_space_in_bytes: The total disk space. + :vartype total_space_in_bytes: int + :ivar available_space_in_bytes: The available disk space. + :vartype available_space_in_bytes: int + :ivar used_space_in_bytes: The used disk space. + :vartype used_space_in_bytes: int + :ivar free_space_percentage: The free disk space percentage. + :vartype free_space_percentage: float + :ivar throughput_upload_pending_data_in_bytes: The uploading pending data in bytes. + :vartype throughput_upload_pending_data_in_bytes: int + :ivar throughput_in_bytes: The throughput in bytes. + :vartype throughput_in_bytes: int + :ivar processor_usage_percentage: The processor usage percentage. + :vartype processor_usage_percentage: float + :ivar throughput_status: The throughput status. Known values are: "Healthy", "Warning", + "Critical", and "Unknown". + :vartype throughput_status: str or + ~azure.mgmt.recoveryservicessiterecovery.models.RcmComponentStatus + :ivar system_load: The system load. + :vartype system_load: int + :ivar system_load_status: The system load status. Known values are: "Healthy", "Warning", + "Critical", and "Unknown". + :vartype system_load_status: str or + ~azure.mgmt.recoveryservicessiterecovery.models.RcmComponentStatus + :ivar disk_usage_status: The disk usage status. Known values are: "Healthy", "Warning", + "Critical", and "Unknown". + :vartype disk_usage_status: str or + ~azure.mgmt.recoveryservicessiterecovery.models.RcmComponentStatus + :ivar memory_usage_status: The memory usage status. Known values are: "Healthy", "Warning", + "Critical", and "Unknown". + :vartype memory_usage_status: str or + ~azure.mgmt.recoveryservicessiterecovery.models.RcmComponentStatus + :ivar processor_usage_status: The processor usage status. Known values are: "Healthy", + "Warning", "Critical", and "Unknown". + :vartype processor_usage_status: str or + ~azure.mgmt.recoveryservicessiterecovery.models.RcmComponentStatus + :ivar health: The health of the process server. Known values are: "None", "Normal", "Warning", + and "Critical". + :vartype health: str or ~azure.mgmt.recoveryservicessiterecovery.models.ProtectionHealth + :ivar health_errors: The health errors. + :vartype health_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] + :ivar protected_item_count: The protected item count. + :vartype protected_item_count: int + :ivar historic_health: The historic health of the process server based on the health in last 24 + hours. Known values are: "None", "Normal", "Warning", and "Critical". + :vartype historic_health: str or + ~azure.mgmt.recoveryservicessiterecovery.models.ProtectionHealth + """ + + id: Optional[str] = rest_field(visibility=["read"]) + """The process server Id.""" + name: Optional[str] = rest_field(visibility=["read"]) + """The process server name.""" + bios_id: Optional[str] = rest_field(name="biosId", visibility=["read"]) + """The process server Bios Id.""" + fabric_object_id: Optional[str] = rest_field(name="fabricObjectId", visibility=["read"]) + """The fabric object Id.""" + fqdn: Optional[str] = rest_field(visibility=["read"]) + """The process server Fqdn.""" + ip_addresses: Optional[list[str]] = rest_field(name="ipAddresses", visibility=["read"]) + """The list of IP addresses for communicating with the RCM component.""" + version: Optional[str] = rest_field(visibility=["read"]) + """The version.""" + last_heartbeat_utc: Optional[datetime.datetime] = rest_field( + name="lastHeartbeatUtc", visibility=["read"], format="rfc3339" + ) + """The last heartbeat received from the process server.""" + total_memory_in_bytes: Optional[int] = rest_field(name="totalMemoryInBytes", visibility=["read"]) + """The total memory.""" + available_memory_in_bytes: Optional[int] = rest_field(name="availableMemoryInBytes", visibility=["read"]) + """The available memory.""" + used_memory_in_bytes: Optional[int] = rest_field(name="usedMemoryInBytes", visibility=["read"]) + """The used memory.""" + memory_usage_percentage: Optional[float] = rest_field(name="memoryUsagePercentage", visibility=["read"]) + """The memory usage percentage.""" + total_space_in_bytes: Optional[int] = rest_field(name="totalSpaceInBytes", visibility=["read"]) + """The total disk space.""" + available_space_in_bytes: Optional[int] = rest_field(name="availableSpaceInBytes", visibility=["read"]) + """The available disk space.""" + used_space_in_bytes: Optional[int] = rest_field(name="usedSpaceInBytes", visibility=["read"]) + """The used disk space.""" + free_space_percentage: Optional[float] = rest_field(name="freeSpacePercentage", visibility=["read"]) + """The free disk space percentage.""" + throughput_upload_pending_data_in_bytes: Optional[int] = rest_field( + name="throughputUploadPendingDataInBytes", visibility=["read"] + ) + """The uploading pending data in bytes.""" + throughput_in_bytes: Optional[int] = rest_field(name="throughputInBytes", visibility=["read"]) + """The throughput in bytes.""" + processor_usage_percentage: Optional[float] = rest_field(name="processorUsagePercentage", visibility=["read"]) + """The processor usage percentage.""" + throughput_status: Optional[Union[str, "_models.RcmComponentStatus"]] = rest_field( + name="throughputStatus", visibility=["read"] + ) + """The throughput status. Known values are: \"Healthy\", \"Warning\", \"Critical\", and + \"Unknown\".""" + system_load: Optional[int] = rest_field(name="systemLoad", visibility=["read"]) + """The system load.""" + system_load_status: Optional[Union[str, "_models.RcmComponentStatus"]] = rest_field( + name="systemLoadStatus", visibility=["read"] + ) + """The system load status. Known values are: \"Healthy\", \"Warning\", \"Critical\", and + \"Unknown\".""" + disk_usage_status: Optional[Union[str, "_models.RcmComponentStatus"]] = rest_field( + name="diskUsageStatus", visibility=["read"] + ) + """The disk usage status. Known values are: \"Healthy\", \"Warning\", \"Critical\", and + \"Unknown\".""" + memory_usage_status: Optional[Union[str, "_models.RcmComponentStatus"]] = rest_field( + name="memoryUsageStatus", visibility=["read"] + ) + """The memory usage status. Known values are: \"Healthy\", \"Warning\", \"Critical\", and + \"Unknown\".""" + processor_usage_status: Optional[Union[str, "_models.RcmComponentStatus"]] = rest_field( + name="processorUsageStatus", visibility=["read"] + ) + """The processor usage status. Known values are: \"Healthy\", \"Warning\", \"Critical\", and + \"Unknown\".""" + health: Optional[Union[str, "_models.ProtectionHealth"]] = rest_field(visibility=["read"]) + """The health of the process server. Known values are: \"None\", \"Normal\", \"Warning\", and + \"Critical\".""" + health_errors: Optional[list["_models.HealthError"]] = rest_field(name="healthErrors", visibility=["read"]) + """The health errors.""" + protected_item_count: Optional[int] = rest_field(name="protectedItemCount", visibility=["read"]) + """The protected item count.""" + historic_health: Optional[Union[str, "_models.ProtectionHealth"]] = rest_field( + name="historicHealth", visibility=["read"] + ) + """The historic health of the process server based on the health in last 24 hours. Known values + are: \"None\", \"Normal\", \"Warning\", and \"Critical\".""" + + +class ProtectableItem(ProxyResource): + """Replication protected item. + + :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.recoveryservicessiterecovery.models.SystemData + :ivar properties: The custom data. + :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.ProtectableItemProperties + :ivar location: Resource Location. + :vartype location: str + """ + + properties: Optional["_models.ProtectableItemProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The custom data.""" + location: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource Location.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.ProtectableItemProperties"] = None, + location: 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 ProtectableItemProperties(_Model): + """Replication protected item custom data details. + + :ivar friendly_name: The name. + :vartype friendly_name: str + :ivar protection_status: The protection status. + :vartype protection_status: str + :ivar replication_protected_item_id: The ARM resource of protected items. + :vartype replication_protected_item_id: str + :ivar recovery_services_provider_id: The recovery provider ARM Id. + :vartype recovery_services_provider_id: str + :ivar protection_readiness_errors: The Current protection readiness errors. + :vartype protection_readiness_errors: list[str] + :ivar supported_replication_providers: The list of replication providers supported for the + protectable item. + :vartype supported_replication_providers: list[str] + :ivar custom_details: The Replication provider custom settings. + :vartype custom_details: ~azure.mgmt.recoveryservicessiterecovery.models.ConfigurationSettings + """ + + friendly_name: Optional[str] = rest_field( + name="friendlyName", visibility=["read", "create", "update", "delete", "query"] + ) + """The name.""" + protection_status: Optional[str] = rest_field( + name="protectionStatus", visibility=["read", "create", "update", "delete", "query"] + ) + """The protection status.""" + replication_protected_item_id: Optional[str] = rest_field( + name="replicationProtectedItemId", visibility=["read", "create", "update", "delete", "query"] + ) + """The ARM resource of protected items.""" + recovery_services_provider_id: Optional[str] = rest_field( + name="recoveryServicesProviderId", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery provider ARM Id.""" + protection_readiness_errors: Optional[list[str]] = rest_field( + name="protectionReadinessErrors", visibility=["read", "create", "update", "delete", "query"] + ) + """The Current protection readiness errors.""" + supported_replication_providers: Optional[list[str]] = rest_field( + name="supportedReplicationProviders", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of replication providers supported for the protectable item.""" + custom_details: Optional["_models.ConfigurationSettings"] = rest_field( + name="customDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """The Replication provider custom settings.""" + + @overload + def __init__( + self, + *, + friendly_name: Optional[str] = None, + protection_status: Optional[str] = None, + replication_protected_item_id: Optional[str] = None, + recovery_services_provider_id: Optional[str] = None, + protection_readiness_errors: Optional[list[str]] = None, + supported_replication_providers: Optional[list[str]] = None, + custom_details: Optional["_models.ConfigurationSettings"] = 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 ProtectionContainer(ProxyResource): + """Protection container details. + + :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.recoveryservicessiterecovery.models.SystemData + :ivar properties: The custom data. + :vartype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerProperties + :ivar location: Resource Location. + :vartype location: str + """ + + properties: Optional["_models.ProtectionContainerProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The custom data.""" + location: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource Location.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.ProtectionContainerProperties"] = None, + location: 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 ProtectionContainerFabricSpecificDetails(_Model): + """Base class for fabric specific details of container. + + :ivar instance_type: Gets the class type. Overridden in derived classes. + :vartype instance_type: str + """ + + instance_type: Optional[str] = rest_field(name="instanceType", visibility=["read"]) + """Gets the class type. Overridden in derived classes.""" + + +class ProtectionContainerMapping(ProxyResource): + """Protection container mapping 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.recoveryservicessiterecovery.models.SystemData + :ivar properties: The custom data. + :vartype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerMappingProperties + :ivar location: Resource Location. + :vartype location: str + """ + + properties: Optional["_models.ProtectionContainerMappingProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The custom data.""" + location: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource Location.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.ProtectionContainerMappingProperties"] = None, + location: 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 ProtectionContainerMappingProperties(_Model): + """Protection container mapping properties. + + :ivar target_protection_container_id: Paired protection container ARM ID. + :vartype target_protection_container_id: str + :ivar target_protection_container_friendly_name: Friendly name of paired container. + :vartype target_protection_container_friendly_name: str + :ivar provider_specific_details: Provider specific provider details. + :vartype provider_specific_details: + ~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerMappingProviderSpecificDetails + :ivar health: Health of pairing. + :vartype health: str + :ivar health_error_details: Health error. + :vartype health_error_details: + list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] + :ivar policy_id: Policy ARM Id. + :vartype policy_id: str + :ivar state: Association Status. + :vartype state: str + :ivar source_protection_container_friendly_name: Friendly name of source protection container. + :vartype source_protection_container_friendly_name: str + :ivar source_fabric_friendly_name: Friendly name of source fabric. + :vartype source_fabric_friendly_name: str + :ivar target_fabric_friendly_name: Friendly name of target fabric. + :vartype target_fabric_friendly_name: str + :ivar policy_friendly_name: Friendly name of replication policy. + :vartype policy_friendly_name: str + """ + + target_protection_container_id: Optional[str] = rest_field( + name="targetProtectionContainerId", visibility=["read", "create", "update", "delete", "query"] + ) + """Paired protection container ARM ID.""" + target_protection_container_friendly_name: Optional[str] = rest_field( + name="targetProtectionContainerFriendlyName", visibility=["read", "create", "update", "delete", "query"] + ) + """Friendly name of paired container.""" + provider_specific_details: Optional["_models.ProtectionContainerMappingProviderSpecificDetails"] = rest_field( + name="providerSpecificDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """Provider specific provider details.""" + health: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Health of pairing.""" + health_error_details: Optional[list["_models.HealthError"]] = rest_field( + name="healthErrorDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """Health error.""" + policy_id: Optional[str] = rest_field(name="policyId", visibility=["read", "create", "update", "delete", "query"]) + """Policy ARM Id.""" + state: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Association Status.""" + source_protection_container_friendly_name: Optional[str] = rest_field( + name="sourceProtectionContainerFriendlyName", visibility=["read", "create", "update", "delete", "query"] + ) + """Friendly name of source protection container.""" + source_fabric_friendly_name: Optional[str] = rest_field( + name="sourceFabricFriendlyName", visibility=["read", "create", "update", "delete", "query"] + ) + """Friendly name of source fabric.""" + target_fabric_friendly_name: Optional[str] = rest_field( + name="targetFabricFriendlyName", visibility=["read", "create", "update", "delete", "query"] + ) + """Friendly name of target fabric.""" + policy_friendly_name: Optional[str] = rest_field( + name="policyFriendlyName", visibility=["read", "create", "update", "delete", "query"] + ) + """Friendly name of replication policy.""" + + @overload + def __init__( + self, + *, + target_protection_container_id: Optional[str] = None, + target_protection_container_friendly_name: Optional[str] = None, + provider_specific_details: Optional["_models.ProtectionContainerMappingProviderSpecificDetails"] = None, + health: Optional[str] = None, + health_error_details: Optional[list["_models.HealthError"]] = None, + policy_id: Optional[str] = None, + state: Optional[str] = None, + source_protection_container_friendly_name: Optional[str] = None, + source_fabric_friendly_name: Optional[str] = None, + target_fabric_friendly_name: Optional[str] = None, + policy_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 ProtectionContainerProperties(_Model): + """Protection profile custom data details. + + :ivar fabric_friendly_name: Fabric friendly name. + :vartype fabric_friendly_name: str + :ivar friendly_name: The name. + :vartype friendly_name: str + :ivar fabric_type: The fabric type. + :vartype fabric_type: str + :ivar protected_item_count: Number of protected PEs. + :vartype protected_item_count: int + :ivar pairing_status: The pairing status of this cloud. + :vartype pairing_status: str + :ivar role: The role of this cloud. + :vartype role: str + :ivar fabric_specific_details: Fabric specific details. + :vartype fabric_specific_details: + ~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerFabricSpecificDetails + """ + + fabric_friendly_name: Optional[str] = rest_field( + name="fabricFriendlyName", visibility=["read", "create", "update", "delete", "query"] + ) + """Fabric friendly name.""" + friendly_name: Optional[str] = rest_field( + name="friendlyName", visibility=["read", "create", "update", "delete", "query"] + ) + """The name.""" + fabric_type: Optional[str] = rest_field( + name="fabricType", visibility=["read", "create", "update", "delete", "query"] + ) + """The fabric type.""" + protected_item_count: Optional[int] = rest_field( + name="protectedItemCount", visibility=["read", "create", "update", "delete", "query"] + ) + """Number of protected PEs.""" + pairing_status: Optional[str] = rest_field( + name="pairingStatus", visibility=["read", "create", "update", "delete", "query"] + ) + """The pairing status of this cloud.""" + role: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The role of this cloud.""" + fabric_specific_details: Optional["_models.ProtectionContainerFabricSpecificDetails"] = rest_field( + name="fabricSpecificDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """Fabric specific details.""" + + @overload + def __init__( + self, + *, + fabric_friendly_name: Optional[str] = None, + friendly_name: Optional[str] = None, + fabric_type: Optional[str] = None, + protected_item_count: Optional[int] = None, + pairing_status: Optional[str] = None, + role: Optional[str] = None, + fabric_specific_details: Optional["_models.ProtectionContainerFabricSpecificDetails"] = 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 ProviderError(_Model): + """This class contains the error details per object. + + :ivar error_code: The Error code. + :vartype error_code: int + :ivar error_message: The Error message. + :vartype error_message: str + :ivar error_id: The Provider error Id. + :vartype error_id: str + :ivar possible_causes: The possible causes for the error. + :vartype possible_causes: str + :ivar recommended_action: The recommended action to resolve the error. + :vartype recommended_action: str + """ + + error_code: Optional[int] = rest_field(name="errorCode", visibility=["read", "create", "update", "delete", "query"]) + """The Error code.""" + error_message: Optional[str] = rest_field( + name="errorMessage", visibility=["read", "create", "update", "delete", "query"] + ) + """The Error message.""" + error_id: Optional[str] = rest_field(name="errorId", visibility=["read", "create", "update", "delete", "query"]) + """The Provider error Id.""" + possible_causes: Optional[str] = rest_field( + name="possibleCauses", visibility=["read", "create", "update", "delete", "query"] + ) + """The possible causes for the error.""" + recommended_action: Optional[str] = rest_field( + name="recommendedAction", visibility=["read", "create", "update", "delete", "query"] + ) + """The recommended action to resolve the error.""" + + @overload + def __init__( + self, + *, + error_code: Optional[int] = None, + error_message: Optional[str] = None, + error_id: Optional[str] = None, + possible_causes: Optional[str] = None, + recommended_action: 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 PushInstallerDetails(_Model): + """Push installer details. + + :ivar id: The push installer Id. + :vartype id: str + :ivar name: The push installer name. + :vartype name: str + :ivar bios_id: The push installer Bios Id. + :vartype bios_id: str + :ivar fabric_object_id: The fabric object Id. + :vartype fabric_object_id: str + :ivar fqdn: The push installer Fqdn. + :vartype fqdn: str + :ivar version: The version. + :vartype version: str + :ivar last_heartbeat_utc: The last heartbeat received from the push installer. + :vartype last_heartbeat_utc: ~datetime.datetime + :ivar health: The health of the push installer. Known values are: "None", "Normal", "Warning", + and "Critical". + :vartype health: str or ~azure.mgmt.recoveryservicessiterecovery.models.ProtectionHealth + :ivar health_errors: The health errors. + :vartype health_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] + """ + + id: Optional[str] = rest_field(visibility=["read"]) + """The push installer Id.""" + name: Optional[str] = rest_field(visibility=["read"]) + """The push installer name.""" + bios_id: Optional[str] = rest_field(name="biosId", visibility=["read"]) + """The push installer Bios Id.""" + fabric_object_id: Optional[str] = rest_field(name="fabricObjectId", visibility=["read"]) + """The fabric object Id.""" + fqdn: Optional[str] = rest_field(visibility=["read"]) + """The push installer Fqdn.""" + version: Optional[str] = rest_field(visibility=["read"]) + """The version.""" + last_heartbeat_utc: Optional[datetime.datetime] = rest_field( + name="lastHeartbeatUtc", visibility=["read"], format="rfc3339" + ) + """The last heartbeat received from the push installer.""" + health: Optional[Union[str, "_models.ProtectionHealth"]] = rest_field(visibility=["read"]) + """The health of the push installer. Known values are: \"None\", \"Normal\", \"Warning\", and + \"Critical\".""" + health_errors: Optional[list["_models.HealthError"]] = rest_field(name="healthErrors", visibility=["read"]) + """The health errors.""" + + +class RcmProxyDetails(_Model): + """RCM proxy details. + + :ivar id: The RCM proxy Id. + :vartype id: str + :ivar name: The RCM proxy name. + :vartype name: str + :ivar bios_id: The RCM proxy Bios Id. + :vartype bios_id: str + :ivar fabric_object_id: The fabric object Id. + :vartype fabric_object_id: str + :ivar fqdn: The RCM proxy Fqdn. + :vartype fqdn: str + :ivar client_authentication_type: The client authentication type. + :vartype client_authentication_type: str + :ivar version: The version. + :vartype version: str + :ivar last_heartbeat_utc: The last heartbeat received from the RCM proxy. + :vartype last_heartbeat_utc: ~datetime.datetime + :ivar health: The health of the RCM proxy. Known values are: "None", "Normal", "Warning", and + "Critical". + :vartype health: str or ~azure.mgmt.recoveryservicessiterecovery.models.ProtectionHealth + :ivar health_errors: The health errors. + :vartype health_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] + """ + + id: Optional[str] = rest_field(visibility=["read"]) + """The RCM proxy Id.""" + name: Optional[str] = rest_field(visibility=["read"]) + """The RCM proxy name.""" + bios_id: Optional[str] = rest_field(name="biosId", visibility=["read"]) + """The RCM proxy Bios Id.""" + fabric_object_id: Optional[str] = rest_field(name="fabricObjectId", visibility=["read"]) + """The fabric object Id.""" + fqdn: Optional[str] = rest_field(visibility=["read"]) + """The RCM proxy Fqdn.""" + client_authentication_type: Optional[str] = rest_field(name="clientAuthenticationType", visibility=["read"]) + """The client authentication type.""" + version: Optional[str] = rest_field(visibility=["read"]) + """The version.""" + last_heartbeat_utc: Optional[datetime.datetime] = rest_field( + name="lastHeartbeatUtc", visibility=["read"], format="rfc3339" + ) + """The last heartbeat received from the RCM proxy.""" + health: Optional[Union[str, "_models.ProtectionHealth"]] = rest_field(visibility=["read"]) + """The health of the RCM proxy. Known values are: \"None\", \"Normal\", \"Warning\", and + \"Critical\".""" + health_errors: Optional[list["_models.HealthError"]] = rest_field(name="healthErrors", visibility=["read"]) + """The health errors.""" + + +class RecoveryPlan(ProxyResource): + """Recovery plan details. + + :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.recoveryservicessiterecovery.models.SystemData + :ivar properties: The custom details. + :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanProperties + :ivar location: Resource Location. + :vartype location: str + """ + + properties: Optional["_models.RecoveryPlanProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The custom details.""" + location: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource Location.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.RecoveryPlanProperties"] = None, + location: 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 RecoveryPlanProviderSpecificDetails(_Model): + """Recovery plan provider specific details. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + RecoveryPlanA2ADetails + + :ivar instance_type: Gets the Instance type. Required. Default value is None. + :vartype instance_type: str + """ + + __mapping__: dict[str, _Model] = {} + instance_type: str = rest_discriminator( + name="instanceType", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets the Instance type. Required. Default value is None.""" + + @overload + def __init__( + self, + *, + instance_type: str, + ) -> 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 RecoveryPlanA2ADetails(RecoveryPlanProviderSpecificDetails, discriminator="A2A"): + """Recovery plan A2A specific details. + + :ivar primary_zone: The primary zone. + :vartype primary_zone: str + :ivar recovery_zone: The recovery zone. + :vartype recovery_zone: str + :ivar primary_extended_location: The primary extended location. + :vartype primary_extended_location: + ~azure.mgmt.recoveryservicessiterecovery.models.ExtendedLocation + :ivar recovery_extended_location: The recovery extended location. + :vartype recovery_extended_location: + ~azure.mgmt.recoveryservicessiterecovery.models.ExtendedLocation + :ivar instance_type: Gets the Instance type. Required. Default value is "A2A". + :vartype instance_type: str + """ + + primary_zone: Optional[str] = rest_field( + name="primaryZone", visibility=["read", "create", "update", "delete", "query"] + ) + """The primary zone.""" + recovery_zone: Optional[str] = rest_field( + name="recoveryZone", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery zone.""" + primary_extended_location: Optional["_models.ExtendedLocation"] = rest_field( + name="primaryExtendedLocation", visibility=["read", "create", "update", "delete", "query"] + ) + """The primary extended location.""" + recovery_extended_location: Optional["_models.ExtendedLocation"] = rest_field( + name="recoveryExtendedLocation", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery extended location.""" + instance_type: Literal["A2A"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets the Instance type. Required. Default value is \"A2A\".""" + + @overload + def __init__( + self, + *, + primary_zone: Optional[str] = None, + recovery_zone: Optional[str] = None, + primary_extended_location: Optional["_models.ExtendedLocation"] = None, + recovery_extended_location: Optional["_models.ExtendedLocation"] = 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) + self.instance_type = "A2A" # type: ignore + + +class RecoveryPlanProviderSpecificFailoverInput(_Model): # pylint: disable=name-too-long + """Recovery plan provider specific failover input. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + RecoveryPlanA2AFailoverInput, RecoveryPlanHyperVReplicaAzureFailoverInput, + RecoveryPlanHyperVReplicaAzureFailbackInput, RecoveryPlanInMageFailoverInput, + RecoveryPlanInMageAzureV2FailoverInput, RecoveryPlanInMageRcmFailoverInput, + RecoveryPlanInMageRcmFailbackFailoverInput + + :ivar instance_type: The class type. Required. Default value is None. + :vartype instance_type: str + """ + + __mapping__: dict[str, _Model] = {} + instance_type: str = rest_discriminator( + name="instanceType", visibility=["read", "create", "update", "delete", "query"] + ) + """The class type. Required. Default value is None.""" + + @overload + def __init__( + self, + *, + instance_type: str, + ) -> 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 RecoveryPlanA2AFailoverInput(RecoveryPlanProviderSpecificFailoverInput, discriminator="A2A"): + """Recovery plan A2A failover input. + + :ivar recovery_point_type: The recovery point type. Required. Known values are: "Latest", + "LatestApplicationConsistent", "LatestCrashConsistent", and "LatestProcessed". + :vartype recovery_point_type: str or + ~azure.mgmt.recoveryservicessiterecovery.models.A2ARpRecoveryPointType + :ivar cloud_service_creation_option: A value indicating whether to use recovery cloud service + for TFO or not. + :vartype cloud_service_creation_option: str + :ivar multi_vm_sync_point_option: A value indicating whether multi VM sync enabled VMs should + use multi VM sync points for failover. Known values are: "UseMultiVmSyncRecoveryPoint" and + "UsePerVmRecoveryPoint". + :vartype multi_vm_sync_point_option: str or + ~azure.mgmt.recoveryservicessiterecovery.models.MultiVmSyncPointOption + :ivar instance_type: The class type. Required. Default value is "A2A". + :vartype instance_type: str + """ + + recovery_point_type: Union[str, "_models.A2ARpRecoveryPointType"] = rest_field( + name="recoveryPointType", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery point type. Required. Known values are: \"Latest\", + \"LatestApplicationConsistent\", \"LatestCrashConsistent\", and \"LatestProcessed\".""" + cloud_service_creation_option: Optional[str] = rest_field( + name="cloudServiceCreationOption", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether to use recovery cloud service for TFO or not.""" + multi_vm_sync_point_option: Optional[Union[str, "_models.MultiVmSyncPointOption"]] = rest_field( + name="multiVmSyncPointOption", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether multi VM sync enabled VMs should use multi VM sync points for + failover. Known values are: \"UseMultiVmSyncRecoveryPoint\" and \"UsePerVmRecoveryPoint\".""" + instance_type: Literal["A2A"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The class type. Required. Default value is \"A2A\".""" + + @overload + def __init__( + self, + *, + recovery_point_type: Union[str, "_models.A2ARpRecoveryPointType"], + cloud_service_creation_option: Optional[str] = None, + multi_vm_sync_point_option: Optional[Union[str, "_models.MultiVmSyncPointOption"]] = 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) + self.instance_type = "A2A" # type: ignore + + +class RecoveryPlanProviderSpecificInput(_Model): + """Recovery plan provider specific input base class. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + RecoveryPlanA2AInput + + :ivar instance_type: Gets the Instance type. Required. Default value is None. + :vartype instance_type: str + """ + + __mapping__: dict[str, _Model] = {} + instance_type: str = rest_discriminator( + name="instanceType", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets the Instance type. Required. Default value is None.""" + + @overload + def __init__( + self, + *, + instance_type: str, + ) -> 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 RecoveryPlanA2AInput(RecoveryPlanProviderSpecificInput, discriminator="A2A"): + """Recovery plan A2A input. + + :ivar primary_zone: The primary zone. + :vartype primary_zone: str + :ivar recovery_zone: The recovery zone. + :vartype recovery_zone: str + :ivar primary_extended_location: The primary extended location. + :vartype primary_extended_location: + ~azure.mgmt.recoveryservicessiterecovery.models.ExtendedLocation + :ivar recovery_extended_location: The recovery extended location. + :vartype recovery_extended_location: + ~azure.mgmt.recoveryservicessiterecovery.models.ExtendedLocation + :ivar instance_type: Gets the Instance type. Required. Default value is "A2A". + :vartype instance_type: str + """ + + primary_zone: Optional[str] = rest_field( + name="primaryZone", visibility=["read", "create", "update", "delete", "query"] + ) + """The primary zone.""" + recovery_zone: Optional[str] = rest_field( + name="recoveryZone", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery zone.""" + primary_extended_location: Optional["_models.ExtendedLocation"] = rest_field( + name="primaryExtendedLocation", visibility=["read", "create", "update", "delete", "query"] + ) + """The primary extended location.""" + recovery_extended_location: Optional["_models.ExtendedLocation"] = rest_field( + name="recoveryExtendedLocation", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery extended location.""" + instance_type: Literal["A2A"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets the Instance type. Required. Default value is \"A2A\".""" + + @overload + def __init__( + self, + *, + primary_zone: Optional[str] = None, + recovery_zone: Optional[str] = None, + primary_extended_location: Optional["_models.ExtendedLocation"] = None, + recovery_extended_location: Optional["_models.ExtendedLocation"] = 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) + self.instance_type = "A2A" # type: ignore + + +class RecoveryPlanAction(_Model): + """Recovery plan action details. + + :ivar action_name: The action name. Required. + :vartype action_name: str + :ivar failover_types: The list of failover types. Required. + :vartype failover_types: list[str or + ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItemOperation] + :ivar failover_directions: The list of failover directions. Required. + :vartype failover_directions: list[str or + ~azure.mgmt.recoveryservicessiterecovery.models.PossibleOperationsDirections] + :ivar custom_details: The custom details. Required. + :vartype custom_details: + ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanActionDetails + """ + + action_name: str = rest_field(name="actionName", visibility=["read", "create", "update", "delete", "query"]) + """The action name. Required.""" + failover_types: list[Union[str, "_models.ReplicationProtectedItemOperation"]] = rest_field( + name="failoverTypes", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of failover types. Required.""" + failover_directions: list[Union[str, "_models.PossibleOperationsDirections"]] = rest_field( + name="failoverDirections", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of failover directions. Required.""" + custom_details: "_models.RecoveryPlanActionDetails" = rest_field( + name="customDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """The custom details. Required.""" + + @overload + def __init__( + self, + *, + action_name: str, + failover_types: list[Union[str, "_models.ReplicationProtectedItemOperation"]], + failover_directions: list[Union[str, "_models.PossibleOperationsDirections"]], + custom_details: "_models.RecoveryPlanActionDetails", + ) -> 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 RecoveryPlanActionDetails(_Model): + """Recovery plan action custom details. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + RecoveryPlanAutomationRunbookActionDetails, RecoveryPlanManualActionDetails, + RecoveryPlanScriptActionDetails + + :ivar instance_type: Gets the type of action details (see RecoveryPlanActionDetailsTypes enum + for possible values). Required. Default value is None. + :vartype instance_type: str + """ + + __mapping__: dict[str, _Model] = {} + instance_type: str = rest_discriminator( + name="instanceType", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets the type of action details (see RecoveryPlanActionDetailsTypes enum for possible values). + Required. Default value is None.""" + + @overload + def __init__( + self, + *, + instance_type: str, + ) -> 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 RecoveryPlanAutomationRunbookActionDetails( + RecoveryPlanActionDetails, discriminator="AutomationRunbookActionDetails" +): # pylint: disable=name-too-long + """Recovery plan Automation runbook action details. + + :ivar runbook_id: The runbook ARM Id. + :vartype runbook_id: str + :ivar timeout: The runbook timeout. + :vartype timeout: str + :ivar fabric_location: The fabric location. Required. Known values are: "Primary" and + "Recovery". + :vartype fabric_location: str or + ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanActionLocation + :ivar instance_type: Gets the type of action details (see RecoveryPlanActionDetailsTypes enum + for possible values). Required. Default value is "AutomationRunbookActionDetails". + :vartype instance_type: str + """ + + runbook_id: Optional[str] = rest_field(name="runbookId", visibility=["read", "create", "update", "delete", "query"]) + """The runbook ARM Id.""" + timeout: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The runbook timeout.""" + fabric_location: Union[str, "_models.RecoveryPlanActionLocation"] = rest_field( + name="fabricLocation", visibility=["read", "create", "update", "delete", "query"] + ) + """The fabric location. Required. Known values are: \"Primary\" and \"Recovery\".""" + instance_type: Literal["AutomationRunbookActionDetails"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets the type of action details (see RecoveryPlanActionDetailsTypes enum for possible values). + Required. Default value is \"AutomationRunbookActionDetails\".""" + + @overload + def __init__( + self, + *, + fabric_location: Union[str, "_models.RecoveryPlanActionLocation"], + runbook_id: Optional[str] = None, + timeout: 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) + self.instance_type = "AutomationRunbookActionDetails" # type: ignore + + +class RecoveryPlanGroup(_Model): + """Recovery plan group details. + + :ivar group_type: The group type. Required. Known values are: "Shutdown", "Boot", and + "Failover". + :vartype group_type: str or + ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanGroupType + :ivar replication_protected_items: The list of protected items. + :vartype replication_protected_items: + list[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanProtectedItem] + :ivar start_group_actions: The start group actions. + :vartype start_group_actions: + list[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanAction] + :ivar end_group_actions: The end group actions. + :vartype end_group_actions: + list[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanAction] + """ + + group_type: Union[str, "_models.RecoveryPlanGroupType"] = rest_field( + name="groupType", visibility=["read", "create", "update", "delete", "query"] + ) + """The group type. Required. Known values are: \"Shutdown\", \"Boot\", and \"Failover\".""" + replication_protected_items: Optional[list["_models.RecoveryPlanProtectedItem"]] = rest_field( + name="replicationProtectedItems", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of protected items.""" + start_group_actions: Optional[list["_models.RecoveryPlanAction"]] = rest_field( + name="startGroupActions", visibility=["read", "create", "update", "delete", "query"] + ) + """The start group actions.""" + end_group_actions: Optional[list["_models.RecoveryPlanAction"]] = rest_field( + name="endGroupActions", visibility=["read", "create", "update", "delete", "query"] + ) + """The end group actions.""" + + @overload + def __init__( + self, + *, + group_type: Union[str, "_models.RecoveryPlanGroupType"], + replication_protected_items: Optional[list["_models.RecoveryPlanProtectedItem"]] = None, + start_group_actions: Optional[list["_models.RecoveryPlanAction"]] = None, + end_group_actions: Optional[list["_models.RecoveryPlanAction"]] = 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 RecoveryPlanGroupTaskDetails(GroupTaskDetails, discriminator="RecoveryPlanGroupTaskDetails"): + """This class represents the recovery plan group task. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + RecoveryPlanShutdownGroupTaskDetails + + :ivar child_tasks: The child tasks. + :vartype child_tasks: list[~azure.mgmt.recoveryservicessiterecovery.models.ASRTask] + :ivar instance_type: Required. Default value is "RecoveryPlanGroupTaskDetails". + :vartype instance_type: str + :ivar name: The name. + :vartype name: str + :ivar group_id: The group identifier. + :vartype group_id: str + :ivar rp_group_type: The group type. + :vartype rp_group_type: str + """ + + __mapping__: dict[str, _Model] = {} + instance_type: Literal["RecoveryPlanGroupTaskDetails"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Required. Default value is \"RecoveryPlanGroupTaskDetails\".""" + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name.""" + group_id: Optional[str] = rest_field(name="groupId", visibility=["read", "create", "update", "delete", "query"]) + """The group identifier.""" + rp_group_type: Optional[str] = rest_field( + name="rpGroupType", visibility=["read", "create", "update", "delete", "query"] + ) + """The group type.""" + + @overload + def __init__( + self, + *, + child_tasks: Optional[list["_models.ASRTask"]] = None, + name: Optional[str] = None, + group_id: Optional[str] = None, + rp_group_type: 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) + self.instance_type = "RecoveryPlanGroupTaskDetails" # type: ignore + + +class RecoveryPlanHyperVReplicaAzureFailbackInput( + RecoveryPlanProviderSpecificFailoverInput, discriminator="HyperVReplicaAzureFailback" +): # pylint: disable=name-too-long + """Recovery plan HVR Azure failback input. + + :ivar data_sync_option: The data sync option. Required. Known values are: "ForDownTime" and + "ForSynchronization". + :vartype data_sync_option: str or + ~azure.mgmt.recoveryservicessiterecovery.models.DataSyncStatus + :ivar recovery_vm_creation_option: The ALR option. Required. Known values are: + "CreateVmIfNotFound" and "NoAction". + :vartype recovery_vm_creation_option: str or + ~azure.mgmt.recoveryservicessiterecovery.models.AlternateLocationRecoveryOption + :ivar instance_type: The class type. Required. Default value is "HyperVReplicaAzureFailback". + :vartype instance_type: str + """ + + data_sync_option: Union[str, "_models.DataSyncStatus"] = rest_field( + name="dataSyncOption", visibility=["read", "create", "update", "delete", "query"] + ) + """The data sync option. Required. Known values are: \"ForDownTime\" and \"ForSynchronization\".""" + recovery_vm_creation_option: Union[str, "_models.AlternateLocationRecoveryOption"] = rest_field( + name="recoveryVmCreationOption", visibility=["read", "create", "update", "delete", "query"] + ) + """The ALR option. Required. Known values are: \"CreateVmIfNotFound\" and \"NoAction\".""" + instance_type: Literal["HyperVReplicaAzureFailback"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The class type. Required. Default value is \"HyperVReplicaAzureFailback\".""" + + @overload + def __init__( + self, + *, + data_sync_option: Union[str, "_models.DataSyncStatus"], + recovery_vm_creation_option: Union[str, "_models.AlternateLocationRecoveryOption"], + ) -> 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) + self.instance_type = "HyperVReplicaAzureFailback" # type: ignore + + +class RecoveryPlanHyperVReplicaAzureFailoverInput( + RecoveryPlanProviderSpecificFailoverInput, discriminator="HyperVReplicaAzure" +): # pylint: disable=name-too-long + """Recovery plan HVR Azure failover input. + + :ivar primary_kek_certificate_pfx: The primary KEK certificate PFX. + :vartype primary_kek_certificate_pfx: str + :ivar secondary_kek_certificate_pfx: The secondary KEK certificate PFX. + :vartype secondary_kek_certificate_pfx: str + :ivar recovery_point_type: The recovery point type. Known values are: "Latest", + "LatestApplicationConsistent", and "LatestProcessed". + :vartype recovery_point_type: str or + ~azure.mgmt.recoveryservicessiterecovery.models.HyperVReplicaAzureRpRecoveryPointType + :ivar instance_type: The class type. Required. Default value is "HyperVReplicaAzure". + :vartype instance_type: str + """ + + primary_kek_certificate_pfx: Optional[str] = rest_field( + name="primaryKekCertificatePfx", visibility=["read", "create", "update", "delete", "query"] + ) + """The primary KEK certificate PFX.""" + secondary_kek_certificate_pfx: Optional[str] = rest_field( + name="secondaryKekCertificatePfx", visibility=["read", "create", "update", "delete", "query"] + ) + """The secondary KEK certificate PFX.""" + recovery_point_type: Optional[Union[str, "_models.HyperVReplicaAzureRpRecoveryPointType"]] = rest_field( + name="recoveryPointType", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery point type. Known values are: \"Latest\", \"LatestApplicationConsistent\", and + \"LatestProcessed\".""" + instance_type: Literal["HyperVReplicaAzure"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The class type. Required. Default value is \"HyperVReplicaAzure\".""" + + @overload + def __init__( + self, + *, + primary_kek_certificate_pfx: Optional[str] = None, + secondary_kek_certificate_pfx: Optional[str] = None, + recovery_point_type: Optional[Union[str, "_models.HyperVReplicaAzureRpRecoveryPointType"]] = 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) + self.instance_type = "HyperVReplicaAzure" # type: ignore + + +class RecoveryPlanInMageAzureV2FailoverInput(RecoveryPlanProviderSpecificFailoverInput, discriminator="InMageAzureV2"): + """Recovery plan InMageAzureV2 failover input. + + :ivar recovery_point_type: The recovery point type. Required. Known values are: "Latest", + "LatestApplicationConsistent", "LatestCrashConsistent", and "LatestProcessed". + :vartype recovery_point_type: str or + ~azure.mgmt.recoveryservicessiterecovery.models.InMageV2RpRecoveryPointType + :ivar use_multi_vm_sync_point: A value indicating whether multi VM sync enabled VMs should use + multi VM sync points for failover. + :vartype use_multi_vm_sync_point: str + :ivar instance_type: The class type. Required. Default value is "InMageAzureV2". + :vartype instance_type: str + """ + + recovery_point_type: Union[str, "_models.InMageV2RpRecoveryPointType"] = rest_field( + name="recoveryPointType", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery point type. Required. Known values are: \"Latest\", + \"LatestApplicationConsistent\", \"LatestCrashConsistent\", and \"LatestProcessed\".""" + use_multi_vm_sync_point: Optional[str] = rest_field( + name="useMultiVmSyncPoint", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether multi VM sync enabled VMs should use multi VM sync points for + failover.""" + instance_type: Literal["InMageAzureV2"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The class type. Required. Default value is \"InMageAzureV2\".""" + + @overload + def __init__( + self, + *, + recovery_point_type: Union[str, "_models.InMageV2RpRecoveryPointType"], + use_multi_vm_sync_point: 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) + self.instance_type = "InMageAzureV2" # type: ignore + + +class RecoveryPlanInMageFailoverInput(RecoveryPlanProviderSpecificFailoverInput, discriminator="InMage"): + """Recovery plan InMage failover input. + + :ivar recovery_point_type: The recovery point type. Required. Known values are: "LatestTime", + "LatestTag", and "Custom". + :vartype recovery_point_type: str or + ~azure.mgmt.recoveryservicessiterecovery.models.RpInMageRecoveryPointType + :ivar instance_type: The class type. Required. Default value is "InMage". + :vartype instance_type: str + """ + + recovery_point_type: Union[str, "_models.RpInMageRecoveryPointType"] = rest_field( + name="recoveryPointType", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery point type. Required. Known values are: \"LatestTime\", \"LatestTag\", and + \"Custom\".""" + instance_type: Literal["InMage"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The class type. Required. Default value is \"InMage\".""" + + @overload + def __init__( + self, + *, + recovery_point_type: Union[str, "_models.RpInMageRecoveryPointType"], + ) -> 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) + self.instance_type = "InMage" # type: ignore + + +class RecoveryPlanInMageRcmFailbackFailoverInput( + RecoveryPlanProviderSpecificFailoverInput, discriminator="InMageRcmFailback" +): # pylint: disable=name-too-long + """Recovery plan InMageRcmFailback failover input. + + :ivar recovery_point_type: The recovery point type. Required. Known values are: + "ApplicationConsistent" and "CrashConsistent". + :vartype recovery_point_type: str or + ~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmFailbackRecoveryPointType + :ivar use_multi_vm_sync_point: A value indicating whether multi VM sync enabled VMs should use + multi VM sync points for failover. + :vartype use_multi_vm_sync_point: str + :ivar instance_type: The class type. Required. Default value is "InMageRcmFailback". + :vartype instance_type: str + """ + + recovery_point_type: Union[str, "_models.InMageRcmFailbackRecoveryPointType"] = rest_field( + name="recoveryPointType", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery point type. Required. Known values are: \"ApplicationConsistent\" and + \"CrashConsistent\".""" + use_multi_vm_sync_point: Optional[str] = rest_field( + name="useMultiVmSyncPoint", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether multi VM sync enabled VMs should use multi VM sync points for + failover.""" + instance_type: Literal["InMageRcmFailback"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The class type. Required. Default value is \"InMageRcmFailback\".""" + + @overload + def __init__( + self, + *, + recovery_point_type: Union[str, "_models.InMageRcmFailbackRecoveryPointType"], + use_multi_vm_sync_point: 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) + self.instance_type = "InMageRcmFailback" # type: ignore + + +class RecoveryPlanInMageRcmFailoverInput(RecoveryPlanProviderSpecificFailoverInput, discriminator="InMageRcm"): + """Recovery plan InMageRcm failover input. + + :ivar recovery_point_type: The recovery point type. Required. Known values are: "Latest", + "LatestApplicationConsistent", "LatestCrashConsistent", and "LatestProcessed". + :vartype recovery_point_type: str or + ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanPointType + :ivar use_multi_vm_sync_point: A value indicating whether multi VM sync enabled VMs should use + multi VM sync points for failover. + :vartype use_multi_vm_sync_point: str + :ivar instance_type: The class type. Required. Default value is "InMageRcm". + :vartype instance_type: str + """ + + recovery_point_type: Union[str, "_models.RecoveryPlanPointType"] = rest_field( + name="recoveryPointType", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery point type. Required. Known values are: \"Latest\", + \"LatestApplicationConsistent\", \"LatestCrashConsistent\", and \"LatestProcessed\".""" + use_multi_vm_sync_point: Optional[str] = rest_field( + name="useMultiVmSyncPoint", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether multi VM sync enabled VMs should use multi VM sync points for + failover.""" + instance_type: Literal["InMageRcm"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The class type. Required. Default value is \"InMageRcm\".""" + + @overload + def __init__( + self, + *, + recovery_point_type: Union[str, "_models.RecoveryPlanPointType"], + use_multi_vm_sync_point: 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) + self.instance_type = "InMageRcm" # type: ignore + + +class RecoveryPlanManualActionDetails(RecoveryPlanActionDetails, discriminator="ManualActionDetails"): + """Recovery plan manual action details. + + :ivar description: The manual action description. + :vartype description: str + :ivar instance_type: Gets the type of action details (see RecoveryPlanActionDetailsTypes enum + for possible values). Required. Default value is "ManualActionDetails". + :vartype instance_type: str + """ + + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The manual action description.""" + instance_type: Literal["ManualActionDetails"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets the type of action details (see RecoveryPlanActionDetailsTypes enum for possible values). + Required. Default value is \"ManualActionDetails\".""" + + @overload + def __init__( + self, + *, + description: 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) + self.instance_type = "ManualActionDetails" # type: ignore + + +class RecoveryPlanPlannedFailoverInput(_Model): + """Recovery plan planned failover input. + + :ivar properties: The recovery plan planned failover input properties. Required. + :vartype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanPlannedFailoverInputProperties + """ + + properties: "_models.RecoveryPlanPlannedFailoverInputProperties" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery plan planned failover input properties. Required.""" + + @overload + def __init__( + self, + *, + properties: "_models.RecoveryPlanPlannedFailoverInputProperties", + ) -> 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 RecoveryPlanPlannedFailoverInputProperties(_Model): # pylint: disable=name-too-long + """Recovery plan planned failover input properties. + + :ivar failover_direction: The failover direction. Required. Known values are: + "PrimaryToRecovery" and "RecoveryToPrimary". + :vartype failover_direction: str or + ~azure.mgmt.recoveryservicessiterecovery.models.PossibleOperationsDirections + :ivar provider_specific_details: The provider specific properties. + :vartype provider_specific_details: + list[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanProviderSpecificFailoverInput] + """ + + failover_direction: Union[str, "_models.PossibleOperationsDirections"] = rest_field( + name="failoverDirection", visibility=["read", "create", "update", "delete", "query"] + ) + """The failover direction. Required. Known values are: \"PrimaryToRecovery\" and + \"RecoveryToPrimary\".""" + provider_specific_details: Optional[list["_models.RecoveryPlanProviderSpecificFailoverInput"]] = rest_field( + name="providerSpecificDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """The provider specific properties.""" + + @overload + def __init__( + self, + *, + failover_direction: Union[str, "_models.PossibleOperationsDirections"], + provider_specific_details: Optional[list["_models.RecoveryPlanProviderSpecificFailoverInput"]] = 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 RecoveryPlanProperties(_Model): + """Recovery plan properties. + + :ivar friendly_name: The friendly name. + :vartype friendly_name: str + :ivar primary_fabric_id: The primary fabric Id. + :vartype primary_fabric_id: str + :ivar primary_fabric_friendly_name: The primary fabric friendly name. + :vartype primary_fabric_friendly_name: str + :ivar recovery_fabric_id: The recovery fabric Id. + :vartype recovery_fabric_id: str + :ivar recovery_fabric_friendly_name: The recovery fabric friendly name. + :vartype recovery_fabric_friendly_name: str + :ivar failover_deployment_model: The failover deployment model. + :vartype failover_deployment_model: str + :ivar replication_providers: The list of replication providers. + :vartype replication_providers: list[str] + :ivar allowed_operations: The list of allowed operations. + :vartype allowed_operations: list[str] + :ivar last_planned_failover_time: The start time of the last planned failover. + :vartype last_planned_failover_time: ~datetime.datetime + :ivar last_unplanned_failover_time: The start time of the last unplanned failover. + :vartype last_unplanned_failover_time: ~datetime.datetime + :ivar last_test_failover_time: The start time of the last test failover. + :vartype last_test_failover_time: ~datetime.datetime + :ivar current_scenario: The current scenario details. + :vartype current_scenario: + ~azure.mgmt.recoveryservicessiterecovery.models.CurrentScenarioDetails + :ivar current_scenario_status: The recovery plan status. + :vartype current_scenario_status: str + :ivar current_scenario_status_description: The recovery plan status description. + :vartype current_scenario_status_description: str + :ivar groups: The recovery plan groups. + :vartype groups: list[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanGroup] + :ivar provider_specific_details: The provider id and provider specific details. + :vartype provider_specific_details: + list[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanProviderSpecificDetails] + """ + + friendly_name: Optional[str] = rest_field( + name="friendlyName", visibility=["read", "create", "update", "delete", "query"] + ) + """The friendly name.""" + primary_fabric_id: Optional[str] = rest_field( + name="primaryFabricId", visibility=["read", "create", "update", "delete", "query"] + ) + """The primary fabric Id.""" + primary_fabric_friendly_name: Optional[str] = rest_field( + name="primaryFabricFriendlyName", visibility=["read", "create", "update", "delete", "query"] + ) + """The primary fabric friendly name.""" + recovery_fabric_id: Optional[str] = rest_field( + name="recoveryFabricId", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery fabric Id.""" + recovery_fabric_friendly_name: Optional[str] = rest_field( + name="recoveryFabricFriendlyName", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery fabric friendly name.""" + failover_deployment_model: Optional[str] = rest_field( + name="failoverDeploymentModel", visibility=["read", "create", "update", "delete", "query"] + ) + """The failover deployment model.""" + replication_providers: Optional[list[str]] = rest_field( + name="replicationProviders", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of replication providers.""" + allowed_operations: Optional[list[str]] = rest_field( + name="allowedOperations", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of allowed operations.""" + last_planned_failover_time: Optional[datetime.datetime] = rest_field( + name="lastPlannedFailoverTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The start time of the last planned failover.""" + last_unplanned_failover_time: Optional[datetime.datetime] = rest_field( + name="lastUnplannedFailoverTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The start time of the last unplanned failover.""" + last_test_failover_time: Optional[datetime.datetime] = rest_field( + name="lastTestFailoverTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The start time of the last test failover.""" + current_scenario: Optional["_models.CurrentScenarioDetails"] = rest_field( + name="currentScenario", visibility=["read", "create", "update", "delete", "query"] + ) + """The current scenario details.""" + current_scenario_status: Optional[str] = rest_field( + name="currentScenarioStatus", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery plan status.""" + current_scenario_status_description: Optional[str] = rest_field( + name="currentScenarioStatusDescription", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery plan status description.""" + groups: Optional[list["_models.RecoveryPlanGroup"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery plan groups.""" + provider_specific_details: Optional[list["_models.RecoveryPlanProviderSpecificDetails"]] = rest_field( + name="providerSpecificDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """The provider id and provider specific details.""" + + @overload + def __init__( + self, + *, + friendly_name: Optional[str] = None, + primary_fabric_id: Optional[str] = None, + primary_fabric_friendly_name: Optional[str] = None, + recovery_fabric_id: Optional[str] = None, + recovery_fabric_friendly_name: Optional[str] = None, + failover_deployment_model: Optional[str] = None, + replication_providers: Optional[list[str]] = None, + allowed_operations: Optional[list[str]] = None, + last_planned_failover_time: Optional[datetime.datetime] = None, + last_unplanned_failover_time: Optional[datetime.datetime] = None, + last_test_failover_time: Optional[datetime.datetime] = None, + current_scenario: Optional["_models.CurrentScenarioDetails"] = None, + current_scenario_status: Optional[str] = None, + current_scenario_status_description: Optional[str] = None, + groups: Optional[list["_models.RecoveryPlanGroup"]] = None, + provider_specific_details: Optional[list["_models.RecoveryPlanProviderSpecificDetails"]] = 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 RecoveryPlanProtectedItem(_Model): + """Recovery plan protected item. + + :ivar id: The ARM Id of the recovery plan protected item. + :vartype id: str + :ivar virtual_machine_id: The virtual machine Id. + :vartype virtual_machine_id: str + """ + + id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The ARM Id of the recovery plan protected item.""" + virtual_machine_id: Optional[str] = rest_field( + name="virtualMachineId", visibility=["read", "create", "update", "delete", "query"] + ) + """The virtual machine Id.""" + + @overload + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + virtual_machine_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 RecoveryPlanScriptActionDetails(RecoveryPlanActionDetails, discriminator="ScriptActionDetails"): + """Recovery plan script action details. + + :ivar path: The script path. Required. + :vartype path: str + :ivar timeout: The script timeout. + :vartype timeout: str + :ivar fabric_location: The fabric location. Required. Known values are: "Primary" and + "Recovery". + :vartype fabric_location: str or + ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanActionLocation + :ivar instance_type: Gets the type of action details (see RecoveryPlanActionDetailsTypes enum + for possible values). Required. Default value is "ScriptActionDetails". + :vartype instance_type: str + """ + + path: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The script path. Required.""" + timeout: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The script timeout.""" + fabric_location: Union[str, "_models.RecoveryPlanActionLocation"] = rest_field( + name="fabricLocation", visibility=["read", "create", "update", "delete", "query"] + ) + """The fabric location. Required. Known values are: \"Primary\" and \"Recovery\".""" + instance_type: Literal["ScriptActionDetails"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets the type of action details (see RecoveryPlanActionDetailsTypes enum for possible values). + Required. Default value is \"ScriptActionDetails\".""" + + @overload + def __init__( + self, + *, + path: str, + fabric_location: Union[str, "_models.RecoveryPlanActionLocation"], + timeout: 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) + self.instance_type = "ScriptActionDetails" # type: ignore + + +class RecoveryPlanShutdownGroupTaskDetails( + RecoveryPlanGroupTaskDetails, discriminator="RecoveryPlanShutdownGroupTaskDetails" +): + """This class represents the recovery plan shutdown group task details. + + :ivar child_tasks: The child tasks. + :vartype child_tasks: list[~azure.mgmt.recoveryservicessiterecovery.models.ASRTask] + :ivar name: The name. + :vartype name: str + :ivar group_id: The group identifier. + :vartype group_id: str + :ivar rp_group_type: The group type. + :vartype rp_group_type: str + :ivar instance_type: The type of task details. Required. Default value is + "RecoveryPlanShutdownGroupTaskDetails". + :vartype instance_type: str + """ + + instance_type: Literal["RecoveryPlanShutdownGroupTaskDetails"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The type of task details. Required. Default value is \"RecoveryPlanShutdownGroupTaskDetails\".""" + + @overload + def __init__( + self, + *, + child_tasks: Optional[list["_models.ASRTask"]] = None, + name: Optional[str] = None, + group_id: Optional[str] = None, + rp_group_type: 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) + self.instance_type = "RecoveryPlanShutdownGroupTaskDetails" # type: ignore + + +class RecoveryPlanTestFailoverCleanupInput(_Model): + """Recovery plan test failover cleanup input. + + :ivar properties: The recovery plan test failover cleanup input properties. Required. + :vartype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanTestFailoverCleanupInputProperties + """ + + properties: "_models.RecoveryPlanTestFailoverCleanupInputProperties" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery plan test failover cleanup input properties. Required.""" + + @overload + def __init__( + self, + *, + properties: "_models.RecoveryPlanTestFailoverCleanupInputProperties", + ) -> 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 RecoveryPlanTestFailoverCleanupInputProperties(_Model): # pylint: disable=name-too-long + """Recovery plan test failover cleanup input properties. + + :ivar comments: The test failover cleanup comments. + :vartype comments: str + """ + + comments: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The test failover cleanup comments.""" + + @overload + def __init__( + self, + *, + comments: 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 RecoveryPlanTestFailoverInput(_Model): + """Recovery plan test failover input. + + :ivar properties: The recovery plan test failover input properties. Required. + :vartype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanTestFailoverInputProperties + """ + + properties: "_models.RecoveryPlanTestFailoverInputProperties" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery plan test failover input properties. Required.""" + + @overload + def __init__( + self, + *, + properties: "_models.RecoveryPlanTestFailoverInputProperties", + ) -> 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 RecoveryPlanTestFailoverInputProperties(_Model): + """Recovery plan test failover input properties. + + :ivar failover_direction: The failover direction. Required. Known values are: + "PrimaryToRecovery" and "RecoveryToPrimary". + :vartype failover_direction: str or + ~azure.mgmt.recoveryservicessiterecovery.models.PossibleOperationsDirections + :ivar network_type: The network type to be used for test failover. Required. + :vartype network_type: str + :ivar network_id: The Id of the network to be used for test failover. + :vartype network_id: str + :ivar provider_specific_details: The provider specific properties. + :vartype provider_specific_details: + list[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanProviderSpecificFailoverInput] + """ + + failover_direction: Union[str, "_models.PossibleOperationsDirections"] = rest_field( + name="failoverDirection", visibility=["read", "create", "update", "delete", "query"] + ) + """The failover direction. Required. Known values are: \"PrimaryToRecovery\" and + \"RecoveryToPrimary\".""" + network_type: str = rest_field(name="networkType", visibility=["read", "create", "update", "delete", "query"]) + """The network type to be used for test failover. Required.""" + network_id: Optional[str] = rest_field(name="networkId", visibility=["read", "create", "update", "delete", "query"]) + """The Id of the network to be used for test failover.""" + provider_specific_details: Optional[list["_models.RecoveryPlanProviderSpecificFailoverInput"]] = rest_field( + name="providerSpecificDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """The provider specific properties.""" + + @overload + def __init__( + self, + *, + failover_direction: Union[str, "_models.PossibleOperationsDirections"], + network_type: str, + network_id: Optional[str] = None, + provider_specific_details: Optional[list["_models.RecoveryPlanProviderSpecificFailoverInput"]] = 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 RecoveryPlanUnplannedFailoverInput(_Model): + """Recovery plan unplanned failover input. + + :ivar properties: The recovery plan unplanned failover input properties. Required. + :vartype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanUnplannedFailoverInputProperties + """ + + properties: "_models.RecoveryPlanUnplannedFailoverInputProperties" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery plan unplanned failover input properties. Required.""" + + @overload + def __init__( + self, + *, + properties: "_models.RecoveryPlanUnplannedFailoverInputProperties", + ) -> 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 RecoveryPlanUnplannedFailoverInputProperties(_Model): # pylint: disable=name-too-long + """Recovery plan unplanned failover input properties. + + :ivar failover_direction: The failover direction. Required. Known values are: + "PrimaryToRecovery" and "RecoveryToPrimary". + :vartype failover_direction: str or + ~azure.mgmt.recoveryservicessiterecovery.models.PossibleOperationsDirections + :ivar source_site_operations: A value indicating whether source site operations are required. + Required. Known values are: "Required" and "NotRequired". + :vartype source_site_operations: str or + ~azure.mgmt.recoveryservicessiterecovery.models.SourceSiteOperations + :ivar provider_specific_details: The provider specific properties. + :vartype provider_specific_details: + list[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanProviderSpecificFailoverInput] + """ + + failover_direction: Union[str, "_models.PossibleOperationsDirections"] = rest_field( + name="failoverDirection", visibility=["read", "create", "update", "delete", "query"] + ) + """The failover direction. Required. Known values are: \"PrimaryToRecovery\" and + \"RecoveryToPrimary\".""" + source_site_operations: Union[str, "_models.SourceSiteOperations"] = rest_field( + name="sourceSiteOperations", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether source site operations are required. Required. Known values are: + \"Required\" and \"NotRequired\".""" + provider_specific_details: Optional[list["_models.RecoveryPlanProviderSpecificFailoverInput"]] = rest_field( + name="providerSpecificDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """The provider specific properties.""" + + @overload + def __init__( + self, + *, + failover_direction: Union[str, "_models.PossibleOperationsDirections"], + source_site_operations: Union[str, "_models.SourceSiteOperations"], + provider_specific_details: Optional[list["_models.RecoveryPlanProviderSpecificFailoverInput"]] = 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 RecoveryPoint(ProxyResource): + """Recovery point. + + :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.recoveryservicessiterecovery.models.SystemData + :ivar properties: The recovery point properties. + :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPointProperties + :ivar location: Resource Location. + :vartype location: str + """ + + properties: Optional["_models.RecoveryPointProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery point properties.""" + location: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource Location.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.RecoveryPointProperties"] = None, + location: 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 RecoveryPointProperties(_Model): + """Recovery point properties. + + :ivar recovery_point_time: The recovery point time. + :vartype recovery_point_time: ~datetime.datetime + :ivar recovery_point_type: The recovery point type: ApplicationConsistent, CrashConsistent. + :vartype recovery_point_type: str + :ivar provider_specific_details: The provider specific details for the recovery point. + :vartype provider_specific_details: + ~azure.mgmt.recoveryservicessiterecovery.models.ProviderSpecificRecoveryPointDetails + """ + + recovery_point_time: Optional[datetime.datetime] = rest_field( + name="recoveryPointTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The recovery point time.""" + recovery_point_type: Optional[str] = rest_field( + name="recoveryPointType", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery point type: ApplicationConsistent, CrashConsistent.""" + provider_specific_details: Optional["_models.ProviderSpecificRecoveryPointDetails"] = rest_field( + name="providerSpecificDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """The provider specific details for the recovery point.""" + + @overload + def __init__( + self, + *, + recovery_point_time: Optional[datetime.datetime] = None, + recovery_point_type: Optional[str] = None, + provider_specific_details: Optional["_models.ProviderSpecificRecoveryPointDetails"] = 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 RecoveryServicesProvider(ProxyResource): + """Provider details. + + :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.recoveryservicessiterecovery.models.SystemData + :ivar properties: Provider properties. + :vartype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryServicesProviderProperties + :ivar location: Resource Location. + :vartype location: str + """ + + properties: Optional["_models.RecoveryServicesProviderProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Provider properties.""" + location: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource Location.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.RecoveryServicesProviderProperties"] = None, + location: 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 RecoveryServicesProviderProperties(_Model): + """Recovery services provider properties. + + :ivar fabric_type: Type of the site. + :vartype fabric_type: str + :ivar friendly_name: Friendly name of the DRA. + :vartype friendly_name: str + :ivar provider_version: The provider version. + :vartype provider_version: str + :ivar server_version: The fabric provider. + :vartype server_version: str + :ivar provider_version_state: DRA version status. + :vartype provider_version_state: str + :ivar provider_version_expiry_date: Expiry date of the version. + :vartype provider_version_expiry_date: ~datetime.datetime + :ivar fabric_friendly_name: The fabric friendly name. + :vartype fabric_friendly_name: str + :ivar last_heart_beat: Time when last heartbeat was sent by the DRA. + :vartype last_heart_beat: ~datetime.datetime + :ivar connection_status: A value indicating whether DRA is responsive. + :vartype connection_status: str + :ivar protected_item_count: Number of protected VMs currently managed by the DRA. + :vartype protected_item_count: int + :ivar allowed_scenarios: The scenarios allowed on this provider. + :vartype allowed_scenarios: list[str] + :ivar health_error_details: The recovery services provider health error details. + :vartype health_error_details: + list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] + :ivar dra_identifier: The DRA Id. + :vartype dra_identifier: str + :ivar machine_id: The machine Id. + :vartype machine_id: str + :ivar machine_name: The machine name. + :vartype machine_name: str + :ivar bios_id: The Bios Id. + :vartype bios_id: str + :ivar authentication_identity_details: The authentication identity details. + :vartype authentication_identity_details: + ~azure.mgmt.recoveryservicessiterecovery.models.IdentityProviderDetails + :ivar resource_access_identity_details: The resource access identity details. + :vartype resource_access_identity_details: + ~azure.mgmt.recoveryservicessiterecovery.models.IdentityProviderDetails + :ivar data_plane_authentication_identity_details: The data plane authentication identity + details. + :vartype data_plane_authentication_identity_details: + ~azure.mgmt.recoveryservicessiterecovery.models.IdentityProviderDetails + :ivar provider_version_details: The provider version details. + :vartype provider_version_details: + ~azure.mgmt.recoveryservicessiterecovery.models.VersionDetails + """ + + fabric_type: Optional[str] = rest_field( + name="fabricType", visibility=["read", "create", "update", "delete", "query"] + ) + """Type of the site.""" + friendly_name: Optional[str] = rest_field( + name="friendlyName", visibility=["read", "create", "update", "delete", "query"] + ) + """Friendly name of the DRA.""" + provider_version: Optional[str] = rest_field( + name="providerVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """The provider version.""" + server_version: Optional[str] = rest_field( + name="serverVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """The fabric provider.""" + provider_version_state: Optional[str] = rest_field( + name="providerVersionState", visibility=["read", "create", "update", "delete", "query"] + ) + """DRA version status.""" + provider_version_expiry_date: Optional[datetime.datetime] = rest_field( + name="providerVersionExpiryDate", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """Expiry date of the version.""" + fabric_friendly_name: Optional[str] = rest_field( + name="fabricFriendlyName", visibility=["read", "create", "update", "delete", "query"] + ) + """The fabric friendly name.""" + last_heart_beat: Optional[datetime.datetime] = rest_field( + name="lastHeartBeat", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """Time when last heartbeat was sent by the DRA.""" + connection_status: Optional[str] = rest_field( + name="connectionStatus", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether DRA is responsive.""" + protected_item_count: Optional[int] = rest_field( + name="protectedItemCount", visibility=["read", "create", "update", "delete", "query"] + ) + """Number of protected VMs currently managed by the DRA.""" + allowed_scenarios: Optional[list[str]] = rest_field( + name="allowedScenarios", visibility=["read", "create", "update", "delete", "query"] + ) + """The scenarios allowed on this provider.""" + health_error_details: Optional[list["_models.HealthError"]] = rest_field( + name="healthErrorDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery services provider health error details.""" + dra_identifier: Optional[str] = rest_field( + name="draIdentifier", visibility=["read", "create", "update", "delete", "query"] + ) + """The DRA Id.""" + machine_id: Optional[str] = rest_field(name="machineId", visibility=["read", "create", "update", "delete", "query"]) + """The machine Id.""" + machine_name: Optional[str] = rest_field( + name="machineName", visibility=["read", "create", "update", "delete", "query"] + ) + """The machine name.""" + bios_id: Optional[str] = rest_field(name="biosId", visibility=["read", "create", "update", "delete", "query"]) + """The Bios Id.""" + authentication_identity_details: Optional["_models.IdentityProviderDetails"] = rest_field( + name="authenticationIdentityDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """The authentication identity details.""" + resource_access_identity_details: Optional["_models.IdentityProviderDetails"] = rest_field( + name="resourceAccessIdentityDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """The resource access identity details.""" + data_plane_authentication_identity_details: Optional["_models.IdentityProviderDetails"] = rest_field( + name="dataPlaneAuthenticationIdentityDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """The data plane authentication identity details.""" + provider_version_details: Optional["_models.VersionDetails"] = rest_field( + name="providerVersionDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """The provider version details.""" + + @overload + def __init__( + self, + *, + fabric_type: Optional[str] = None, + friendly_name: Optional[str] = None, + provider_version: Optional[str] = None, + server_version: Optional[str] = None, + provider_version_state: Optional[str] = None, + provider_version_expiry_date: Optional[datetime.datetime] = None, + fabric_friendly_name: Optional[str] = None, + last_heart_beat: Optional[datetime.datetime] = None, + connection_status: Optional[str] = None, + protected_item_count: Optional[int] = None, + allowed_scenarios: Optional[list[str]] = None, + health_error_details: Optional[list["_models.HealthError"]] = None, + dra_identifier: Optional[str] = None, + machine_id: Optional[str] = None, + machine_name: Optional[str] = None, + bios_id: Optional[str] = None, + authentication_identity_details: Optional["_models.IdentityProviderDetails"] = None, + resource_access_identity_details: Optional["_models.IdentityProviderDetails"] = None, + data_plane_authentication_identity_details: Optional["_models.IdentityProviderDetails"] = None, + provider_version_details: Optional["_models.VersionDetails"] = 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 RegisteredClusterNodes(_Model): + """Extended location of the resource. + + :ivar cluster_node_fqdn: The cluster node name. + :vartype cluster_node_fqdn: str + :ivar machine_id: The machine ID. + :vartype machine_id: str + :ivar bios_id: The BIOS ID. + :vartype bios_id: str + :ivar is_shared_disk_virtual_node: A value indicating whether this represents virtual entity + hosting all the shared disks. + :vartype is_shared_disk_virtual_node: bool + """ + + cluster_node_fqdn: Optional[str] = rest_field( + name="clusterNodeFqdn", visibility=["read", "create", "update", "delete", "query"] + ) + """The cluster node name.""" + machine_id: Optional[str] = rest_field(name="machineId", visibility=["read", "create", "update", "delete", "query"]) + """The machine ID.""" + bios_id: Optional[str] = rest_field(name="biosId", visibility=["read", "create", "update", "delete", "query"]) + """The BIOS ID.""" + is_shared_disk_virtual_node: Optional[bool] = rest_field( + name="isSharedDiskVirtualNode", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether this represents virtual entity hosting all the shared disks.""" + + @overload + def __init__( + self, + *, + cluster_node_fqdn: Optional[str] = None, + machine_id: Optional[str] = None, + bios_id: Optional[str] = None, + is_shared_disk_virtual_node: 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 ReinstallMobilityServiceRequest(_Model): + """Request to Reinstall the mobility service on a protected item. + + :ivar properties: The properties of the reinstall mobility service request. + :vartype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.ReinstallMobilityServiceRequestProperties + """ + + properties: Optional["_models.ReinstallMobilityServiceRequestProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The properties of the reinstall mobility service request.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.ReinstallMobilityServiceRequestProperties"] = 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 ReinstallMobilityServiceRequestProperties(_Model): # pylint: disable=name-too-long + """The properties of an update mobility service request. + + :ivar run_as_account_id: The CS run as account Id. + :vartype run_as_account_id: str + """ + + run_as_account_id: Optional[str] = rest_field( + name="runAsAccountId", visibility=["read", "create", "update", "delete", "query"] + ) + """The CS run as account Id.""" + + @overload + def __init__( + self, + *, + run_as_account_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 RemoveDisksInput(_Model): + """Input for remove disk(s) operation. + + :ivar properties: Remove disk input properties. + :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.RemoveDisksInputProperties + """ + + properties: Optional["_models.RemoveDisksInputProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Remove disk input properties.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.RemoveDisksInputProperties"] = 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 RemoveDisksInputProperties(_Model): + """Remove Disk input properties. + + :ivar provider_specific_details: The ReplicationProviderInput. For HyperVReplicaAzure provider, + it will be AzureEnableProtectionInput object. For San provider, it will be + SanEnableProtectionInput object. For HyperVReplicaAzure provider, it can be null. + :vartype provider_specific_details: + ~azure.mgmt.recoveryservicessiterecovery.models.RemoveDisksProviderSpecificInput + """ + + provider_specific_details: Optional["_models.RemoveDisksProviderSpecificInput"] = rest_field( + name="providerSpecificDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """The ReplicationProviderInput. For HyperVReplicaAzure provider, it will be + AzureEnableProtectionInput object. For San provider, it will be SanEnableProtectionInput + object. For HyperVReplicaAzure provider, it can be null.""" + + @overload + def __init__( + self, + *, + provider_specific_details: Optional["_models.RemoveDisksProviderSpecificInput"] = 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 RemoveProtectionContainerMappingInput(_Model): + """Container unpairing input. + + :ivar properties: Configure protection input properties. + :vartype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.RemoveProtectionContainerMappingInputProperties + """ + + properties: Optional["_models.RemoveProtectionContainerMappingInputProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Configure protection input properties.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.RemoveProtectionContainerMappingInputProperties"] = 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 RemoveProtectionContainerMappingInputProperties(_Model): # pylint: disable=name-too-long + """Unpairing input properties. + + :ivar provider_specific_input: Provider specific input for unpairing. + :vartype provider_specific_input: + ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProviderContainerUnmappingInput + """ + + provider_specific_input: Optional["_models.ReplicationProviderContainerUnmappingInput"] = rest_field( + name="providerSpecificInput", visibility=["read", "create", "update", "delete", "query"] + ) + """Provider specific input for unpairing.""" + + @overload + def __init__( + self, + *, + provider_specific_input: Optional["_models.ReplicationProviderContainerUnmappingInput"] = 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 RenewCertificateInput(_Model): + """Certificate renewal input. + + :ivar properties: Renew certificate input properties. + :vartype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.RenewCertificateInputProperties + """ + + properties: Optional["_models.RenewCertificateInputProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Renew certificate input properties.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.RenewCertificateInputProperties"] = 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 RenewCertificateInputProperties(_Model): + """Renew Certificate input properties. + + :ivar renew_certificate_type: Renew certificate type. + :vartype renew_certificate_type: str + """ + + renew_certificate_type: Optional[str] = rest_field( + name="renewCertificateType", visibility=["read", "create", "update", "delete", "query"] + ) + """Renew certificate type.""" + + @overload + def __init__( + self, + *, + renew_certificate_type: 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 ReplicationAgentDetails(_Model): + """Replication agent details. + + :ivar id: The replication agent Id. + :vartype id: str + :ivar name: The replication agent name. + :vartype name: str + :ivar bios_id: The replication agent Bios Id. + :vartype bios_id: str + :ivar fabric_object_id: The fabric object Id. + :vartype fabric_object_id: str + :ivar fqdn: The replication agent Fqdn. + :vartype fqdn: str + :ivar version: The version. + :vartype version: str + :ivar last_heartbeat_utc: The last heartbeat received from the replication agent. + :vartype last_heartbeat_utc: ~datetime.datetime + :ivar health: The health of the replication agent. Known values are: "None", "Normal", + "Warning", and "Critical". + :vartype health: str or ~azure.mgmt.recoveryservicessiterecovery.models.ProtectionHealth + :ivar health_errors: The health errors. + :vartype health_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] + """ + + id: Optional[str] = rest_field(visibility=["read"]) + """The replication agent Id.""" + name: Optional[str] = rest_field(visibility=["read"]) + """The replication agent name.""" + bios_id: Optional[str] = rest_field(name="biosId", visibility=["read"]) + """The replication agent Bios Id.""" + fabric_object_id: Optional[str] = rest_field(name="fabricObjectId", visibility=["read"]) + """The fabric object Id.""" + fqdn: Optional[str] = rest_field(visibility=["read"]) + """The replication agent Fqdn.""" + version: Optional[str] = rest_field(visibility=["read"]) + """The version.""" + last_heartbeat_utc: Optional[datetime.datetime] = rest_field( + name="lastHeartbeatUtc", visibility=["read"], format="rfc3339" + ) + """The last heartbeat received from the replication agent.""" + health: Optional[Union[str, "_models.ProtectionHealth"]] = rest_field(visibility=["read"]) + """The health of the replication agent. Known values are: \"None\", \"Normal\", \"Warning\", and + \"Critical\".""" + health_errors: Optional[list["_models.HealthError"]] = rest_field(name="healthErrors", visibility=["read"]) + """The health errors.""" + + +class ReplicationAppliance(_Model): + """Replication appliance definition. + + :ivar properties: Appliance related data. + :vartype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationApplianceProperties + """ + + properties: Optional["_models.ReplicationApplianceProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Appliance related data.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.ReplicationApplianceProperties"] = 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 ReplicationApplianceProperties(_Model): + """Replication appliance properties. + + :ivar provider_specific_details: Provider specific settings. + :vartype provider_specific_details: + ~azure.mgmt.recoveryservicessiterecovery.models.ApplianceSpecificDetails + """ + + provider_specific_details: Optional["_models.ApplianceSpecificDetails"] = rest_field( + name="providerSpecificDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """Provider specific settings.""" + + @overload + def __init__( + self, + *, + provider_specific_details: Optional["_models.ApplianceSpecificDetails"] = 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 ReplicationEligibilityResults(ProxyResource): + """Replication eligibility results response model. + + :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.recoveryservicessiterecovery.models.SystemData + :ivar properties: Gets properties model for replication eligibility results API. + :vartype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationEligibilityResultsProperties + """ + + properties: Optional["_models.ReplicationEligibilityResultsProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Gets properties model for replication eligibility results API.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.ReplicationEligibilityResultsProperties"] = 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 ReplicationEligibilityResultsCollection(_Model): + """Replication eligibility results collection response model. + + :ivar value: The replication eligibility results details. + :vartype value: + list[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationEligibilityResults] + """ + + value: Optional[list["_models.ReplicationEligibilityResults"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The replication eligibility results details.""" + + @overload + def __init__( + self, + *, + value: Optional[list["_models.ReplicationEligibilityResults"]] = 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 ReplicationEligibilityResultsErrorInfo(_Model): + """Error model that can be exposed to the user. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar possible_causes: The possible causes. + :vartype possible_causes: str + :ivar recommended_action: The recommended action. + :vartype recommended_action: str + :ivar status: The error status. + :vartype status: str + """ + + code: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The error code.""" + message: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The error message.""" + possible_causes: Optional[str] = rest_field( + name="possibleCauses", visibility=["read", "create", "update", "delete", "query"] + ) + """The possible causes.""" + recommended_action: Optional[str] = rest_field( + name="recommendedAction", visibility=["read", "create", "update", "delete", "query"] + ) + """The recommended action.""" + status: Optional[str] = rest_field(visibility=["read"]) + """The error status.""" + + @overload + def __init__( + self, + *, + code: Optional[str] = None, + message: Optional[str] = None, + possible_causes: Optional[str] = None, + recommended_action: 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 ReplicationEligibilityResultsProperties(_Model): + """Properties model for replication eligibility results API. + + :ivar client_request_id: The client request Id. + :vartype client_request_id: str + :ivar errors: The error details. + :vartype errors: + list[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationEligibilityResultsErrorInfo] + """ + + client_request_id: Optional[str] = rest_field(name="clientRequestId", visibility=["read"]) + """The client request Id.""" + errors: Optional[list["_models.ReplicationEligibilityResultsErrorInfo"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The error details.""" + + @overload + def __init__( + self, + *, + errors: Optional[list["_models.ReplicationEligibilityResultsErrorInfo"]] = 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 ReplicationGroupDetails(ConfigurationSettings, discriminator="ReplicationGroupDetails"): + """Replication group details. This will be used in case of San. + + :ivar instance_type: Gets the class type. Overridden in derived classes. Required. Default + value is "ReplicationGroupDetails". + :vartype instance_type: str + """ + + instance_type: Literal["ReplicationGroupDetails"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets the class type. Overridden in derived classes. Required. Default value is + \"ReplicationGroupDetails\".""" + + @overload + def __init__( + self, + ) -> 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) + self.instance_type = "ReplicationGroupDetails" # type: ignore + + +class ReplicationProtectedItem(ProxyResource): + """Replication protected item. + + :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.recoveryservicessiterecovery.models.SystemData + :ivar properties: The custom data. + :vartype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItemProperties + :ivar location: Resource Location. + :vartype location: str + """ + + properties: Optional["_models.ReplicationProtectedItemProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The custom data.""" + location: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource Location.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.ReplicationProtectedItemProperties"] = None, + location: 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 ReplicationProtectedItemProperties(_Model): + """Replication protected item custom data details. + + :ivar friendly_name: The name. + :vartype friendly_name: str + :ivar protected_item_type: The type of protected item type. + :vartype protected_item_type: str + :ivar protectable_item_id: The protected item ARM Id. + :vartype protectable_item_id: str + :ivar recovery_services_provider_id: The recovery provider ARM Id. + :vartype recovery_services_provider_id: str + :ivar primary_fabric_friendly_name: The friendly name of the primary fabric. + :vartype primary_fabric_friendly_name: str + :ivar primary_fabric_provider: The fabric provider of the primary fabric. + :vartype primary_fabric_provider: str + :ivar recovery_fabric_friendly_name: The friendly name of recovery fabric. + :vartype recovery_fabric_friendly_name: str + :ivar recovery_fabric_id: The Arm Id of recovery fabric. + :vartype recovery_fabric_id: str + :ivar primary_protection_container_friendly_name: The name of primary protection container + friendly name. + :vartype primary_protection_container_friendly_name: str + :ivar recovery_protection_container_friendly_name: The name of recovery container friendly + name. + :vartype recovery_protection_container_friendly_name: str + :ivar protection_state: The protection status. + :vartype protection_state: str + :ivar protection_state_description: The protection state description. + :vartype protection_state_description: str + :ivar active_location: The Current active location of the PE. + :vartype active_location: str + :ivar test_failover_state: The Test failover state. + :vartype test_failover_state: str + :ivar test_failover_state_description: The Test failover state description. + :vartype test_failover_state_description: str + :ivar switch_provider_state: The switch provider state. + :vartype switch_provider_state: str + :ivar switch_provider_state_description: The switch provider state description. + :vartype switch_provider_state_description: str + :ivar allowed_operations: The allowed operations on the Replication protected item. + :vartype allowed_operations: list[str] + :ivar replication_health: The consolidated protection health for the VM taking any issues with + SRS as well as all the replication units associated with the VM's replication group into + account. This is a string representation of the ProtectionHealth enumeration. + :vartype replication_health: str + :ivar failover_health: The consolidated failover health for the VM. + :vartype failover_health: str + :ivar health_errors: List of health errors. + :vartype health_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] + :ivar policy_id: The ID of Policy governing this PE. + :vartype policy_id: str + :ivar policy_friendly_name: The name of Policy governing this PE. + :vartype policy_friendly_name: str + :ivar last_successful_failover_time: The Last successful failover time. + :vartype last_successful_failover_time: ~datetime.datetime + :ivar last_successful_test_failover_time: The Last successful test failover time. + :vartype last_successful_test_failover_time: ~datetime.datetime + :ivar current_scenario: The current scenario. + :vartype current_scenario: + ~azure.mgmt.recoveryservicessiterecovery.models.CurrentScenarioDetails + :ivar failover_recovery_point_id: The recovery point ARM Id to which the Vm was failed over. + :vartype failover_recovery_point_id: str + :ivar provider_specific_details: The Replication provider custom settings. + :vartype provider_specific_details: + ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProviderSpecificSettings + :ivar recovery_container_id: The recovery container Id. + :vartype recovery_container_id: str + :ivar event_correlation_id: The correlation Id for events associated with this protected item. + :vartype event_correlation_id: str + """ + + friendly_name: Optional[str] = rest_field( + name="friendlyName", visibility=["read", "create", "update", "delete", "query"] + ) + """The name.""" + protected_item_type: Optional[str] = rest_field( + name="protectedItemType", visibility=["read", "create", "update", "delete", "query"] + ) + """The type of protected item type.""" + protectable_item_id: Optional[str] = rest_field( + name="protectableItemId", visibility=["read", "create", "update", "delete", "query"] + ) + """The protected item ARM Id.""" + recovery_services_provider_id: Optional[str] = rest_field( + name="recoveryServicesProviderId", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery provider ARM Id.""" + primary_fabric_friendly_name: Optional[str] = rest_field( + name="primaryFabricFriendlyName", visibility=["read", "create", "update", "delete", "query"] + ) + """The friendly name of the primary fabric.""" + primary_fabric_provider: Optional[str] = rest_field( + name="primaryFabricProvider", visibility=["read", "create", "update", "delete", "query"] + ) + """The fabric provider of the primary fabric.""" + recovery_fabric_friendly_name: Optional[str] = rest_field( + name="recoveryFabricFriendlyName", visibility=["read", "create", "update", "delete", "query"] + ) + """The friendly name of recovery fabric.""" + recovery_fabric_id: Optional[str] = rest_field( + name="recoveryFabricId", visibility=["read", "create", "update", "delete", "query"] + ) + """The Arm Id of recovery fabric.""" + primary_protection_container_friendly_name: Optional[str] = rest_field( + name="primaryProtectionContainerFriendlyName", visibility=["read", "create", "update", "delete", "query"] + ) + """The name of primary protection container friendly name.""" + recovery_protection_container_friendly_name: Optional[str] = rest_field( + name="recoveryProtectionContainerFriendlyName", visibility=["read", "create", "update", "delete", "query"] + ) + """The name of recovery container friendly name.""" + protection_state: Optional[str] = rest_field( + name="protectionState", visibility=["read", "create", "update", "delete", "query"] + ) + """The protection status.""" + protection_state_description: Optional[str] = rest_field( + name="protectionStateDescription", visibility=["read", "create", "update", "delete", "query"] + ) + """The protection state description.""" + active_location: Optional[str] = rest_field( + name="activeLocation", visibility=["read", "create", "update", "delete", "query"] + ) + """The Current active location of the PE.""" + test_failover_state: Optional[str] = rest_field( + name="testFailoverState", visibility=["read", "create", "update", "delete", "query"] + ) + """The Test failover state.""" + test_failover_state_description: Optional[str] = rest_field( + name="testFailoverStateDescription", visibility=["read", "create", "update", "delete", "query"] + ) + """The Test failover state description.""" + switch_provider_state: Optional[str] = rest_field( + name="switchProviderState", visibility=["read", "create", "update", "delete", "query"] + ) + """The switch provider state.""" + switch_provider_state_description: Optional[str] = rest_field( + name="switchProviderStateDescription", visibility=["read", "create", "update", "delete", "query"] + ) + """The switch provider state description.""" + allowed_operations: Optional[list[str]] = rest_field( + name="allowedOperations", visibility=["read", "create", "update", "delete", "query"] + ) + """The allowed operations on the Replication protected item.""" + replication_health: Optional[str] = rest_field( + name="replicationHealth", visibility=["read", "create", "update", "delete", "query"] + ) + """The consolidated protection health for the VM taking any issues with SRS as well as all the + replication units associated with the VM's replication group into account. This is a string + representation of the ProtectionHealth enumeration.""" + failover_health: Optional[str] = rest_field( + name="failoverHealth", visibility=["read", "create", "update", "delete", "query"] + ) + """The consolidated failover health for the VM.""" + health_errors: Optional[list["_models.HealthError"]] = rest_field( + name="healthErrors", visibility=["read", "create", "update", "delete", "query"] + ) + """List of health errors.""" + policy_id: Optional[str] = rest_field(name="policyId", visibility=["read", "create", "update", "delete", "query"]) + """The ID of Policy governing this PE.""" + policy_friendly_name: Optional[str] = rest_field( + name="policyFriendlyName", visibility=["read", "create", "update", "delete", "query"] + ) + """The name of Policy governing this PE.""" + last_successful_failover_time: Optional[datetime.datetime] = rest_field( + name="lastSuccessfulFailoverTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The Last successful failover time.""" + last_successful_test_failover_time: Optional[datetime.datetime] = rest_field( + name="lastSuccessfulTestFailoverTime", + visibility=["read", "create", "update", "delete", "query"], + format="rfc3339", + ) + """The Last successful test failover time.""" + current_scenario: Optional["_models.CurrentScenarioDetails"] = rest_field( + name="currentScenario", visibility=["read", "create", "update", "delete", "query"] + ) + """The current scenario.""" + failover_recovery_point_id: Optional[str] = rest_field( + name="failoverRecoveryPointId", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery point ARM Id to which the Vm was failed over.""" + provider_specific_details: Optional["_models.ReplicationProviderSpecificSettings"] = rest_field( + name="providerSpecificDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """The Replication provider custom settings.""" + recovery_container_id: Optional[str] = rest_field( + name="recoveryContainerId", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery container Id.""" + event_correlation_id: Optional[str] = rest_field( + name="eventCorrelationId", visibility=["read", "create", "update", "delete", "query"] + ) + """The correlation Id for events associated with this protected item.""" + + @overload + def __init__( # pylint: disable=too-many-locals + self, + *, + friendly_name: Optional[str] = None, + protected_item_type: Optional[str] = None, + protectable_item_id: Optional[str] = None, + recovery_services_provider_id: Optional[str] = None, + primary_fabric_friendly_name: Optional[str] = None, + primary_fabric_provider: Optional[str] = None, + recovery_fabric_friendly_name: Optional[str] = None, + recovery_fabric_id: Optional[str] = None, + primary_protection_container_friendly_name: Optional[str] = None, + recovery_protection_container_friendly_name: Optional[str] = None, + protection_state: Optional[str] = None, + protection_state_description: Optional[str] = None, + active_location: Optional[str] = None, + test_failover_state: Optional[str] = None, + test_failover_state_description: Optional[str] = None, + switch_provider_state: Optional[str] = None, + switch_provider_state_description: Optional[str] = None, + allowed_operations: Optional[list[str]] = None, + replication_health: Optional[str] = None, + failover_health: Optional[str] = None, + health_errors: Optional[list["_models.HealthError"]] = None, + policy_id: Optional[str] = None, + policy_friendly_name: Optional[str] = None, + last_successful_failover_time: Optional[datetime.datetime] = None, + last_successful_test_failover_time: Optional[datetime.datetime] = None, + current_scenario: Optional["_models.CurrentScenarioDetails"] = None, + failover_recovery_point_id: Optional[str] = None, + provider_specific_details: Optional["_models.ReplicationProviderSpecificSettings"] = None, + recovery_container_id: Optional[str] = None, + event_correlation_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 ReplicationProtectionCluster(ProxyResource): + """Replication protection Cluster. + + :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.recoveryservicessiterecovery.models.SystemData + :ivar properties: The custom data. + :vartype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionClusterProperties + """ + + properties: Optional["_models.ReplicationProtectionClusterProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The custom data.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.ReplicationProtectionClusterProperties"] = 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 ReplicationProtectionClusterProperties(_Model): + """Replication protection cluster custom data details. + + :ivar protection_cluster_type: The type of protection cluster type. + :vartype protection_cluster_type: str + :ivar primary_fabric_friendly_name: The friendly name of the primary fabric. + :vartype primary_fabric_friendly_name: str + :ivar primary_fabric_provider: The fabric provider of the primary fabric. + :vartype primary_fabric_provider: str + :ivar recovery_fabric_friendly_name: The friendly name of recovery fabric. + :vartype recovery_fabric_friendly_name: str + :ivar recovery_fabric_id: The Arm Id of recovery fabric. + :vartype recovery_fabric_id: str + :ivar primary_protection_container_friendly_name: The name of primary protection container + friendly name. + :vartype primary_protection_container_friendly_name: str + :ivar recovery_protection_container_friendly_name: The name of recovery container friendly + name. + :vartype recovery_protection_container_friendly_name: str + :ivar protection_state: The protection status. + :vartype protection_state: str + :ivar protection_state_description: The protection state description. + :vartype protection_state_description: str + :ivar active_location: The Current active location of the Protection cluster. + :vartype active_location: str + :ivar test_failover_state: The Test failover state. + :vartype test_failover_state: str + :ivar test_failover_state_description: The Test failover state description. + :vartype test_failover_state_description: str + :ivar allowed_operations: The allowed operations on the Replication protection cluster. + :vartype allowed_operations: list[str] + :ivar replication_health: The consolidated protection health for the VM taking any issues with + SRS as well as all the replication units associated with the VM's replication group into + account. This is a string representation of the ProtectionHealth enumeration. + :vartype replication_health: str + :ivar health_errors: List of health errors. + :vartype health_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] + :ivar last_successful_failover_time: The last successful failover time. + :vartype last_successful_failover_time: ~datetime.datetime + :ivar last_successful_test_failover_time: The last successful test failover time. + :vartype last_successful_test_failover_time: ~datetime.datetime + :ivar policy_friendly_name: The name of Policy governing this PE. + :vartype policy_friendly_name: str + :ivar current_scenario: The current scenario. + :vartype current_scenario: + ~azure.mgmt.recoveryservicessiterecovery.models.CurrentScenarioDetails + :ivar recovery_container_id: The recovery container Id. + :vartype recovery_container_id: str + :ivar agent_cluster_id: The Agent cluster Id. + :vartype agent_cluster_id: str + :ivar cluster_fqdn: The cluster FQDN. + :vartype cluster_fqdn: str + :ivar cluster_node_fqdns: The List of cluster Node FQDNs. + :vartype cluster_node_fqdns: list[str] + :ivar cluster_protected_item_ids: The List of Protected Item Id's. + :vartype cluster_protected_item_ids: list[str] + :ivar provisioning_state: The provisioning state of the cluster. + :vartype provisioning_state: str + :ivar are_all_cluster_nodes_registered: A value indicating whether all nodes of the cluster are + registered or not. + :vartype are_all_cluster_nodes_registered: bool + :ivar cluster_registered_nodes: The registered node details. + :vartype cluster_registered_nodes: + list[~azure.mgmt.recoveryservicessiterecovery.models.RegisteredClusterNodes] + :ivar provider_specific_details: The Replication cluster provider custom settings. + :vartype provider_specific_details: + ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationClusterProviderSpecificSettings + :ivar shared_disk_properties: The shared disk properties. + :vartype shared_disk_properties: + ~azure.mgmt.recoveryservicessiterecovery.models.SharedDiskReplicationItemProperties + :ivar policy_id: The Policy Id. + :vartype policy_id: str + """ + + protection_cluster_type: Optional[str] = rest_field( + name="protectionClusterType", visibility=["read", "create", "update", "delete", "query"] + ) + """The type of protection cluster type.""" + primary_fabric_friendly_name: Optional[str] = rest_field( + name="primaryFabricFriendlyName", visibility=["read", "create", "update", "delete", "query"] + ) + """The friendly name of the primary fabric.""" + primary_fabric_provider: Optional[str] = rest_field( + name="primaryFabricProvider", visibility=["read", "create", "update", "delete", "query"] + ) + """The fabric provider of the primary fabric.""" + recovery_fabric_friendly_name: Optional[str] = rest_field( + name="recoveryFabricFriendlyName", visibility=["read", "create", "update", "delete", "query"] + ) + """The friendly name of recovery fabric.""" + recovery_fabric_id: Optional[str] = rest_field( + name="recoveryFabricId", visibility=["read", "create", "update", "delete", "query"] + ) + """The Arm Id of recovery fabric.""" + primary_protection_container_friendly_name: Optional[str] = rest_field( + name="primaryProtectionContainerFriendlyName", visibility=["read", "create", "update", "delete", "query"] + ) + """The name of primary protection container friendly name.""" + recovery_protection_container_friendly_name: Optional[str] = rest_field( + name="recoveryProtectionContainerFriendlyName", visibility=["read", "create", "update", "delete", "query"] + ) + """The name of recovery container friendly name.""" + protection_state: Optional[str] = rest_field( + name="protectionState", visibility=["read", "create", "update", "delete", "query"] + ) + """The protection status.""" + protection_state_description: Optional[str] = rest_field( + name="protectionStateDescription", visibility=["read", "create", "update", "delete", "query"] + ) + """The protection state description.""" + active_location: Optional[str] = rest_field( + name="activeLocation", visibility=["read", "create", "update", "delete", "query"] + ) + """The Current active location of the Protection cluster.""" + test_failover_state: Optional[str] = rest_field( + name="testFailoverState", visibility=["read", "create", "update", "delete", "query"] + ) + """The Test failover state.""" + test_failover_state_description: Optional[str] = rest_field( + name="testFailoverStateDescription", visibility=["read", "create", "update", "delete", "query"] + ) + """The Test failover state description.""" + allowed_operations: Optional[list[str]] = rest_field( + name="allowedOperations", visibility=["read", "create", "update", "delete", "query"] + ) + """The allowed operations on the Replication protection cluster.""" + replication_health: Optional[str] = rest_field( + name="replicationHealth", visibility=["read", "create", "update", "delete", "query"] + ) + """The consolidated protection health for the VM taking any issues with SRS as well as all the + replication units associated with the VM's replication group into account. This is a string + representation of the ProtectionHealth enumeration.""" + health_errors: Optional[list["_models.HealthError"]] = rest_field( + name="healthErrors", visibility=["read", "create", "update", "delete", "query"] + ) + """List of health errors.""" + last_successful_failover_time: Optional[datetime.datetime] = rest_field( + name="lastSuccessfulFailoverTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The last successful failover time.""" + last_successful_test_failover_time: Optional[datetime.datetime] = rest_field( + name="lastSuccessfulTestFailoverTime", + visibility=["read", "create", "update", "delete", "query"], + format="rfc3339", + ) + """The last successful test failover time.""" + policy_friendly_name: Optional[str] = rest_field( + name="policyFriendlyName", visibility=["read", "create", "update", "delete", "query"] + ) + """The name of Policy governing this PE.""" + current_scenario: Optional["_models.CurrentScenarioDetails"] = rest_field( + name="currentScenario", visibility=["read", "create", "update", "delete", "query"] + ) + """The current scenario.""" + recovery_container_id: Optional[str] = rest_field( + name="recoveryContainerId", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery container Id.""" + agent_cluster_id: Optional[str] = rest_field( + name="agentClusterId", visibility=["read", "create", "update", "delete", "query"] + ) + """The Agent cluster Id.""" + cluster_fqdn: Optional[str] = rest_field( + name="clusterFqdn", visibility=["read", "create", "update", "delete", "query"] + ) + """The cluster FQDN.""" + cluster_node_fqdns: Optional[list[str]] = rest_field( + name="clusterNodeFqdns", visibility=["read", "create", "update", "delete", "query"] + ) + """The List of cluster Node FQDNs.""" + cluster_protected_item_ids: Optional[list[str]] = rest_field( + name="clusterProtectedItemIds", visibility=["read", "create", "update", "delete", "query"] + ) + """The List of Protected Item Id's.""" + provisioning_state: Optional[str] = rest_field(name="provisioningState", visibility=["read"]) + """The provisioning state of the cluster.""" + are_all_cluster_nodes_registered: Optional[bool] = rest_field( + name="areAllClusterNodesRegistered", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether all nodes of the cluster are registered or not.""" + cluster_registered_nodes: Optional[list["_models.RegisteredClusterNodes"]] = rest_field( + name="clusterRegisteredNodes", visibility=["read", "create", "update", "delete", "query"] + ) + """The registered node details.""" + provider_specific_details: Optional["_models.ReplicationClusterProviderSpecificSettings"] = rest_field( + name="providerSpecificDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """The Replication cluster provider custom settings.""" + shared_disk_properties: Optional["_models.SharedDiskReplicationItemProperties"] = rest_field( + name="sharedDiskProperties", visibility=["read", "create", "update", "delete", "query"] + ) + """The shared disk properties.""" + policy_id: Optional[str] = rest_field(name="policyId", visibility=["read", "create", "update", "delete", "query"]) + """The Policy Id.""" + + @overload + def __init__( # pylint: disable=too-many-locals + self, + *, + protection_cluster_type: Optional[str] = None, + primary_fabric_friendly_name: Optional[str] = None, + primary_fabric_provider: Optional[str] = None, + recovery_fabric_friendly_name: Optional[str] = None, + recovery_fabric_id: Optional[str] = None, + primary_protection_container_friendly_name: Optional[str] = None, + recovery_protection_container_friendly_name: Optional[str] = None, + protection_state: Optional[str] = None, + protection_state_description: Optional[str] = None, + active_location: Optional[str] = None, + test_failover_state: Optional[str] = None, + test_failover_state_description: Optional[str] = None, + allowed_operations: Optional[list[str]] = None, + replication_health: Optional[str] = None, + health_errors: Optional[list["_models.HealthError"]] = None, + last_successful_failover_time: Optional[datetime.datetime] = None, + last_successful_test_failover_time: Optional[datetime.datetime] = None, + policy_friendly_name: Optional[str] = None, + current_scenario: Optional["_models.CurrentScenarioDetails"] = None, + recovery_container_id: Optional[str] = None, + agent_cluster_id: Optional[str] = None, + cluster_fqdn: Optional[str] = None, + cluster_node_fqdns: Optional[list[str]] = None, + cluster_protected_item_ids: Optional[list[str]] = None, + are_all_cluster_nodes_registered: Optional[bool] = None, + cluster_registered_nodes: Optional[list["_models.RegisteredClusterNodes"]] = None, + provider_specific_details: Optional["_models.ReplicationClusterProviderSpecificSettings"] = None, + shared_disk_properties: Optional["_models.SharedDiskReplicationItemProperties"] = None, + policy_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 ReplicationProtectionIntent(ProxyResource): + """Replication protection intent. + + :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.recoveryservicessiterecovery.models.SystemData + :ivar properties: The custom data. + :vartype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionIntentProperties + :ivar location: Resource Location. + :vartype location: str + """ + + properties: Optional["_models.ReplicationProtectionIntentProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The custom data.""" + location: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource Location.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.ReplicationProtectionIntentProperties"] = None, + location: 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 ReplicationProtectionIntentProperties(_Model): + """Replication protection intent custom data details. + + :ivar friendly_name: The name. + :vartype friendly_name: str + :ivar job_id: The job Id. + :vartype job_id: str + :ivar job_state: The job state. + :vartype job_state: str + :ivar is_active: A value indicating whether the intent object is active. + :vartype is_active: bool + :ivar creation_time_utc: The creation time in UTC. + :vartype creation_time_utc: str + :ivar provider_specific_details: The Replication provider custom settings. + :vartype provider_specific_details: + ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionIntentProviderSpecificSettings + """ + + friendly_name: Optional[str] = rest_field( + name="friendlyName", visibility=["read", "create", "update", "delete", "query"] + ) + """The name.""" + job_id: Optional[str] = rest_field(name="jobId", visibility=["read"]) + """The job Id.""" + job_state: Optional[str] = rest_field(name="jobState", visibility=["read"]) + """The job state.""" + is_active: Optional[bool] = rest_field(name="isActive", visibility=["read"]) + """A value indicating whether the intent object is active.""" + creation_time_utc: Optional[str] = rest_field(name="creationTimeUTC", visibility=["read"]) + """The creation time in UTC.""" + provider_specific_details: Optional["_models.ReplicationProtectionIntentProviderSpecificSettings"] = rest_field( + name="providerSpecificDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """The Replication provider custom settings.""" + + @overload + def __init__( + self, + *, + friendly_name: Optional[str] = None, + provider_specific_details: Optional["_models.ReplicationProtectionIntentProviderSpecificSettings"] = 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 ReplicationProviderContainerUnmappingInput(_Model): # pylint: disable=name-too-long + """Provider specific input for unpairing operations. + + :ivar instance_type: The class type. + :vartype instance_type: str + """ + + instance_type: Optional[str] = rest_field( + name="instanceType", visibility=["read", "create", "update", "delete", "query"] + ) + """The class type.""" + + @overload + def __init__( + self, + *, + instance_type: 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 ReprotectAgentDetails(_Model): + """Reprotect agent details. + + :ivar id: The reprotect agent Id. + :vartype id: str + :ivar name: The reprotect agent name. + :vartype name: str + :ivar bios_id: The reprotect agent Bios Id. + :vartype bios_id: str + :ivar fabric_object_id: The fabric object Id. + :vartype fabric_object_id: str + :ivar fqdn: The reprotect agent Fqdn. + :vartype fqdn: str + :ivar version: The version. + :vartype version: str + :ivar last_heartbeat_utc: The last heartbeat received from the reprotect agent. + :vartype last_heartbeat_utc: ~datetime.datetime + :ivar health: The health of the reprotect agent. Known values are: "None", "Normal", "Warning", + and "Critical". + :vartype health: str or ~azure.mgmt.recoveryservicessiterecovery.models.ProtectionHealth + :ivar health_errors: The health errors. + :vartype health_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] + :ivar protected_item_count: The protected item count. + :vartype protected_item_count: int + :ivar accessible_datastores: The list of accessible datastores fetched from discovery. + :vartype accessible_datastores: list[str] + :ivar vcenter_id: The Vcenter Id. + :vartype vcenter_id: str + :ivar last_discovery_in_utc: The last time when SDS information discovered in SRS. + :vartype last_discovery_in_utc: ~datetime.datetime + """ + + id: Optional[str] = rest_field(visibility=["read"]) + """The reprotect agent Id.""" + name: Optional[str] = rest_field(visibility=["read"]) + """The reprotect agent name.""" + bios_id: Optional[str] = rest_field(name="biosId", visibility=["read"]) + """The reprotect agent Bios Id.""" + fabric_object_id: Optional[str] = rest_field(name="fabricObjectId", visibility=["read"]) + """The fabric object Id.""" + fqdn: Optional[str] = rest_field(visibility=["read"]) + """The reprotect agent Fqdn.""" + version: Optional[str] = rest_field(visibility=["read"]) + """The version.""" + last_heartbeat_utc: Optional[datetime.datetime] = rest_field( + name="lastHeartbeatUtc", visibility=["read"], format="rfc3339" + ) + """The last heartbeat received from the reprotect agent.""" + health: Optional[Union[str, "_models.ProtectionHealth"]] = rest_field(visibility=["read"]) + """The health of the reprotect agent. Known values are: \"None\", \"Normal\", \"Warning\", and + \"Critical\".""" + health_errors: Optional[list["_models.HealthError"]] = rest_field(name="healthErrors", visibility=["read"]) + """The health errors.""" + protected_item_count: Optional[int] = rest_field(name="protectedItemCount", visibility=["read"]) + """The protected item count.""" + accessible_datastores: Optional[list[str]] = rest_field(name="accessibleDatastores", visibility=["read"]) + """The list of accessible datastores fetched from discovery.""" + vcenter_id: Optional[str] = rest_field(name="vcenterId", visibility=["read"]) + """The Vcenter Id.""" + last_discovery_in_utc: Optional[datetime.datetime] = rest_field( + name="lastDiscoveryInUtc", visibility=["read"], format="rfc3339" + ) + """The last time when SDS information discovered in SRS.""" + + +class ResolveHealthError(_Model): + """Resolve health errors input properties. + + :ivar health_error_id: Health error id. + :vartype health_error_id: str + """ + + health_error_id: Optional[str] = rest_field( + name="healthErrorId", visibility=["read", "create", "update", "delete", "query"] + ) + """Health error id.""" + + @overload + def __init__( + self, + *, + health_error_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 ResolveHealthInput(_Model): + """Resolve health input. + + :ivar properties: Disable resolve health input properties. + :vartype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.ResolveHealthInputProperties + """ + + properties: Optional["_models.ResolveHealthInputProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Disable resolve health input properties.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.ResolveHealthInputProperties"] = 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 ResolveHealthInputProperties(_Model): + """Resolve health input properties. + + :ivar health_errors: Health errors. + :vartype health_errors: + list[~azure.mgmt.recoveryservicessiterecovery.models.ResolveHealthError] + """ + + health_errors: Optional[list["_models.ResolveHealthError"]] = rest_field( + name="healthErrors", visibility=["read", "create", "update", "delete", "query"] + ) + """Health errors.""" + + @overload + def __init__( + self, + *, + health_errors: Optional[list["_models.ResolveHealthError"]] = 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 ResourceHealthSummary(_Model): + """Base class to define the health summary of the resources contained under an Arm resource. + + :ivar resource_count: The count of total resources under the container. + :vartype resource_count: int + :ivar issues: The list of summary of health errors across the resources under the container. + :vartype issues: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthErrorSummary] + :ivar categorized_resource_counts: The categorized resource counts. + :vartype categorized_resource_counts: dict[str, int] + """ + + resource_count: Optional[int] = rest_field( + name="resourceCount", visibility=["read", "create", "update", "delete", "query"] + ) + """The count of total resources under the container.""" + issues: Optional[list["_models.HealthErrorSummary"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The list of summary of health errors across the resources under the container.""" + categorized_resource_counts: Optional[dict[str, int]] = rest_field( + name="categorizedResourceCounts", visibility=["read", "create", "update", "delete", "query"] + ) + """The categorized resource counts.""" + + @overload + def __init__( + self, + *, + resource_count: Optional[int] = None, + issues: Optional[list["_models.HealthErrorSummary"]] = None, + categorized_resource_counts: Optional[dict[str, 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 ResumeJobParams(_Model): + """Resume job params. + + :ivar properties: Resume job properties. + :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.ResumeJobParamsProperties + """ + + properties: Optional["_models.ResumeJobParamsProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Resume job properties.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.ResumeJobParamsProperties"] = 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 ResumeJobParamsProperties(_Model): + """Resume job properties. + + :ivar comments: Resume job comments. + :vartype comments: str + """ + + comments: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resume job comments.""" + + @overload + def __init__( + self, + *, + comments: 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 ResumeReplicationInput(_Model): + """Resume replication input. + + :ivar properties: Resume replication input properties. Required. + :vartype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.ResumeReplicationInputProperties + """ + + properties: "_models.ResumeReplicationInputProperties" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Resume replication input properties. Required.""" + + @overload + def __init__( + self, + *, + properties: "_models.ResumeReplicationInputProperties", + ) -> 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 ResumeReplicationInputProperties(_Model): + """Resume replication input properties. + + :ivar provider_specific_details: The provider specific input for resume replication. Required. + :vartype provider_specific_details: + ~azure.mgmt.recoveryservicessiterecovery.models.ResumeReplicationProviderSpecificInput + """ + + provider_specific_details: "_models.ResumeReplicationProviderSpecificInput" = rest_field( + name="providerSpecificDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """The provider specific input for resume replication. Required.""" + + @overload + def __init__( + self, + *, + provider_specific_details: "_models.ResumeReplicationProviderSpecificInput", + ) -> 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 ResumeReplicationProviderSpecificInput(_Model): + """Resume replication provider specific input. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + VMwareCbtResumeReplicationInput + + :ivar instance_type: The class type. Required. Default value is None. + :vartype instance_type: str + """ + + __mapping__: dict[str, _Model] = {} + instance_type: str = rest_discriminator( + name="instanceType", visibility=["read", "create", "update", "delete", "query"] + ) + """The class type. Required. Default value is None.""" + + @overload + def __init__( + self, + *, + instance_type: str, + ) -> 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 ResyncInput(_Model): + """Resync input. + + :ivar properties: Resync input properties. Required. + :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.ResyncInputProperties + """ + + properties: "_models.ResyncInputProperties" = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resync input properties. Required.""" + + @overload + def __init__( + self, + *, + properties: "_models.ResyncInputProperties", + ) -> 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 ResyncInputProperties(_Model): + """Resync input properties. + + :ivar provider_specific_details: The provider specific details. Required. + :vartype provider_specific_details: + ~azure.mgmt.recoveryservicessiterecovery.models.ResyncProviderSpecificInput + """ + + provider_specific_details: "_models.ResyncProviderSpecificInput" = rest_field( + name="providerSpecificDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """The provider specific details. Required.""" + + @overload + def __init__( + self, + *, + provider_specific_details: "_models.ResyncProviderSpecificInput", + ) -> 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 ResyncProviderSpecificInput(_Model): + """Resync provider specific input. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + VMwareCbtResyncInput + + :ivar instance_type: The class type. Required. Default value is None. + :vartype instance_type: str + """ + + __mapping__: dict[str, _Model] = {} + instance_type: str = rest_discriminator( + name="instanceType", visibility=["read", "create", "update", "delete", "query"] + ) + """The class type. Required. Default value is None.""" + + @overload + def __init__( + self, + *, + instance_type: str, + ) -> 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 RetentionVolume(_Model): + """The retention details of the MT. + + :ivar volume_name: The volume name. + :vartype volume_name: str + :ivar capacity_in_bytes: The volume capacity. + :vartype capacity_in_bytes: int + :ivar free_space_in_bytes: The free space available in this volume. + :vartype free_space_in_bytes: int + :ivar threshold_percentage: The threshold percentage. + :vartype threshold_percentage: int + """ + + volume_name: Optional[str] = rest_field( + name="volumeName", visibility=["read", "create", "update", "delete", "query"] + ) + """The volume name.""" + capacity_in_bytes: Optional[int] = rest_field( + name="capacityInBytes", visibility=["read", "create", "update", "delete", "query"] + ) + """The volume capacity.""" + free_space_in_bytes: Optional[int] = rest_field( + name="freeSpaceInBytes", visibility=["read", "create", "update", "delete", "query"] + ) + """The free space available in this volume.""" + threshold_percentage: Optional[int] = rest_field( + name="thresholdPercentage", visibility=["read", "create", "update", "delete", "query"] + ) + """The threshold percentage.""" + + @overload + def __init__( + self, + *, + volume_name: Optional[str] = None, + capacity_in_bytes: Optional[int] = None, + free_space_in_bytes: Optional[int] = None, + threshold_percentage: 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 ReverseReplicationInput(_Model): + """Reverse replication input. + + :ivar properties: Reverse replication properties. + :vartype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.ReverseReplicationInputProperties + """ + + properties: Optional["_models.ReverseReplicationInputProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Reverse replication properties.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.ReverseReplicationInputProperties"] = 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 ReverseReplicationInputProperties(_Model): + """Reverse replication input properties. + + :ivar failover_direction: Failover direction. + :vartype failover_direction: str + :ivar provider_specific_details: Provider specific reverse replication input. + :vartype provider_specific_details: + ~azure.mgmt.recoveryservicessiterecovery.models.ReverseReplicationProviderSpecificInput + """ + + failover_direction: Optional[str] = rest_field( + name="failoverDirection", visibility=["read", "create", "update", "delete", "query"] + ) + """Failover direction.""" + provider_specific_details: Optional["_models.ReverseReplicationProviderSpecificInput"] = rest_field( + name="providerSpecificDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """Provider specific reverse replication input.""" + + @overload + def __init__( + self, + *, + failover_direction: Optional[str] = None, + provider_specific_details: Optional["_models.ReverseReplicationProviderSpecificInput"] = 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 RunAsAccount(_Model): + """CS Accounts Details. + + :ivar account_id: The CS RunAs account Id. + :vartype account_id: str + :ivar account_name: The CS RunAs account name. + :vartype account_name: str + """ + + account_id: Optional[str] = rest_field(name="accountId", visibility=["read", "create", "update", "delete", "query"]) + """The CS RunAs account Id.""" + account_name: Optional[str] = rest_field( + name="accountName", visibility=["read", "create", "update", "delete", "query"] + ) + """The CS RunAs account name.""" + + @overload + def __init__( + self, + *, + account_id: Optional[str] = None, + account_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 ScriptActionTaskDetails(TaskTypeDetails, discriminator="ScriptActionTaskDetails"): + """This class represents the script action task details. + + :ivar name: The name. + :vartype name: str + :ivar path: The path. + :vartype path: str + :ivar output: The output. + :vartype output: str + :ivar is_primary_side_script: A value indicating whether it is a primary side script or not. + :vartype is_primary_side_script: bool + :ivar instance_type: The type of task details. Required. Default value is + "ScriptActionTaskDetails". + :vartype instance_type: str + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name.""" + path: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The path.""" + output: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The output.""" + is_primary_side_script: Optional[bool] = rest_field( + name="isPrimarySideScript", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether it is a primary side script or not.""" + instance_type: Literal["ScriptActionTaskDetails"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The type of task details. Required. Default value is \"ScriptActionTaskDetails\".""" + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + path: Optional[str] = None, + output: Optional[str] = None, + is_primary_side_script: 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) + self.instance_type = "ScriptActionTaskDetails" # type: ignore + + +class SecurityProfileProperties(_Model): + """Security profile input. + + :ivar target_vm_security_type: The target VM security type. Known values are: "None", + "TrustedLaunch", and "ConfidentialVM". + :vartype target_vm_security_type: str or + ~azure.mgmt.recoveryservicessiterecovery.models.SecurityType + :ivar target_vm_secure_boot: A value indicating whether secure boot to be enabled. Known values + are: "Disabled" and "Enabled". + :vartype target_vm_secure_boot: str or + ~azure.mgmt.recoveryservicessiterecovery.models.SecurityConfiguration + :ivar target_vm_tpm: A value indicating whether trusted platform module to be enabled. Known + values are: "Disabled" and "Enabled". + :vartype target_vm_tpm: str or + ~azure.mgmt.recoveryservicessiterecovery.models.SecurityConfiguration + :ivar target_vm_monitoring: A value indicating whether integrity monitoring to be enabled. + Known values are: "Disabled" and "Enabled". + :vartype target_vm_monitoring: str or + ~azure.mgmt.recoveryservicessiterecovery.models.SecurityConfiguration + :ivar target_vm_confidential_encryption: A value indicating whether confidential compute + encryption to be enabled. Known values are: "Disabled" and "Enabled". + :vartype target_vm_confidential_encryption: str or + ~azure.mgmt.recoveryservicessiterecovery.models.SecurityConfiguration + """ + + target_vm_security_type: Optional[Union[str, "_models.SecurityType"]] = rest_field( + name="targetVmSecurityType", visibility=["read", "create", "update", "delete", "query"] + ) + """The target VM security type. Known values are: \"None\", \"TrustedLaunch\", and + \"ConfidentialVM\".""" + target_vm_secure_boot: Optional[Union[str, "_models.SecurityConfiguration"]] = rest_field( + name="targetVmSecureBoot", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether secure boot to be enabled. Known values are: \"Disabled\" and + \"Enabled\".""" + target_vm_tpm: Optional[Union[str, "_models.SecurityConfiguration"]] = rest_field( + name="targetVmTpm", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether trusted platform module to be enabled. Known values are: + \"Disabled\" and \"Enabled\".""" + target_vm_monitoring: Optional[Union[str, "_models.SecurityConfiguration"]] = rest_field( + name="targetVmMonitoring", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether integrity monitoring to be enabled. Known values are: \"Disabled\" + and \"Enabled\".""" + target_vm_confidential_encryption: Optional[Union[str, "_models.SecurityConfiguration"]] = rest_field( + name="targetVmConfidentialEncryption", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether confidential compute encryption to be enabled. Known values are: + \"Disabled\" and \"Enabled\".""" + + @overload + def __init__( + self, + *, + target_vm_security_type: Optional[Union[str, "_models.SecurityType"]] = None, + target_vm_secure_boot: Optional[Union[str, "_models.SecurityConfiguration"]] = None, + target_vm_tpm: Optional[Union[str, "_models.SecurityConfiguration"]] = None, + target_vm_monitoring: Optional[Union[str, "_models.SecurityConfiguration"]] = None, + target_vm_confidential_encryption: Optional[Union[str, "_models.SecurityConfiguration"]] = 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 ServiceError(_Model): + """ASR error model. + + :ivar code: Error code. + :vartype code: str + :ivar message: Error message. + :vartype message: str + :ivar possible_causes: Possible causes of error. + :vartype possible_causes: str + :ivar recommended_action: Recommended action to resolve error. + :vartype recommended_action: str + :ivar activity_id: Activity Id. + :vartype activity_id: str + """ + + code: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Error code.""" + message: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Error message.""" + possible_causes: Optional[str] = rest_field( + name="possibleCauses", visibility=["read", "create", "update", "delete", "query"] + ) + """Possible causes of error.""" + recommended_action: Optional[str] = rest_field( + name="recommendedAction", visibility=["read", "create", "update", "delete", "query"] + ) + """Recommended action to resolve error.""" + activity_id: Optional[str] = rest_field( + name="activityId", visibility=["read", "create", "update", "delete", "query"] + ) + """Activity Id.""" + + @overload + def __init__( + self, + *, + code: Optional[str] = None, + message: Optional[str] = None, + possible_causes: Optional[str] = None, + recommended_action: Optional[str] = None, + activity_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 SharedDiskReplicationItemProperties(_Model): + """Shared Disk Replication item custom data details. + + :ivar protection_state: The protection state of shared disk. + :vartype protection_state: str + :ivar test_failover_state: The tfo state of shared disk. + :vartype test_failover_state: str + :ivar active_location: The Current active location of the PE. + :vartype active_location: str + :ivar allowed_operations: The allowed operations on the Replication protected item. + :vartype allowed_operations: list[str] + :ivar replication_health: The consolidated protection health for the VM taking any issues with + SRS as well as all the replication units associated with the VM's replication group into + account. This is a string representation of the ProtectionHealth enumeration. + :vartype replication_health: str + :ivar health_errors: List of health errors. + :vartype health_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] + :ivar current_scenario: The current scenario. + :vartype current_scenario: + ~azure.mgmt.recoveryservicessiterecovery.models.CurrentScenarioDetails + :ivar shared_disk_provider_specific_details: The Replication provider custom settings. + :vartype shared_disk_provider_specific_details: + ~azure.mgmt.recoveryservicessiterecovery.models.SharedDiskReplicationProviderSpecificSettings + """ + + protection_state: Optional[str] = rest_field( + name="protectionState", visibility=["read", "create", "update", "delete", "query"] + ) + """The protection state of shared disk.""" + test_failover_state: Optional[str] = rest_field( + name="testFailoverState", visibility=["read", "create", "update", "delete", "query"] + ) + """The tfo state of shared disk.""" + active_location: Optional[str] = rest_field( + name="activeLocation", visibility=["read", "create", "update", "delete", "query"] + ) + """The Current active location of the PE.""" + allowed_operations: Optional[list[str]] = rest_field( + name="allowedOperations", visibility=["read", "create", "update", "delete", "query"] + ) + """The allowed operations on the Replication protected item.""" + replication_health: Optional[str] = rest_field( + name="replicationHealth", visibility=["read", "create", "update", "delete", "query"] + ) + """The consolidated protection health for the VM taking any issues with SRS as well as all the + replication units associated with the VM's replication group into account. This is a string + representation of the ProtectionHealth enumeration.""" + health_errors: Optional[list["_models.HealthError"]] = rest_field( + name="healthErrors", visibility=["read", "create", "update", "delete", "query"] + ) + """List of health errors.""" + current_scenario: Optional["_models.CurrentScenarioDetails"] = rest_field( + name="currentScenario", visibility=["read", "create", "update", "delete", "query"] + ) + """The current scenario.""" + shared_disk_provider_specific_details: Optional["_models.SharedDiskReplicationProviderSpecificSettings"] = ( + rest_field(name="sharedDiskProviderSpecificDetails", visibility=["read", "create", "update", "delete", "query"]) + ) + """The Replication provider custom settings.""" + + @overload + def __init__( + self, + *, + protection_state: Optional[str] = None, + test_failover_state: Optional[str] = None, + active_location: Optional[str] = None, + allowed_operations: Optional[list[str]] = None, + replication_health: Optional[str] = None, + health_errors: Optional[list["_models.HealthError"]] = None, + current_scenario: Optional["_models.CurrentScenarioDetails"] = None, + shared_disk_provider_specific_details: Optional["_models.SharedDiskReplicationProviderSpecificSettings"] = 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 StorageClassification(ProxyResource): + """Storage object definition. + + :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.recoveryservicessiterecovery.models.SystemData + :ivar properties: Properties of the storage object. + :vartype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.StorageClassificationProperties + :ivar location: Resource Location. + :vartype location: str + """ + + properties: Optional["_models.StorageClassificationProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Properties of the storage object.""" + location: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource Location.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.StorageClassificationProperties"] = None, + location: 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 StorageClassificationMapping(ProxyResource): + """Storage mapping 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.recoveryservicessiterecovery.models.SystemData + :ivar properties: Properties of the storage mapping object. + :vartype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.StorageClassificationMappingProperties + :ivar location: Resource Location. + :vartype location: str + """ + + properties: Optional["_models.StorageClassificationMappingProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Properties of the storage mapping object.""" + location: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource Location.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.StorageClassificationMappingProperties"] = None, + location: 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 StorageClassificationMappingInput(_Model): + """Storage mapping input. + + :ivar properties: Storage mapping input properties. + :vartype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.StorageMappingInputProperties + """ + + properties: Optional["_models.StorageMappingInputProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Storage mapping input properties.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.StorageMappingInputProperties"] = 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 StorageClassificationMappingProperties(_Model): + """Storage mapping properties. + + :ivar target_storage_classification_id: Target storage object Id. + :vartype target_storage_classification_id: str + """ + + target_storage_classification_id: Optional[str] = rest_field( + name="targetStorageClassificationId", visibility=["read", "create", "update", "delete", "query"] + ) + """Target storage object Id.""" + + @overload + def __init__( + self, + *, + target_storage_classification_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 StorageClassificationProperties(_Model): + """Storage object properties. + + :ivar friendly_name: Friendly name of the Storage classification. + :vartype friendly_name: str + """ + + friendly_name: Optional[str] = rest_field( + name="friendlyName", visibility=["read", "create", "update", "delete", "query"] + ) + """Friendly name of the Storage classification.""" + + @overload + def __init__( + self, + *, + 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 StorageMappingInputProperties(_Model): + """Storage mapping input properties. + + :ivar target_storage_classification_id: The ID of the storage object. + :vartype target_storage_classification_id: str + """ + + target_storage_classification_id: Optional[str] = rest_field( + name="targetStorageClassificationId", visibility=["read", "create", "update", "delete", "query"] + ) + """The ID of the storage object.""" + + @overload + def __init__( + self, + *, + target_storage_classification_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 Subnet(_Model): + """Subnets of the network. + + :ivar name: The subnet name. + :vartype name: str + :ivar friendly_name: The subnet friendly name. + :vartype friendly_name: str + :ivar address_list: The list of addresses for the subnet. + :vartype address_list: list[str] + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The subnet name.""" + friendly_name: Optional[str] = rest_field( + name="friendlyName", visibility=["read", "create", "update", "delete", "query"] + ) + """The subnet friendly name.""" + address_list: Optional[list[str]] = rest_field( + name="addressList", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of addresses for the subnet.""" + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + friendly_name: Optional[str] = None, + address_list: 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 SupportedOperatingSystems(Resource): + """Supported operating systems. + + :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.recoveryservicessiterecovery.models.SystemData + :ivar properties: The supported operating systems properties. + :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.SupportedOSProperties + :ivar location: Resource Location. + :vartype location: str + """ + + properties: Optional["_models.SupportedOSProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The supported operating systems properties.""" + location: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource Location.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.SupportedOSProperties"] = None, + location: 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 SupportedOSDetails(_Model): + """Supported operating system details. + + :ivar os_name: The name. + :vartype os_name: str + :ivar os_type: The type. + :vartype os_type: str + :ivar os_versions: The list of version for operating system. + :vartype os_versions: list[~azure.mgmt.recoveryservicessiterecovery.models.OSVersionWrapper] + """ + + os_name: Optional[str] = rest_field(name="osName", visibility=["read", "create", "update", "delete", "query"]) + """The name.""" + os_type: Optional[str] = rest_field(name="osType", visibility=["read", "create", "update", "delete", "query"]) + """The type.""" + os_versions: Optional[list["_models.OSVersionWrapper"]] = rest_field( + name="osVersions", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of version for operating system.""" + + @overload + def __init__( + self, + *, + os_name: Optional[str] = None, + os_type: Optional[str] = None, + os_versions: Optional[list["_models.OSVersionWrapper"]] = 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 SupportedOSProperties(_Model): + """Supported operating systems properties. + + :ivar supported_os_list: The supported operating systems property list. + :vartype supported_os_list: + list[~azure.mgmt.recoveryservicessiterecovery.models.SupportedOSProperty] + """ + + supported_os_list: Optional[list["_models.SupportedOSProperty"]] = rest_field( + name="supportedOsList", visibility=["read", "create", "update", "delete", "query"] + ) + """The supported operating systems property list.""" + + @overload + def __init__( + self, + *, + supported_os_list: Optional[list["_models.SupportedOSProperty"]] = 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 SupportedOSProperty(_Model): + """Supported operating systems property. + + :ivar instance_type: The replication provider type. + :vartype instance_type: str + :ivar supported_os: The list of supported operating systems. + :vartype supported_os: list[~azure.mgmt.recoveryservicessiterecovery.models.SupportedOSDetails] + """ + + instance_type: Optional[str] = rest_field( + name="instanceType", visibility=["read", "create", "update", "delete", "query"] + ) + """The replication provider type.""" + supported_os: Optional[list["_models.SupportedOSDetails"]] = rest_field( + name="supportedOs", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of supported operating systems.""" + + @overload + def __init__( + self, + *, + instance_type: Optional[str] = None, + supported_os: Optional[list["_models.SupportedOSDetails"]] = 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 SwitchClusterProtectionInput(_Model): + """Switch cluster protection input. + + :ivar properties: Switch cluster protection properties. + :vartype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.SwitchClusterProtectionInputProperties + """ + + properties: Optional["_models.SwitchClusterProtectionInputProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Switch cluster protection properties.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.SwitchClusterProtectionInputProperties"] = 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 SwitchClusterProtectionInputProperties(_Model): + """Switch cluster protection input properties. + + :ivar replication_protection_cluster_name: The unique replication protection cluster name. + :vartype replication_protection_cluster_name: str + :ivar provider_specific_details: Provider specific switch protection input. + :vartype provider_specific_details: + ~azure.mgmt.recoveryservicessiterecovery.models.SwitchClusterProtectionProviderSpecificInput + """ + + replication_protection_cluster_name: Optional[str] = rest_field( + name="replicationProtectionClusterName", visibility=["read", "create", "update", "delete", "query"] + ) + """The unique replication protection cluster name.""" + provider_specific_details: Optional["_models.SwitchClusterProtectionProviderSpecificInput"] = rest_field( + name="providerSpecificDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """Provider specific switch protection input.""" + + @overload + def __init__( + self, + *, + replication_protection_cluster_name: Optional[str] = None, + provider_specific_details: Optional["_models.SwitchClusterProtectionProviderSpecificInput"] = 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 SwitchProtectionInput(_Model): + """Switch protection input. + + :ivar properties: Switch protection properties. + :vartype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.SwitchProtectionInputProperties + """ + + properties: Optional["_models.SwitchProtectionInputProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Switch protection properties.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.SwitchProtectionInputProperties"] = 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 SwitchProtectionInputProperties(_Model): + """Switch protection input properties. + + :ivar replication_protected_item_name: The unique replication protected item name. + :vartype replication_protected_item_name: str + :ivar provider_specific_details: Provider specific switch protection input. + :vartype provider_specific_details: + ~azure.mgmt.recoveryservicessiterecovery.models.SwitchProtectionProviderSpecificInput + """ + + replication_protected_item_name: Optional[str] = rest_field( + name="replicationProtectedItemName", visibility=["read", "create", "update", "delete", "query"] + ) + """The unique replication protected item name.""" + provider_specific_details: Optional["_models.SwitchProtectionProviderSpecificInput"] = rest_field( + name="providerSpecificDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """Provider specific switch protection input.""" + + @overload + def __init__( + self, + *, + replication_protected_item_name: Optional[str] = None, + provider_specific_details: Optional["_models.SwitchProtectionProviderSpecificInput"] = 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 SwitchProtectionJobDetails(JobDetails, discriminator="SwitchProtectionJobDetails"): + """This class represents details for switch protection job. + + :ivar affected_object_details: The affected object properties like source server, source cloud, + target server, target cloud etc. based on the workflow object details. + :vartype affected_object_details: dict[str, str] + :ivar new_replication_protected_item_id: ARM Id of the new replication protected item. + :vartype new_replication_protected_item_id: str + :ivar instance_type: Gets the type of job details (see JobDetailsTypes enum for possible + values). Required. Default value is "SwitchProtectionJobDetails". + :vartype instance_type: str + """ + + new_replication_protected_item_id: Optional[str] = rest_field( + name="newReplicationProtectedItemId", visibility=["read", "create", "update", "delete", "query"] + ) + """ARM Id of the new replication protected item.""" + instance_type: Literal["SwitchProtectionJobDetails"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets the type of job details (see JobDetailsTypes enum for possible values). Required. Default + value is \"SwitchProtectionJobDetails\".""" + + @overload + def __init__( + self, + *, + affected_object_details: Optional[dict[str, str]] = None, + new_replication_protected_item_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) + self.instance_type = "SwitchProtectionJobDetails" # type: ignore + + +class SwitchProviderInput(_Model): + """Input definition for switch provider. + + :ivar properties: Switch provider input properties. + :vartype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.SwitchProviderInputProperties + """ + + properties: Optional["_models.SwitchProviderInputProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Switch provider input properties.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.SwitchProviderInputProperties"] = 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 SwitchProviderInputProperties(_Model): + """Input definition for switch provider input properties. + + :ivar target_instance_type: Target provider type. + :vartype target_instance_type: str + :ivar provider_specific_details: Provider specific settings. + :vartype provider_specific_details: + ~azure.mgmt.recoveryservicessiterecovery.models.SwitchProviderSpecificInput + """ + + target_instance_type: Optional[str] = rest_field( + name="targetInstanceType", visibility=["read", "create", "update", "delete", "query"] + ) + """Target provider type.""" + provider_specific_details: Optional["_models.SwitchProviderSpecificInput"] = rest_field( + name="providerSpecificDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """Provider specific settings.""" + + @overload + def __init__( + self, + *, + target_instance_type: Optional[str] = None, + provider_specific_details: Optional["_models.SwitchProviderSpecificInput"] = 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 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.recoveryservicessiterecovery.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.recoveryservicessiterecovery.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 TargetComputeSize(_Model): + """Represents applicable recovery vm sizes. + + :ivar id: The Id. + :vartype id: str + :ivar name: The name. + :vartype name: str + :ivar type: The Type of the object. + :vartype type: str + :ivar properties: The custom data. + :vartype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.TargetComputeSizeProperties + """ + + id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The Id.""" + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name.""" + type: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The Type of the object.""" + properties: Optional["_models.TargetComputeSizeProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The custom data.""" + + @overload + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + type: Optional[str] = None, + properties: Optional["_models.TargetComputeSizeProperties"] = 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 TargetComputeSizeProperties(_Model): + """Represents applicable recovery vm sizes properties. + + :ivar name: Target compute size name. + :vartype name: str + :ivar friendly_name: Target compute size display name. + :vartype friendly_name: str + :ivar cpu_cores_count: The maximum cpu cores count supported by target compute size. + :vartype cpu_cores_count: int + :ivar v_cpus_available: The Available vCPUs supported by target compute size. + :vartype v_cpus_available: int + :ivar memory_in_gb: The maximum memory in GB supported by target compute size. + :vartype memory_in_gb: float + :ivar max_data_disk_count: The maximum data disks count supported by target compute size. + :vartype max_data_disk_count: int + :ivar max_nics_count: The maximum Nics count supported by target compute size. + :vartype max_nics_count: int + :ivar errors: The reasons why the target compute size is not applicable for the protected item. + :vartype errors: list[~azure.mgmt.recoveryservicessiterecovery.models.ComputeSizeErrorDetails] + :ivar high_iops_supported: The value indicating whether the target compute size supports high + Iops. + :vartype high_iops_supported: str + :ivar hyper_v_generations: The supported HyperV Generations. + :vartype hyper_v_generations: list[str] + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Target compute size name.""" + friendly_name: Optional[str] = rest_field( + name="friendlyName", visibility=["read", "create", "update", "delete", "query"] + ) + """Target compute size display name.""" + cpu_cores_count: Optional[int] = rest_field( + name="cpuCoresCount", visibility=["read", "create", "update", "delete", "query"] + ) + """The maximum cpu cores count supported by target compute size.""" + v_cpus_available: Optional[int] = rest_field(name="vCPUsAvailable", visibility=["read"]) + """The Available vCPUs supported by target compute size.""" + memory_in_gb: Optional[float] = rest_field( + name="memoryInGB", visibility=["read", "create", "update", "delete", "query"] + ) + """The maximum memory in GB supported by target compute size.""" + max_data_disk_count: Optional[int] = rest_field( + name="maxDataDiskCount", visibility=["read", "create", "update", "delete", "query"] + ) + """The maximum data disks count supported by target compute size.""" + max_nics_count: Optional[int] = rest_field( + name="maxNicsCount", visibility=["read", "create", "update", "delete", "query"] + ) + """The maximum Nics count supported by target compute size.""" + errors: Optional[list["_models.ComputeSizeErrorDetails"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The reasons why the target compute size is not applicable for the protected item.""" + high_iops_supported: Optional[str] = rest_field( + name="highIopsSupported", visibility=["read", "create", "update", "delete", "query"] + ) + """The value indicating whether the target compute size supports high Iops.""" + hyper_v_generations: Optional[list[str]] = rest_field( + name="hyperVGenerations", visibility=["read", "create", "update", "delete", "query"] + ) + """The supported HyperV Generations.""" + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + friendly_name: Optional[str] = None, + cpu_cores_count: Optional[int] = None, + memory_in_gb: Optional[float] = None, + max_data_disk_count: Optional[int] = None, + max_nics_count: Optional[int] = None, + errors: Optional[list["_models.ComputeSizeErrorDetails"]] = None, + high_iops_supported: Optional[str] = None, + hyper_v_generations: 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 TestFailoverCleanupInput(_Model): + """Input definition for test failover cleanup. + + :ivar properties: Test failover cleanup input properties. Required. + :vartype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.TestFailoverCleanupInputProperties + """ + + properties: "_models.TestFailoverCleanupInputProperties" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Test failover cleanup input properties. Required.""" + + @overload + def __init__( + self, + *, + properties: "_models.TestFailoverCleanupInputProperties", + ) -> 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 TestFailoverCleanupInputProperties(_Model): + """Input definition for test failover cleanup input properties. + + :ivar comments: Test failover cleanup comments. + :vartype comments: str + """ + + comments: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Test failover cleanup comments.""" + + @overload + def __init__( + self, + *, + comments: 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 TestFailoverInput(_Model): + """Input definition for test failover. + + :ivar properties: Test failover input properties. Required. + :vartype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.TestFailoverInputProperties + """ + + properties: "_models.TestFailoverInputProperties" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Test failover input properties. Required.""" + + @overload + def __init__( + self, + *, + properties: "_models.TestFailoverInputProperties", + ) -> 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 TestFailoverInputProperties(_Model): + """Input definition for test failover input properties. + + :ivar failover_direction: Test failover direction. + :vartype failover_direction: str + :ivar network_type: Network type to be used for test failover. + :vartype network_type: str + :ivar network_id: The id of the network to be used for test failover. + :vartype network_id: str + :ivar provider_specific_details: Provider specific settings. + :vartype provider_specific_details: + ~azure.mgmt.recoveryservicessiterecovery.models.TestFailoverProviderSpecificInput + """ + + failover_direction: Optional[str] = rest_field( + name="failoverDirection", visibility=["read", "create", "update", "delete", "query"] + ) + """Test failover direction.""" + network_type: Optional[str] = rest_field( + name="networkType", visibility=["read", "create", "update", "delete", "query"] + ) + """Network type to be used for test failover.""" + network_id: Optional[str] = rest_field(name="networkId", visibility=["read", "create", "update", "delete", "query"]) + """The id of the network to be used for test failover.""" + provider_specific_details: Optional["_models.TestFailoverProviderSpecificInput"] = rest_field( + name="providerSpecificDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """Provider specific settings.""" + + @overload + def __init__( + self, + *, + failover_direction: Optional[str] = None, + network_type: Optional[str] = None, + network_id: Optional[str] = None, + provider_specific_details: Optional["_models.TestFailoverProviderSpecificInput"] = 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 TestFailoverJobDetails(JobDetails, discriminator="TestFailoverJobDetails"): + """This class represents the details for a test failover job. + + :ivar affected_object_details: The affected object properties like source server, source cloud, + target server, target cloud etc. based on the workflow object details. + :vartype affected_object_details: dict[str, str] + :ivar test_failover_status: The test failover status. + :vartype test_failover_status: str + :ivar comments: The test failover comments. + :vartype comments: str + :ivar network_name: The test network name. + :vartype network_name: str + :ivar network_friendly_name: The test network friendly name. + :vartype network_friendly_name: str + :ivar network_type: The test network type (see TestFailoverInput enum for possible values). + :vartype network_type: str + :ivar protected_item_details: The test VM details. + :vartype protected_item_details: + list[~azure.mgmt.recoveryservicessiterecovery.models.FailoverReplicationProtectedItemDetails] + :ivar instance_type: Gets the type of job details (see JobDetailsTypes enum for possible + values). Required. Default value is "TestFailoverJobDetails". + :vartype instance_type: str + """ + + test_failover_status: Optional[str] = rest_field( + name="testFailoverStatus", visibility=["read", "create", "update", "delete", "query"] + ) + """The test failover status.""" + comments: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The test failover comments.""" + network_name: Optional[str] = rest_field( + name="networkName", visibility=["read", "create", "update", "delete", "query"] + ) + """The test network name.""" + network_friendly_name: Optional[str] = rest_field( + name="networkFriendlyName", visibility=["read", "create", "update", "delete", "query"] + ) + """The test network friendly name.""" + network_type: Optional[str] = rest_field( + name="networkType", visibility=["read", "create", "update", "delete", "query"] + ) + """The test network type (see TestFailoverInput enum for possible values).""" + protected_item_details: Optional[list["_models.FailoverReplicationProtectedItemDetails"]] = rest_field( + name="protectedItemDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """The test VM details.""" + instance_type: Literal["TestFailoverJobDetails"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets the type of job details (see JobDetailsTypes enum for possible values). Required. Default + value is \"TestFailoverJobDetails\".""" + + @overload + def __init__( + self, + *, + affected_object_details: Optional[dict[str, str]] = None, + test_failover_status: Optional[str] = None, + comments: Optional[str] = None, + network_name: Optional[str] = None, + network_friendly_name: Optional[str] = None, + network_type: Optional[str] = None, + protected_item_details: Optional[list["_models.FailoverReplicationProtectedItemDetails"]] = 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) + self.instance_type = "TestFailoverJobDetails" # type: ignore + + +class TestMigrateCleanupInput(_Model): + """Input for test migrate cleanup. + + :ivar properties: Test migrate cleanup input properties. Required. + :vartype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.TestMigrateCleanupInputProperties + """ + + properties: "_models.TestMigrateCleanupInputProperties" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Test migrate cleanup input properties. Required.""" + + @overload + def __init__( + self, + *, + properties: "_models.TestMigrateCleanupInputProperties", + ) -> 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 TestMigrateCleanupInputProperties(_Model): + """Test migrate cleanup input properties. + + :ivar comments: Test migrate cleanup comments. + :vartype comments: str + """ + + comments: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Test migrate cleanup comments.""" + + @overload + def __init__( + self, + *, + comments: 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 TestMigrateInput(_Model): + """Input for test migrate. + + :ivar properties: Test migrate input properties. Required. + :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.TestMigrateInputProperties + """ + + properties: "_models.TestMigrateInputProperties" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Test migrate input properties. Required.""" + + @overload + def __init__( + self, + *, + properties: "_models.TestMigrateInputProperties", + ) -> 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 TestMigrateInputProperties(_Model): + """Test migrate input properties. + + :ivar provider_specific_details: The provider specific details. Required. + :vartype provider_specific_details: + ~azure.mgmt.recoveryservicessiterecovery.models.TestMigrateProviderSpecificInput + """ + + provider_specific_details: "_models.TestMigrateProviderSpecificInput" = rest_field( + name="providerSpecificDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """The provider specific details. Required.""" + + @overload + def __init__( + self, + *, + provider_specific_details: "_models.TestMigrateProviderSpecificInput", + ) -> 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 TestMigrateProviderSpecificInput(_Model): + """Test migrate provider specific input. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + VMwareCbtTestMigrateInput + + :ivar instance_type: The class type. Required. Default value is None. + :vartype instance_type: str + """ + + __mapping__: dict[str, _Model] = {} + instance_type: str = rest_discriminator( + name="instanceType", visibility=["read", "create", "update", "delete", "query"] + ) + """The class type. Required. Default value is None.""" + + @overload + def __init__( + self, + *, + instance_type: str, + ) -> 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 UnplannedFailoverInput(_Model): + """Input definition for unplanned failover. + + :ivar properties: Unplanned failover input properties. Required. + :vartype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.UnplannedFailoverInputProperties + """ + + properties: "_models.UnplannedFailoverInputProperties" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Unplanned failover input properties. Required.""" + + @overload + def __init__( + self, + *, + properties: "_models.UnplannedFailoverInputProperties", + ) -> 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 UnplannedFailoverInputProperties(_Model): + """Input definition for unplanned failover input properties. + + :ivar failover_direction: Failover direction. + :vartype failover_direction: str + :ivar source_site_operations: Source site operations status. + :vartype source_site_operations: str + :ivar provider_specific_details: Provider specific settings. + :vartype provider_specific_details: + ~azure.mgmt.recoveryservicessiterecovery.models.UnplannedFailoverProviderSpecificInput + """ + + failover_direction: Optional[str] = rest_field( + name="failoverDirection", visibility=["read", "create", "update", "delete", "query"] + ) + """Failover direction.""" + source_site_operations: Optional[str] = rest_field( + name="sourceSiteOperations", visibility=["read", "create", "update", "delete", "query"] + ) + """Source site operations status.""" + provider_specific_details: Optional["_models.UnplannedFailoverProviderSpecificInput"] = rest_field( + name="providerSpecificDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """Provider specific settings.""" + + @overload + def __init__( + self, + *, + failover_direction: Optional[str] = None, + source_site_operations: Optional[str] = None, + provider_specific_details: Optional["_models.UnplannedFailoverProviderSpecificInput"] = 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 UpdateApplianceForReplicationProtectedItemInput(_Model): # pylint: disable=name-too-long + """Update appliance for replication protected item input. + + :ivar properties: Update appliance replication protected item properties. Required. + :vartype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.UpdateApplianceForReplicationProtectedItemInputProperties + """ + + properties: "_models.UpdateApplianceForReplicationProtectedItemInputProperties" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Update appliance replication protected item properties. Required.""" + + @overload + def __init__( + self, + *, + properties: "_models.UpdateApplianceForReplicationProtectedItemInputProperties", + ) -> 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 UpdateApplianceForReplicationProtectedItemInputProperties(_Model): # pylint: disable=name-too-long + """Update appliance for protected item input properties. + + :ivar target_appliance_id: The target appliance Id. Required. + :vartype target_appliance_id: str + :ivar provider_specific_details: The provider specific input to update replication protected + item. Required. + :vartype provider_specific_details: + ~azure.mgmt.recoveryservicessiterecovery.models.UpdateApplianceForReplicationProtectedItemProviderSpecificInput + """ + + target_appliance_id: str = rest_field( + name="targetApplianceId", visibility=["read", "create", "update", "delete", "query"] + ) + """The target appliance Id. Required.""" + provider_specific_details: "_models.UpdateApplianceForReplicationProtectedItemProviderSpecificInput" = rest_field( + name="providerSpecificDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """The provider specific input to update replication protected item. Required.""" + + @overload + def __init__( + self, + *, + target_appliance_id: str, + provider_specific_details: "_models.UpdateApplianceForReplicationProtectedItemProviderSpecificInput", + ) -> 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 UpdateDiskInput(_Model): + """Disk input for update. + + :ivar disk_id: The disk Id. Required. + :vartype disk_id: str + :ivar target_disk_name: The target disk name. + :vartype target_disk_name: str + :ivar iops: The number of IOPS allowed for Premium V2 and Ultra disks. + :vartype iops: int + :ivar throughput_in_mbps: The total throughput in Mbps for Premium V2 and Ultra disks. + :vartype throughput_in_mbps: int + :ivar disk_size_in_gb: The target disk size in GB. + :vartype disk_size_in_gb: int + """ + + disk_id: str = rest_field(name="diskId", visibility=["read", "create", "update", "delete", "query"]) + """The disk Id. Required.""" + target_disk_name: Optional[str] = rest_field( + name="targetDiskName", visibility=["read", "create", "update", "delete", "query"] + ) + """The target disk name.""" + iops: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The number of IOPS allowed for Premium V2 and Ultra disks.""" + throughput_in_mbps: Optional[int] = rest_field( + name="throughputInMbps", visibility=["read", "create", "update", "delete", "query"] + ) + """The total throughput in Mbps for Premium V2 and Ultra disks.""" + disk_size_in_gb: Optional[int] = rest_field( + name="diskSizeInGB", visibility=["read", "create", "update", "delete", "query"] + ) + """The target disk size in GB.""" + + @overload + def __init__( + self, + *, + disk_id: str, + target_disk_name: Optional[str] = None, + iops: Optional[int] = None, + throughput_in_mbps: Optional[int] = None, + disk_size_in_gb: 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 UpdateMigrationItemInput(_Model): + """Update migration item input. + + :ivar properties: Update migration item input properties. + :vartype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.UpdateMigrationItemInputProperties + """ + + properties: Optional["_models.UpdateMigrationItemInputProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Update migration item input properties.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.UpdateMigrationItemInputProperties"] = 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 UpdateMigrationItemInputProperties(_Model): + """Update migration item input properties. + + :ivar provider_specific_details: The provider specific input to update migration item. + Required. + :vartype provider_specific_details: + ~azure.mgmt.recoveryservicessiterecovery.models.UpdateMigrationItemProviderSpecificInput + """ + + provider_specific_details: "_models.UpdateMigrationItemProviderSpecificInput" = rest_field( + name="providerSpecificDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """The provider specific input to update migration item. Required.""" + + @overload + def __init__( + self, + *, + provider_specific_details: "_models.UpdateMigrationItemProviderSpecificInput", + ) -> 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 UpdateMigrationItemProviderSpecificInput(_Model): + """Update migration item provider specific input. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + VMwareCbtUpdateMigrationItemInput + + :ivar instance_type: The class type. Required. Default value is None. + :vartype instance_type: str + """ + + __mapping__: dict[str, _Model] = {} + instance_type: str = rest_discriminator( + name="instanceType", visibility=["read", "create", "update", "delete", "query"] + ) + """The class type. Required. Default value is None.""" + + @overload + def __init__( + self, + *, + instance_type: str, + ) -> 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 UpdateMobilityServiceRequest(_Model): + """Request to update the mobility service on a protected item. + + :ivar properties: The properties of the update mobility service request. + :vartype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.UpdateMobilityServiceRequestProperties + """ + + properties: Optional["_models.UpdateMobilityServiceRequestProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The properties of the update mobility service request.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.UpdateMobilityServiceRequestProperties"] = 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 UpdateMobilityServiceRequestProperties(_Model): + """The properties of an update mobility service request. + + :ivar run_as_account_id: The CS run as account Id. + :vartype run_as_account_id: str + """ + + run_as_account_id: Optional[str] = rest_field( + name="runAsAccountId", visibility=["read", "create", "update", "delete", "query"] + ) + """The CS run as account Id.""" + + @overload + def __init__( + self, + *, + run_as_account_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 UpdateNetworkMappingInput(_Model): + """Update network mapping input. + + :ivar properties: The input properties needed to update network mapping. + :vartype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.UpdateNetworkMappingInputProperties + """ + + properties: Optional["_models.UpdateNetworkMappingInputProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The input properties needed to update network mapping.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.UpdateNetworkMappingInputProperties"] = 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 UpdateNetworkMappingInputProperties(_Model): + """Common input details for network mapping operation. + + :ivar recovery_fabric_name: Recovery fabric name. + :vartype recovery_fabric_name: str + :ivar recovery_network_id: Recovery network Id. + :vartype recovery_network_id: str + :ivar fabric_specific_details: Fabrics specific input network Id. + :vartype fabric_specific_details: + ~azure.mgmt.recoveryservicessiterecovery.models.FabricSpecificUpdateNetworkMappingInput + """ + + recovery_fabric_name: Optional[str] = rest_field( + name="recoveryFabricName", visibility=["read", "create", "update", "delete", "query"] + ) + """Recovery fabric name.""" + recovery_network_id: Optional[str] = rest_field( + name="recoveryNetworkId", visibility=["read", "create", "update", "delete", "query"] + ) + """Recovery network Id.""" + fabric_specific_details: Optional["_models.FabricSpecificUpdateNetworkMappingInput"] = rest_field( + name="fabricSpecificDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """Fabrics specific input network Id.""" + + @overload + def __init__( + self, + *, + recovery_fabric_name: Optional[str] = None, + recovery_network_id: Optional[str] = None, + fabric_specific_details: Optional["_models.FabricSpecificUpdateNetworkMappingInput"] = 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 UpdatePolicyInput(_Model): + """Update policy input. + + :ivar properties: The ReplicationProviderSettings. + :vartype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.UpdatePolicyInputProperties + """ + + properties: Optional["_models.UpdatePolicyInputProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The ReplicationProviderSettings.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.UpdatePolicyInputProperties"] = 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 UpdatePolicyInputProperties(_Model): + """Policy update properties. + + :ivar replication_provider_settings: The ReplicationProviderSettings. + :vartype replication_provider_settings: + ~azure.mgmt.recoveryservicessiterecovery.models.PolicyProviderSpecificInput + """ + + replication_provider_settings: Optional["_models.PolicyProviderSpecificInput"] = rest_field( + name="replicationProviderSettings", visibility=["read", "create", "update", "delete", "query"] + ) + """The ReplicationProviderSettings.""" + + @overload + def __init__( + self, + *, + replication_provider_settings: Optional["_models.PolicyProviderSpecificInput"] = 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 UpdateProtectionContainerMappingInput(_Model): + """Container pairing update input. + + :ivar properties: Update protection container mapping input properties. + :vartype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.UpdateProtectionContainerMappingInputProperties + """ + + properties: Optional["_models.UpdateProtectionContainerMappingInputProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Update protection container mapping input properties.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.UpdateProtectionContainerMappingInputProperties"] = 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 UpdateProtectionContainerMappingInputProperties(_Model): # pylint: disable=name-too-long + """Container pairing update input. + + :ivar provider_specific_input: Provider specific input for updating protection container + mapping. + :vartype provider_specific_input: + ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProviderSpecificUpdateContainerMappingInput + """ + + provider_specific_input: Optional["_models.ReplicationProviderSpecificUpdateContainerMappingInput"] = rest_field( + name="providerSpecificInput", visibility=["read", "create", "update", "delete", "query"] + ) + """Provider specific input for updating protection container mapping.""" + + @overload + def __init__( + self, + *, + provider_specific_input: Optional["_models.ReplicationProviderSpecificUpdateContainerMappingInput"] = 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 UpdateRecoveryPlanInput(_Model): + """Update recovery plan input class. + + :ivar properties: Recovery plan update properties. + :vartype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.UpdateRecoveryPlanInputProperties + """ + + properties: Optional["_models.UpdateRecoveryPlanInputProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Recovery plan update properties.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.UpdateRecoveryPlanInputProperties"] = 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 UpdateRecoveryPlanInputProperties(_Model): + """Recovery plan update properties. + + :ivar groups: The recovery plan groups. + :vartype groups: list[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanGroup] + """ + + groups: Optional[list["_models.RecoveryPlanGroup"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery plan groups.""" + + @overload + def __init__( + self, + *, + groups: Optional[list["_models.RecoveryPlanGroup"]] = 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 UpdateReplicationProtectedItemInput(_Model): + """Update replication protected item input. + + :ivar properties: Update replication protected item properties. + :vartype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.UpdateReplicationProtectedItemInputProperties + """ + + properties: Optional["_models.UpdateReplicationProtectedItemInputProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Update replication protected item properties.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.UpdateReplicationProtectedItemInputProperties"] = 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 UpdateReplicationProtectedItemInputProperties(_Model): # pylint: disable=name-too-long + """Update protected item input properties. + + :ivar recovery_azure_vm_name: Target Azure VM name given by the user. + :vartype recovery_azure_vm_name: str + :ivar recovery_azure_vm_size: Target Azure VM size. + :vartype recovery_azure_vm_size: str + :ivar selected_recovery_azure_network_id: Target Azure Network Id. + :vartype selected_recovery_azure_network_id: str + :ivar selected_tfo_azure_network_id: The Azure Network Id for test failover. + :vartype selected_tfo_azure_network_id: str + :ivar selected_source_nic_id: The selected source nic Id which will be used as the primary nic + during failover. + :vartype selected_source_nic_id: str + :ivar enable_rdp_on_target_option: The selected option to enable RDP\\SSH on target vm after + failover. String value of SrsDataContract.EnableRDPOnTargetOption enum. + :vartype enable_rdp_on_target_option: str + :ivar vm_nics: The list of VM nic details. + :vartype vm_nics: list[~azure.mgmt.recoveryservicessiterecovery.models.VMNicInputDetails] + :ivar license_type: License type. Known values are: "NotSpecified", "NoLicenseType", and + "WindowsServer". + :vartype license_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.LicenseType + :ivar recovery_availability_set_id: The target availability set Id. + :vartype recovery_availability_set_id: str + :ivar provider_specific_details: The provider specific input to update replication protected + item. + :vartype provider_specific_details: + ~azure.mgmt.recoveryservicessiterecovery.models.UpdateReplicationProtectedItemProviderInput + """ + + recovery_azure_vm_name: Optional[str] = rest_field( + name="recoveryAzureVMName", visibility=["read", "create", "update", "delete", "query"] + ) + """Target Azure VM name given by the user.""" + recovery_azure_vm_size: Optional[str] = rest_field( + name="recoveryAzureVMSize", visibility=["read", "create", "update", "delete", "query"] + ) + """Target Azure VM size.""" + selected_recovery_azure_network_id: Optional[str] = rest_field( + name="selectedRecoveryAzureNetworkId", visibility=["read", "create", "update", "delete", "query"] + ) + """Target Azure Network Id.""" + selected_tfo_azure_network_id: Optional[str] = rest_field( + name="selectedTfoAzureNetworkId", visibility=["read", "create", "update", "delete", "query"] + ) + """The Azure Network Id for test failover.""" + selected_source_nic_id: Optional[str] = rest_field( + name="selectedSourceNicId", visibility=["read", "create", "update", "delete", "query"] + ) + """The selected source nic Id which will be used as the primary nic during failover.""" + enable_rdp_on_target_option: Optional[str] = rest_field( + name="enableRdpOnTargetOption", visibility=["read", "create", "update", "delete", "query"] + ) + """The selected option to enable RDP\SSH on target vm after failover. String value of + SrsDataContract.EnableRDPOnTargetOption enum.""" + vm_nics: Optional[list["_models.VMNicInputDetails"]] = rest_field( + name="vmNics", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of VM nic details.""" + license_type: Optional[Union[str, "_models.LicenseType"]] = rest_field( + name="licenseType", visibility=["read", "create", "update", "delete", "query"] + ) + """License type. Known values are: \"NotSpecified\", \"NoLicenseType\", and \"WindowsServer\".""" + recovery_availability_set_id: Optional[str] = rest_field( + name="recoveryAvailabilitySetId", visibility=["read", "create", "update", "delete", "query"] + ) + """The target availability set Id.""" + provider_specific_details: Optional["_models.UpdateReplicationProtectedItemProviderInput"] = rest_field( + name="providerSpecificDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """The provider specific input to update replication protected item.""" + + @overload + def __init__( + self, + *, + recovery_azure_vm_name: Optional[str] = None, + recovery_azure_vm_size: Optional[str] = None, + selected_recovery_azure_network_id: Optional[str] = None, + selected_tfo_azure_network_id: Optional[str] = None, + selected_source_nic_id: Optional[str] = None, + enable_rdp_on_target_option: Optional[str] = None, + vm_nics: Optional[list["_models.VMNicInputDetails"]] = None, + license_type: Optional[Union[str, "_models.LicenseType"]] = None, + recovery_availability_set_id: Optional[str] = None, + provider_specific_details: Optional["_models.UpdateReplicationProtectedItemProviderInput"] = 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 UpdateVCenterRequest(_Model): + """Input required to update vCenter. + + :ivar properties: The update VCenter Request Properties. + :vartype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.UpdateVCenterRequestProperties + """ + + properties: Optional["_models.UpdateVCenterRequestProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The update VCenter Request Properties.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.UpdateVCenterRequestProperties"] = 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 UpdateVCenterRequestProperties(_Model): + """The properties of an update vCenter request. + + :ivar friendly_name: The friendly name of the vCenter. + :vartype friendly_name: str + :ivar ip_address: The IP address of the vCenter to be discovered. + :vartype ip_address: str + :ivar process_server_id: The process server Id from where the update can be orchestrated. + :vartype process_server_id: str + :ivar port: The port number for discovery. + :vartype port: str + :ivar run_as_account_id: The CS account Id which has privileges to update the vCenter. + :vartype run_as_account_id: str + """ + + friendly_name: Optional[str] = rest_field( + name="friendlyName", visibility=["read", "create", "update", "delete", "query"] + ) + """The friendly name of the vCenter.""" + ip_address: Optional[str] = rest_field(name="ipAddress", visibility=["read", "create", "update", "delete", "query"]) + """The IP address of the vCenter to be discovered.""" + process_server_id: Optional[str] = rest_field( + name="processServerId", visibility=["read", "create", "update", "delete", "query"] + ) + """The process server Id from where the update can be orchestrated.""" + port: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The port number for discovery.""" + run_as_account_id: Optional[str] = rest_field( + name="runAsAccountId", visibility=["read", "create", "update", "delete", "query"] + ) + """The CS account Id which has privileges to update the vCenter.""" + + @overload + def __init__( + self, + *, + friendly_name: Optional[str] = None, + ip_address: Optional[str] = None, + process_server_id: Optional[str] = None, + port: Optional[str] = None, + run_as_account_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 UserCreatedResourceTag(_Model): + """Resource tag input. + + :ivar tag_name: The tag name. Please read for more information: + `https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/tag-resources#limitations + `_. + :vartype tag_name: str + :ivar tag_value: The tag value. Please read her for more information: + `https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/tag-resources#limitations + `_. + :vartype tag_value: str + """ + + tag_name: Optional[str] = rest_field(name="tagName", visibility=["read", "create", "update", "delete", "query"]) + """The tag name. Please read for more information: + `https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/tag-resources#limitations + `_.""" + tag_value: Optional[str] = rest_field(name="tagValue", visibility=["read", "create", "update", "delete", "query"]) + """The tag value. Please read her for more information: + `https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/tag-resources#limitations + `_.""" + + @overload + def __init__( + self, + *, + tag_name: Optional[str] = None, + tag_value: 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 VaultHealthDetails(Resource): + """Vault health details definition. + + :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.recoveryservicessiterecovery.models.SystemData + :ivar properties: The vault health related data. + :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.VaultHealthProperties + :ivar location: Resource Location. + :vartype location: str + """ + + properties: Optional["_models.VaultHealthProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The vault health related data.""" + location: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource Location.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.VaultHealthProperties"] = None, + location: 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 VaultHealthProperties(_Model): + """class to define the health summary of the Vault. + + :ivar vault_errors: The list of errors on the vault. + :vartype vault_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] + :ivar protected_items_health: The list of the health detail of the protected items in the + vault. + :vartype protected_items_health: + ~azure.mgmt.recoveryservicessiterecovery.models.ResourceHealthSummary + :ivar fabrics_health: The list of the health detail of the fabrics in the vault. + :vartype fabrics_health: ~azure.mgmt.recoveryservicessiterecovery.models.ResourceHealthSummary + :ivar containers_health: The list of the health detail of the containers in the vault. + :vartype containers_health: + ~azure.mgmt.recoveryservicessiterecovery.models.ResourceHealthSummary + """ + + vault_errors: Optional[list["_models.HealthError"]] = rest_field( + name="vaultErrors", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of errors on the vault.""" + protected_items_health: Optional["_models.ResourceHealthSummary"] = rest_field( + name="protectedItemsHealth", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of the health detail of the protected items in the vault.""" + fabrics_health: Optional["_models.ResourceHealthSummary"] = rest_field( + name="fabricsHealth", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of the health detail of the fabrics in the vault.""" + containers_health: Optional["_models.ResourceHealthSummary"] = rest_field( + name="containersHealth", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of the health detail of the containers in the vault.""" + + @overload + def __init__( + self, + *, + vault_errors: Optional[list["_models.HealthError"]] = None, + protected_items_health: Optional["_models.ResourceHealthSummary"] = None, + fabrics_health: Optional["_models.ResourceHealthSummary"] = None, + containers_health: Optional["_models.ResourceHealthSummary"] = 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 VaultSetting(ProxyResource): + """Vault setting. + + :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.recoveryservicessiterecovery.models.SystemData + :ivar properties: The vault setting properties. + :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.VaultSettingProperties + :ivar location: Resource Location. + :vartype location: str + """ + + properties: Optional["_models.VaultSettingProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The vault setting properties.""" + location: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource Location.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.VaultSettingProperties"] = None, + location: 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 VaultSettingCreationInput(_Model): + """Input to create vault setting. + + :ivar properties: Vault setting creation input properties. Required. + :vartype properties: + ~azure.mgmt.recoveryservicessiterecovery.models.VaultSettingCreationInputProperties + """ + + properties: "_models.VaultSettingCreationInputProperties" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Vault setting creation input properties. Required.""" + + @overload + def __init__( + self, + *, + properties: "_models.VaultSettingCreationInputProperties", + ) -> 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 VaultSettingCreationInputProperties(_Model): + """Input to create vault setting. + + :ivar migration_solution_id: The migration solution Id. + :vartype migration_solution_id: str + :ivar vmware_to_azure_provider_type: VMware to Azure provider type. + :vartype vmware_to_azure_provider_type: str + """ + + migration_solution_id: Optional[str] = rest_field( + name="migrationSolutionId", visibility=["read", "create", "update", "delete", "query"] + ) + """The migration solution Id.""" + vmware_to_azure_provider_type: Optional[str] = rest_field( + name="vmwareToAzureProviderType", visibility=["read", "create", "update", "delete", "query"] + ) + """VMware to Azure provider type.""" + + @overload + def __init__( + self, + *, + migration_solution_id: Optional[str] = None, + vmware_to_azure_provider_type: 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 VaultSettingProperties(_Model): + """Vault setting properties. + + :ivar migration_solution_id: The migration solution ARM Id. + :vartype migration_solution_id: str + :ivar vmware_to_azure_provider_type: VMware to Azure provider type. + :vartype vmware_to_azure_provider_type: str + """ + + migration_solution_id: Optional[str] = rest_field( + name="migrationSolutionId", visibility=["read", "create", "update", "delete", "query"] + ) + """The migration solution ARM Id.""" + vmware_to_azure_provider_type: Optional[str] = rest_field( + name="vmwareToAzureProviderType", visibility=["read", "create", "update", "delete", "query"] + ) + """VMware to Azure provider type.""" + + @overload + def __init__( + self, + *, + migration_solution_id: Optional[str] = None, + vmware_to_azure_provider_type: 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 VCenter(ProxyResource): + """vCenter definition. + + :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.recoveryservicessiterecovery.models.SystemData + :ivar properties: VCenter related data. + :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.VCenterProperties + :ivar location: Resource Location. + :vartype location: str + """ + + properties: Optional["_models.VCenterProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """VCenter related data.""" + location: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource Location.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.VCenterProperties"] = None, + location: 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 VCenterProperties(_Model): + """vCenter properties. + + :ivar friendly_name: Friendly name of the vCenter. + :vartype friendly_name: str + :ivar internal_id: VCenter internal ID. + :vartype internal_id: str + :ivar last_heartbeat: The time when the last heartbeat was received by vCenter. + :vartype last_heartbeat: ~datetime.datetime + :ivar discovery_status: The VCenter discovery status. + :vartype discovery_status: str + :ivar process_server_id: The process server Id. + :vartype process_server_id: str + :ivar ip_address: The IP address of the vCenter. + :vartype ip_address: str + :ivar infrastructure_id: The infrastructure Id of vCenter. + :vartype infrastructure_id: str + :ivar port: The port number for discovery. + :vartype port: str + :ivar run_as_account_id: The account Id which has privileges to discover the vCenter. + :vartype run_as_account_id: str + :ivar fabric_arm_resource_name: The ARM resource name of the fabric containing this VCenter. + :vartype fabric_arm_resource_name: str + :ivar health_errors: The health errors for this VCenter. + :vartype health_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] + """ + + friendly_name: Optional[str] = rest_field( + name="friendlyName", visibility=["read", "create", "update", "delete", "query"] + ) + """Friendly name of the vCenter.""" + internal_id: Optional[str] = rest_field( + name="internalId", visibility=["read", "create", "update", "delete", "query"] + ) + """VCenter internal ID.""" + last_heartbeat: Optional[datetime.datetime] = rest_field( + name="lastHeartbeat", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The time when the last heartbeat was received by vCenter.""" + discovery_status: Optional[str] = rest_field( + name="discoveryStatus", visibility=["read", "create", "update", "delete", "query"] + ) + """The VCenter discovery status.""" + process_server_id: Optional[str] = rest_field( + name="processServerId", visibility=["read", "create", "update", "delete", "query"] + ) + """The process server Id.""" + ip_address: Optional[str] = rest_field(name="ipAddress", visibility=["read", "create", "update", "delete", "query"]) + """The IP address of the vCenter.""" + infrastructure_id: Optional[str] = rest_field( + name="infrastructureId", visibility=["read", "create", "update", "delete", "query"] + ) + """The infrastructure Id of vCenter.""" + port: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The port number for discovery.""" + run_as_account_id: Optional[str] = rest_field( + name="runAsAccountId", visibility=["read", "create", "update", "delete", "query"] + ) + """The account Id which has privileges to discover the vCenter.""" + fabric_arm_resource_name: Optional[str] = rest_field( + name="fabricArmResourceName", visibility=["read", "create", "update", "delete", "query"] + ) + """The ARM resource name of the fabric containing this VCenter.""" + health_errors: Optional[list["_models.HealthError"]] = rest_field( + name="healthErrors", visibility=["read", "create", "update", "delete", "query"] + ) + """The health errors for this VCenter.""" + + @overload + def __init__( + self, + *, + friendly_name: Optional[str] = None, + internal_id: Optional[str] = None, + last_heartbeat: Optional[datetime.datetime] = None, + discovery_status: Optional[str] = None, + process_server_id: Optional[str] = None, + ip_address: Optional[str] = None, + infrastructure_id: Optional[str] = None, + port: Optional[str] = None, + run_as_account_id: Optional[str] = None, + fabric_arm_resource_name: Optional[str] = None, + health_errors: Optional[list["_models.HealthError"]] = 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 VersionDetails(_Model): + """Version related details. + + :ivar version: The agent version. + :vartype version: str + :ivar expiry_date: Version expiry date. + :vartype expiry_date: ~datetime.datetime + :ivar status: A value indicating whether security update required. Known values are: + "Supported", "NotSupported", "Deprecated", "UpdateRequired", and "SecurityUpdateRequired". + :vartype status: str or ~azure.mgmt.recoveryservicessiterecovery.models.AgentVersionStatus + """ + + version: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The agent version.""" + expiry_date: Optional[datetime.datetime] = rest_field( + name="expiryDate", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """Version expiry date.""" + status: Optional[Union[str, "_models.AgentVersionStatus"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether security update required. Known values are: \"Supported\", + \"NotSupported\", \"Deprecated\", \"UpdateRequired\", and \"SecurityUpdateRequired\".""" + + @overload + def __init__( + self, + *, + version: Optional[str] = None, + expiry_date: Optional[datetime.datetime] = None, + status: Optional[Union[str, "_models.AgentVersionStatus"]] = 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 VirtualMachineTaskDetails(JobTaskDetails, discriminator="VirtualMachineTaskDetails"): + """This class represents the virtual machine task details. + + :ivar job_task: The job entity. + :vartype job_task: ~azure.mgmt.recoveryservicessiterecovery.models.JobEntity + :ivar instance_type: The type of task details. Required. Default value is + "VirtualMachineTaskDetails". + :vartype instance_type: str + :ivar skipped_reason: The skipped reason. + :vartype skipped_reason: str + :ivar skipped_reason_string: The skipped reason string. + :vartype skipped_reason_string: str + """ + + instance_type: Literal["VirtualMachineTaskDetails"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The type of task details. Required. Default value is \"VirtualMachineTaskDetails\".""" + skipped_reason: Optional[str] = rest_field( + name="skippedReason", visibility=["read", "create", "update", "delete", "query"] + ) + """The skipped reason.""" + skipped_reason_string: Optional[str] = rest_field( + name="skippedReasonString", visibility=["read", "create", "update", "delete", "query"] + ) + """The skipped reason string.""" + + @overload + def __init__( + self, + *, + job_task: Optional["_models.JobEntity"] = None, + skipped_reason: Optional[str] = None, + skipped_reason_string: 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) + self.instance_type = "VirtualMachineTaskDetails" # type: ignore + + +class VmmDetails(FabricSpecificDetails, discriminator="VMM"): + """VMM fabric specific details. + + :ivar instance_type: Gets the class type. Overridden in derived classes. Required. Default + value is "VMM". + :vartype instance_type: str + """ + + instance_type: Literal["VMM"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets the class type. Overridden in derived classes. Required. Default value is \"VMM\".""" + + @overload + def __init__( + self, + ) -> 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) + self.instance_type = "VMM" # type: ignore + + +class VmmToAzureCreateNetworkMappingInput(FabricSpecificCreateNetworkMappingInput, discriminator="VmmToAzure"): + """Create network mappings input properties/behavior specific to Vmm to Azure Network mapping. + + :ivar instance_type: The instance type. Required. Default value is "VmmToAzure". + :vartype instance_type: str + """ + + instance_type: Literal["VmmToAzure"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The instance type. Required. Default value is \"VmmToAzure\".""" + + @overload + def __init__( + self, + ) -> 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) + self.instance_type = "VmmToAzure" # type: ignore + + +class VmmToAzureNetworkMappingSettings(NetworkMappingFabricSpecificSettings, discriminator="VmmToAzure"): + """E2A Network Mapping fabric specific settings. + + :ivar instance_type: Gets the Instance type. Required. Default value is "VmmToAzure". + :vartype instance_type: str + """ + + instance_type: Literal["VmmToAzure"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets the Instance type. Required. Default value is \"VmmToAzure\".""" + + @overload + def __init__( + self, + ) -> 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) + self.instance_type = "VmmToAzure" # type: ignore + + +class VmmToAzureUpdateNetworkMappingInput(FabricSpecificUpdateNetworkMappingInput, discriminator="VmmToAzure"): + """Update network mappings input properties/behavior specific to vmm to azure. + + :ivar instance_type: The instance type. Required. Default value is "VmmToAzure". + :vartype instance_type: str + """ + + instance_type: Literal["VmmToAzure"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The instance type. Required. Default value is \"VmmToAzure\".""" + + @overload + def __init__( + self, + ) -> 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) + self.instance_type = "VmmToAzure" # type: ignore + + +class VmmToVmmCreateNetworkMappingInput(FabricSpecificCreateNetworkMappingInput, discriminator="VmmToVmm"): + """Create network mappings input properties/behavior specific to vmm to vmm Network mapping. + + :ivar instance_type: The instance type. Required. Default value is "VmmToVmm". + :vartype instance_type: str + """ + + instance_type: Literal["VmmToVmm"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The instance type. Required. Default value is \"VmmToVmm\".""" + + @overload + def __init__( + self, + ) -> 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) + self.instance_type = "VmmToVmm" # type: ignore + + +class VmmToVmmNetworkMappingSettings(NetworkMappingFabricSpecificSettings, discriminator="VmmToVmm"): + """E2E Network Mapping fabric specific settings. + + :ivar instance_type: Gets the Instance type. Required. Default value is "VmmToVmm". + :vartype instance_type: str + """ + + instance_type: Literal["VmmToVmm"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets the Instance type. Required. Default value is \"VmmToVmm\".""" + + @overload + def __init__( + self, + ) -> 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) + self.instance_type = "VmmToVmm" # type: ignore + + +class VmmToVmmUpdateNetworkMappingInput(FabricSpecificUpdateNetworkMappingInput, discriminator="VmmToVmm"): + """Update network mappings input properties/behavior specific to vmm to vmm. + + :ivar instance_type: The instance type. Required. Default value is "VmmToVmm". + :vartype instance_type: str + """ + + instance_type: Literal["VmmToVmm"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The instance type. Required. Default value is \"VmmToVmm\".""" + + @overload + def __init__( + self, + ) -> 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) + self.instance_type = "VmmToVmm" # type: ignore + + +class VmmVirtualMachineDetails(HyperVVirtualMachineDetails, discriminator="VmmVirtualMachine"): + """VMM fabric provider specific VM settings. + + :ivar source_item_id: The source id of the object. + :vartype source_item_id: str + :ivar generation: The id of the object in fabric. + :vartype generation: str + :ivar os_details: The Last replication time. + :vartype os_details: ~azure.mgmt.recoveryservicessiterecovery.models.OSDetails + :ivar disk_details: The Last successful failover time. + :vartype disk_details: list[~azure.mgmt.recoveryservicessiterecovery.models.DiskDetails] + :ivar has_physical_disk: A value indicating whether the VM has a physical disk attached. String + value of SrsDataContract.PresenceStatus enum. Known values are: "Unknown", "Present", and + "NotPresent". + :vartype has_physical_disk: str or + ~azure.mgmt.recoveryservicessiterecovery.models.PresenceStatus + :ivar has_fibre_channel_adapter: A value indicating whether the VM has a fibre channel adapter + attached. String value of SrsDataContract.PresenceStatus enum. Known values are: "Unknown", + "Present", and "NotPresent". + :vartype has_fibre_channel_adapter: str or + ~azure.mgmt.recoveryservicessiterecovery.models.PresenceStatus + :ivar has_shared_vhd: A value indicating whether the VM has a shared VHD attached. String value + of SrsDataContract.PresenceStatus enum. Known values are: "Unknown", "Present", and + "NotPresent". + :vartype has_shared_vhd: str or ~azure.mgmt.recoveryservicessiterecovery.models.PresenceStatus + :ivar hyper_v_host_id: The Id of the hyper-v host in fabric. + :vartype hyper_v_host_id: str + :ivar instance_type: Gets the class type. Overridden in derived classes. Required. Default + value is "VmmVirtualMachine". + :vartype instance_type: str + """ + + instance_type: Literal["VmmVirtualMachine"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets the class type. Overridden in derived classes. Required. Default value is + \"VmmVirtualMachine\".""" + + @overload + def __init__( + self, + *, + source_item_id: Optional[str] = None, + generation: Optional[str] = None, + os_details: Optional["_models.OSDetails"] = None, + disk_details: Optional[list["_models.DiskDetails"]] = None, + has_physical_disk: Optional[Union[str, "_models.PresenceStatus"]] = None, + has_fibre_channel_adapter: Optional[Union[str, "_models.PresenceStatus"]] = None, + has_shared_vhd: Optional[Union[str, "_models.PresenceStatus"]] = None, + hyper_v_host_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) + self.instance_type = "VmmVirtualMachine" # type: ignore + + +class VMNicDetails(_Model): + """Hyper V VM network details. + + :ivar nic_id: The nic Id. + :vartype nic_id: str + :ivar replica_nic_id: The replica nic Id. + :vartype replica_nic_id: str + :ivar source_nic_arm_id: The source nic ARM Id. + :vartype source_nic_arm_id: str + :ivar v_m_network_name: VM network name. + :vartype v_m_network_name: str + :ivar recovery_vm_network_id: Recovery VM network Id. + :vartype recovery_vm_network_id: str + :ivar ip_configs: The IP configurations of the NIC. + :vartype ip_configs: list[~azure.mgmt.recoveryservicessiterecovery.models.IPConfigDetails] + :ivar selection_type: Selection type for failover. + :vartype selection_type: str + :ivar recovery_network_security_group_id: The id of the NSG associated with the NIC. + :vartype recovery_network_security_group_id: str + :ivar enable_accelerated_networking_on_recovery: A value indicating whether the NIC has + accelerated networking enabled. + :vartype enable_accelerated_networking_on_recovery: bool + :ivar tfo_vm_network_id: The network to be used by NIC during test failover. + :vartype tfo_vm_network_id: str + :ivar tfo_network_security_group_id: The NSG to be used by NIC during test failover. + :vartype tfo_network_security_group_id: str + :ivar enable_accelerated_networking_on_tfo: Whether the TFO NIC has accelerated networking + enabled. + :vartype enable_accelerated_networking_on_tfo: bool + :ivar recovery_nic_name: The name of the NIC to be used when creating target NICs. + :vartype recovery_nic_name: str + :ivar recovery_nic_resource_group_name: The resource group of the NIC to be used when creating + target NICs. + :vartype recovery_nic_resource_group_name: str + :ivar reuse_existing_nic: A value indicating whether an existing NIC is allowed to be reused + during failover subject to availability. + :vartype reuse_existing_nic: bool + :ivar tfo_recovery_nic_name: The name of the NIC to be used when creating target NICs in TFO. + :vartype tfo_recovery_nic_name: str + :ivar tfo_recovery_nic_resource_group_name: The resource group of the NIC to be used when + creating target NICs in TFO. + :vartype tfo_recovery_nic_resource_group_name: str + :ivar tfo_reuse_existing_nic: A value indicating whether an existing NIC is allowed to be + reused during test failover subject to availability. + :vartype tfo_reuse_existing_nic: bool + :ivar target_nic_name: Target NIC name. + :vartype target_nic_name: str + """ + + nic_id: Optional[str] = rest_field(name="nicId", visibility=["read", "create", "update", "delete", "query"]) + """The nic Id.""" + replica_nic_id: Optional[str] = rest_field( + name="replicaNicId", visibility=["read", "create", "update", "delete", "query"] + ) + """The replica nic Id.""" + source_nic_arm_id: Optional[str] = rest_field( + name="sourceNicArmId", visibility=["read", "create", "update", "delete", "query"] + ) + """The source nic ARM Id.""" + v_m_network_name: Optional[str] = rest_field( + name="vMNetworkName", visibility=["read", "create", "update", "delete", "query"] + ) + """VM network name.""" + recovery_vm_network_id: Optional[str] = rest_field( + name="recoveryVMNetworkId", visibility=["read", "create", "update", "delete", "query"] + ) + """Recovery VM network Id.""" + ip_configs: Optional[list["_models.IPConfigDetails"]] = rest_field( + name="ipConfigs", visibility=["read", "create", "update", "delete", "query"] + ) + """The IP configurations of the NIC.""" + selection_type: Optional[str] = rest_field( + name="selectionType", visibility=["read", "create", "update", "delete", "query"] + ) + """Selection type for failover.""" + recovery_network_security_group_id: Optional[str] = rest_field( + name="recoveryNetworkSecurityGroupId", visibility=["read", "create", "update", "delete", "query"] + ) + """The id of the NSG associated with the NIC.""" + enable_accelerated_networking_on_recovery: Optional[bool] = rest_field( + name="enableAcceleratedNetworkingOnRecovery", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether the NIC has accelerated networking enabled.""" + tfo_vm_network_id: Optional[str] = rest_field( + name="tfoVMNetworkId", visibility=["read", "create", "update", "delete", "query"] + ) + """The network to be used by NIC during test failover.""" + tfo_network_security_group_id: Optional[str] = rest_field( + name="tfoNetworkSecurityGroupId", visibility=["read", "create", "update", "delete", "query"] + ) + """The NSG to be used by NIC during test failover.""" + enable_accelerated_networking_on_tfo: Optional[bool] = rest_field( + name="enableAcceleratedNetworkingOnTfo", visibility=["read", "create", "update", "delete", "query"] + ) + """Whether the TFO NIC has accelerated networking enabled.""" + recovery_nic_name: Optional[str] = rest_field( + name="recoveryNicName", visibility=["read", "create", "update", "delete", "query"] + ) + """The name of the NIC to be used when creating target NICs.""" + recovery_nic_resource_group_name: Optional[str] = rest_field( + name="recoveryNicResourceGroupName", visibility=["read", "create", "update", "delete", "query"] + ) + """The resource group of the NIC to be used when creating target NICs.""" + reuse_existing_nic: Optional[bool] = rest_field( + name="reuseExistingNic", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether an existing NIC is allowed to be reused during failover subject to + availability.""" + tfo_recovery_nic_name: Optional[str] = rest_field( + name="tfoRecoveryNicName", visibility=["read", "create", "update", "delete", "query"] + ) + """The name of the NIC to be used when creating target NICs in TFO.""" + tfo_recovery_nic_resource_group_name: Optional[str] = rest_field( + name="tfoRecoveryNicResourceGroupName", visibility=["read", "create", "update", "delete", "query"] + ) + """The resource group of the NIC to be used when creating target NICs in TFO.""" + tfo_reuse_existing_nic: Optional[bool] = rest_field( + name="tfoReuseExistingNic", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether an existing NIC is allowed to be reused during test failover subject + to availability.""" + target_nic_name: Optional[str] = rest_field( + name="targetNicName", visibility=["read", "create", "update", "delete", "query"] + ) + """Target NIC name.""" + + @overload + def __init__( + self, + *, + nic_id: Optional[str] = None, + replica_nic_id: Optional[str] = None, + source_nic_arm_id: Optional[str] = None, + v_m_network_name: Optional[str] = None, + recovery_vm_network_id: Optional[str] = None, + ip_configs: Optional[list["_models.IPConfigDetails"]] = None, + selection_type: Optional[str] = None, + recovery_network_security_group_id: Optional[str] = None, + enable_accelerated_networking_on_recovery: Optional[bool] = None, + tfo_vm_network_id: Optional[str] = None, + tfo_network_security_group_id: Optional[str] = None, + enable_accelerated_networking_on_tfo: Optional[bool] = None, + recovery_nic_name: Optional[str] = None, + recovery_nic_resource_group_name: Optional[str] = None, + reuse_existing_nic: Optional[bool] = None, + tfo_recovery_nic_name: Optional[str] = None, + tfo_recovery_nic_resource_group_name: Optional[str] = None, + tfo_reuse_existing_nic: Optional[bool] = None, + target_nic_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 VMNicInputDetails(_Model): + """Hyper V VM network input details. + + :ivar nic_id: The nic Id. + :vartype nic_id: str + :ivar ip_configs: The IP configurations to be used by NIC during test failover and failover. + :vartype ip_configs: list[~azure.mgmt.recoveryservicessiterecovery.models.IPConfigInputDetails] + :ivar selection_type: Selection type for failover. + :vartype selection_type: str + :ivar recovery_network_security_group_id: The id of the NSG associated with the NIC. + :vartype recovery_network_security_group_id: str + :ivar enable_accelerated_networking_on_recovery: Whether the NIC has accelerated networking + enabled. + :vartype enable_accelerated_networking_on_recovery: bool + :ivar tfo_network_security_group_id: The NSG to be used by NIC during test failover. + :vartype tfo_network_security_group_id: str + :ivar enable_accelerated_networking_on_tfo: Whether the test NIC has accelerated networking + enabled. + :vartype enable_accelerated_networking_on_tfo: bool + :ivar recovery_nic_name: The name of the NIC to be used when creating target NICs. + :vartype recovery_nic_name: str + :ivar recovery_nic_resource_group_name: The resource group of the NIC to be used when creating + target NICs. + :vartype recovery_nic_resource_group_name: str + :ivar reuse_existing_nic: A value indicating whether an existing NIC is allowed to be reused + during failover subject to availability. + :vartype reuse_existing_nic: bool + :ivar tfo_nic_name: The name of the NIC to be used when creating target NICs in TFO. + :vartype tfo_nic_name: str + :ivar tfo_nic_resource_group_name: The resource group of the NIC to be used when creating + target NICs in TFO. + :vartype tfo_nic_resource_group_name: str + :ivar tfo_reuse_existing_nic: A value indicating whether an existing NIC is allowed to be + reused during test failover subject to availability. + :vartype tfo_reuse_existing_nic: bool + :ivar target_nic_name: Target NIC name. + :vartype target_nic_name: str + """ + + nic_id: Optional[str] = rest_field(name="nicId", visibility=["read", "create", "update", "delete", "query"]) + """The nic Id.""" + ip_configs: Optional[list["_models.IPConfigInputDetails"]] = rest_field( + name="ipConfigs", visibility=["read", "create", "update", "delete", "query"] + ) + """The IP configurations to be used by NIC during test failover and failover.""" + selection_type: Optional[str] = rest_field( + name="selectionType", visibility=["read", "create", "update", "delete", "query"] + ) + """Selection type for failover.""" + recovery_network_security_group_id: Optional[str] = rest_field( + name="recoveryNetworkSecurityGroupId", visibility=["read", "create", "update", "delete", "query"] + ) + """The id of the NSG associated with the NIC.""" + enable_accelerated_networking_on_recovery: Optional[bool] = rest_field( + name="enableAcceleratedNetworkingOnRecovery", visibility=["read", "create", "update", "delete", "query"] + ) + """Whether the NIC has accelerated networking enabled.""" + tfo_network_security_group_id: Optional[str] = rest_field( + name="tfoNetworkSecurityGroupId", visibility=["read", "create", "update", "delete", "query"] + ) + """The NSG to be used by NIC during test failover.""" + enable_accelerated_networking_on_tfo: Optional[bool] = rest_field( + name="enableAcceleratedNetworkingOnTfo", visibility=["read", "create", "update", "delete", "query"] + ) + """Whether the test NIC has accelerated networking enabled.""" + recovery_nic_name: Optional[str] = rest_field( + name="recoveryNicName", visibility=["read", "create", "update", "delete", "query"] + ) + """The name of the NIC to be used when creating target NICs.""" + recovery_nic_resource_group_name: Optional[str] = rest_field( + name="recoveryNicResourceGroupName", visibility=["read", "create", "update", "delete", "query"] + ) + """The resource group of the NIC to be used when creating target NICs.""" + reuse_existing_nic: Optional[bool] = rest_field( + name="reuseExistingNic", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether an existing NIC is allowed to be reused during failover subject to + availability.""" + tfo_nic_name: Optional[str] = rest_field( + name="tfoNicName", visibility=["read", "create", "update", "delete", "query"] + ) + """The name of the NIC to be used when creating target NICs in TFO.""" + tfo_nic_resource_group_name: Optional[str] = rest_field( + name="tfoNicResourceGroupName", visibility=["read", "create", "update", "delete", "query"] + ) + """The resource group of the NIC to be used when creating target NICs in TFO.""" + tfo_reuse_existing_nic: Optional[bool] = rest_field( + name="tfoReuseExistingNic", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether an existing NIC is allowed to be reused during test failover subject + to availability.""" + target_nic_name: Optional[str] = rest_field( + name="targetNicName", visibility=["read", "create", "update", "delete", "query"] + ) + """Target NIC name.""" + + @overload + def __init__( + self, + *, + nic_id: Optional[str] = None, + ip_configs: Optional[list["_models.IPConfigInputDetails"]] = None, + selection_type: Optional[str] = None, + recovery_network_security_group_id: Optional[str] = None, + enable_accelerated_networking_on_recovery: Optional[bool] = None, + tfo_network_security_group_id: Optional[str] = None, + enable_accelerated_networking_on_tfo: Optional[bool] = None, + recovery_nic_name: Optional[str] = None, + recovery_nic_resource_group_name: Optional[str] = None, + reuse_existing_nic: Optional[bool] = None, + tfo_nic_name: Optional[str] = None, + tfo_nic_resource_group_name: Optional[str] = None, + tfo_reuse_existing_nic: Optional[bool] = None, + target_nic_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 VmNicUpdatesTaskDetails(TaskTypeDetails, discriminator="VmNicUpdatesTaskDetails"): + """This class represents the vm NicUpdates task details. + + :ivar vm_id: Virtual machine Id. + :vartype vm_id: str + :ivar nic_id: Nic Id. + :vartype nic_id: str + :ivar name: Name of the Nic. + :vartype name: str + :ivar instance_type: The type of task details. Required. Default value is + "VmNicUpdatesTaskDetails". + :vartype instance_type: str + """ + + vm_id: Optional[str] = rest_field(name="vmId", visibility=["read", "create", "update", "delete", "query"]) + """Virtual machine Id.""" + nic_id: Optional[str] = rest_field(name="nicId", visibility=["read", "create", "update", "delete", "query"]) + """Nic Id.""" + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Name of the Nic.""" + instance_type: Literal["VmNicUpdatesTaskDetails"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The type of task details. Required. Default value is \"VmNicUpdatesTaskDetails\".""" + + @overload + def __init__( + self, + *, + vm_id: Optional[str] = None, + nic_id: Optional[str] = None, + 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) + self.instance_type = "VmNicUpdatesTaskDetails" # type: ignore + + +class VMwareCbtContainerCreationInput(ReplicationProviderSpecificContainerCreationInput, discriminator="VMwareCbt"): + """VMwareCbt container creation input. + + :ivar instance_type: The class type. Required. Default value is "VMwareCbt". + :vartype instance_type: str + """ + + instance_type: Literal["VMwareCbt"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The class type. Required. Default value is \"VMwareCbt\".""" + + @overload + def __init__( + self, + ) -> 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) + self.instance_type = "VMwareCbt" # type: ignore + + +class VMwareCbtContainerMappingInput(ReplicationProviderSpecificContainerMappingInput, discriminator="VMwareCbt"): + """VMwareCbt container mapping input. + + :ivar key_vault_id: The target key vault ARM Id. + :vartype key_vault_id: str + :ivar key_vault_uri: The target key vault URL. + :vartype key_vault_uri: str + :ivar storage_account_id: The storage account ARM Id. Required. + :vartype storage_account_id: str + :ivar storage_account_sas_secret_name: The secret name of the storage account. + :vartype storage_account_sas_secret_name: str + :ivar service_bus_connection_string_secret_name: The secret name of the service bus connection + string. + :vartype service_bus_connection_string_secret_name: str + :ivar target_location: The target location. Required. + :vartype target_location: str + :ivar instance_type: The class type. Required. Default value is "VMwareCbt". + :vartype instance_type: str + """ + + key_vault_id: Optional[str] = rest_field( + name="keyVaultId", visibility=["read", "create", "update", "delete", "query"] + ) + """The target key vault ARM Id.""" + key_vault_uri: Optional[str] = rest_field( + name="keyVaultUri", visibility=["read", "create", "update", "delete", "query"] + ) + """The target key vault URL.""" + storage_account_id: str = rest_field( + name="storageAccountId", visibility=["read", "create", "update", "delete", "query"] + ) + """The storage account ARM Id. Required.""" + storage_account_sas_secret_name: Optional[str] = rest_field( + name="storageAccountSasSecretName", visibility=["read", "create", "update", "delete", "query"] + ) + """The secret name of the storage account.""" + service_bus_connection_string_secret_name: Optional[str] = rest_field( + name="serviceBusConnectionStringSecretName", visibility=["read", "create", "update", "delete", "query"] + ) + """The secret name of the service bus connection string.""" + target_location: str = rest_field(name="targetLocation", visibility=["read", "create", "update", "delete", "query"]) + """The target location. Required.""" + instance_type: Literal["VMwareCbt"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The class type. Required. Default value is \"VMwareCbt\".""" + + @overload + def __init__( + self, + *, + storage_account_id: str, + target_location: str, + key_vault_id: Optional[str] = None, + key_vault_uri: Optional[str] = None, + storage_account_sas_secret_name: Optional[str] = None, + service_bus_connection_string_secret_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) + self.instance_type = "VMwareCbt" # type: ignore + + +class VMwareCbtDiskInput(_Model): + """VMwareCbt disk input. + + :ivar disk_id: The disk Id. Required. + :vartype disk_id: str + :ivar disk_type: The disk type. Known values are: "Standard_LRS", "Premium_LRS", + "StandardSSD_LRS", "PremiumV2_LRS", "UltraSSD_LRS", "StandardSSD_ZRS", and "Premium_ZRS". + :vartype disk_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.DiskAccountType + :ivar is_os_disk: A value indicating whether the disk is the OS disk. Required. + :vartype is_os_disk: str + :ivar log_storage_account_id: The log storage account ARM Id. Required. + :vartype log_storage_account_id: str + :ivar log_storage_account_sas_secret_name: The key vault secret name of the log storage + account. Required. + :vartype log_storage_account_sas_secret_name: str + :ivar disk_encryption_set_id: The DiskEncryptionSet ARM Id. + :vartype disk_encryption_set_id: str + :ivar sector_size_in_bytes: The logical sector size (in bytes), 512 by default. + :vartype sector_size_in_bytes: int + :ivar iops: The number of IOPS allowed for Premium V2 and Ultra disks. + :vartype iops: int + :ivar throughput_in_mbps: The total throughput in Mbps for Premium V2 and Ultra disks. + :vartype throughput_in_mbps: int + :ivar disk_size_in_gb: The target disk size in GB. + :vartype disk_size_in_gb: int + """ + + disk_id: str = rest_field(name="diskId", visibility=["read", "create", "update", "delete", "query"]) + """The disk Id. Required.""" + disk_type: Optional[Union[str, "_models.DiskAccountType"]] = rest_field( + name="diskType", visibility=["read", "create", "update", "delete", "query"] + ) + """The disk type. Known values are: \"Standard_LRS\", \"Premium_LRS\", \"StandardSSD_LRS\", + \"PremiumV2_LRS\", \"UltraSSD_LRS\", \"StandardSSD_ZRS\", and \"Premium_ZRS\".""" + is_os_disk: str = rest_field(name="isOSDisk", visibility=["read", "create", "update", "delete", "query"]) + """A value indicating whether the disk is the OS disk. Required.""" + log_storage_account_id: str = rest_field( + name="logStorageAccountId", visibility=["read", "create", "update", "delete", "query"] + ) + """The log storage account ARM Id. Required.""" + log_storage_account_sas_secret_name: str = rest_field( + name="logStorageAccountSasSecretName", visibility=["read", "create", "update", "delete", "query"] + ) + """The key vault secret name of the log storage account. Required.""" + disk_encryption_set_id: Optional[str] = rest_field( + name="diskEncryptionSetId", visibility=["read", "create", "update", "delete", "query"] + ) + """The DiskEncryptionSet ARM Id.""" + sector_size_in_bytes: Optional[int] = rest_field( + name="sectorSizeInBytes", visibility=["read", "create", "update", "delete", "query"] + ) + """The logical sector size (in bytes), 512 by default.""" + iops: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The number of IOPS allowed for Premium V2 and Ultra disks.""" + throughput_in_mbps: Optional[int] = rest_field( + name="throughputInMbps", visibility=["read", "create", "update", "delete", "query"] + ) + """The total throughput in Mbps for Premium V2 and Ultra disks.""" + disk_size_in_gb: Optional[int] = rest_field( + name="diskSizeInGB", visibility=["read", "create", "update", "delete", "query"] + ) + """The target disk size in GB.""" + + @overload + def __init__( + self, + *, + disk_id: str, + is_os_disk: str, + log_storage_account_id: str, + log_storage_account_sas_secret_name: str, + disk_type: Optional[Union[str, "_models.DiskAccountType"]] = None, + disk_encryption_set_id: Optional[str] = None, + sector_size_in_bytes: Optional[int] = None, + iops: Optional[int] = None, + throughput_in_mbps: Optional[int] = None, + disk_size_in_gb: 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 VMwareCbtEnableMigrationInput(EnableMigrationProviderSpecificInput, discriminator="VMwareCbt"): + """VMwareCbt specific enable migration input. + + :ivar vmware_machine_id: The ARM Id of the VM discovered in VMware. Required. + :vartype vmware_machine_id: str + :ivar disks_to_include: The disks to include list. Required. + :vartype disks_to_include: + list[~azure.mgmt.recoveryservicessiterecovery.models.VMwareCbtDiskInput] + :ivar license_type: License type. Known values are: "NotSpecified", "NoLicenseType", and + "WindowsServer". + :vartype license_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.LicenseType + :ivar sql_server_license_type: The SQL Server license type. Known values are: "NotSpecified", + "NoLicenseType", "PAYG", and "AHUB". + :vartype sql_server_license_type: str or + ~azure.mgmt.recoveryservicessiterecovery.models.SqlServerLicenseType + :ivar linux_license_type: The license type for Linux VM's. Known values are: "NotSpecified", + "NoLicenseType", and "LinuxServer". + :vartype linux_license_type: str or + ~azure.mgmt.recoveryservicessiterecovery.models.LinuxLicenseType + :ivar perform_sql_bulk_registration: A value indicating whether bulk SQL RP registration to be + done. + :vartype perform_sql_bulk_registration: str + :ivar data_mover_run_as_account_id: The data mover run as account Id. Required. + :vartype data_mover_run_as_account_id: str + :ivar snapshot_run_as_account_id: The snapshot run as account Id. Required. + :vartype snapshot_run_as_account_id: str + :ivar target_vm_name: The target VM name. + :vartype target_vm_name: str + :ivar target_vm_size: The target VM size. + :vartype target_vm_size: str + :ivar target_resource_group_id: The target resource group ARM Id. Required. + :vartype target_resource_group_id: str + :ivar target_network_id: The target network ARM Id. Required. + :vartype target_network_id: str + :ivar test_network_id: The selected test network ARM Id. + :vartype test_network_id: str + :ivar target_subnet_name: The target subnet name. + :vartype target_subnet_name: str + :ivar test_subnet_name: The selected test subnet name. + :vartype test_subnet_name: str + :ivar target_availability_set_id: The target availability set ARM Id. + :vartype target_availability_set_id: str + :ivar target_availability_zone: The target availability zone. + :vartype target_availability_zone: str + :ivar target_proximity_placement_group_id: The target proximity placement group ARM Id. + :vartype target_proximity_placement_group_id: str + :ivar confidential_vm_key_vault_id: The confidential VM key vault Id for ADE installation. + :vartype confidential_vm_key_vault_id: str + :ivar target_vm_security_profile: The target VM security profile. + :vartype target_vm_security_profile: + ~azure.mgmt.recoveryservicessiterecovery.models.VMwareCbtSecurityProfileProperties + :ivar target_boot_diagnostics_storage_account_id: The target boot diagnostics storage account + ARM Id. + :vartype target_boot_diagnostics_storage_account_id: str + :ivar perform_auto_resync: A value indicating whether auto resync is to be done. + :vartype perform_auto_resync: str + :ivar target_vm_tags: The target VM tags. + :vartype target_vm_tags: dict[str, str] + :ivar seed_disk_tags: The tags for the seed disks. + :vartype seed_disk_tags: dict[str, str] + :ivar target_disk_tags: The tags for the target disks. + :vartype target_disk_tags: dict[str, str] + :ivar target_nic_tags: The tags for the target NICs. + :vartype target_nic_tags: dict[str, str] + :ivar user_selected_os_name: The OS name selected by user. + :vartype user_selected_os_name: str + :ivar target_capacity_reservation_group_id: The target capacity reservation group ARM Id. + :vartype target_capacity_reservation_group_id: str + :ivar instance_type: The class type. Required. Default value is "VMwareCbt". + :vartype instance_type: str + """ + + vmware_machine_id: str = rest_field( + name="vmwareMachineId", visibility=["read", "create", "update", "delete", "query"] + ) + """The ARM Id of the VM discovered in VMware. Required.""" + disks_to_include: list["_models.VMwareCbtDiskInput"] = rest_field( + name="disksToInclude", visibility=["read", "create", "update", "delete", "query"] + ) + """The disks to include list. Required.""" + license_type: Optional[Union[str, "_models.LicenseType"]] = rest_field( + name="licenseType", visibility=["read", "create", "update", "delete", "query"] + ) + """License type. Known values are: \"NotSpecified\", \"NoLicenseType\", and \"WindowsServer\".""" + sql_server_license_type: Optional[Union[str, "_models.SqlServerLicenseType"]] = rest_field( + name="sqlServerLicenseType", visibility=["read", "create", "update", "delete", "query"] + ) + """The SQL Server license type. Known values are: \"NotSpecified\", \"NoLicenseType\", \"PAYG\", + and \"AHUB\".""" + linux_license_type: Optional[Union[str, "_models.LinuxLicenseType"]] = rest_field( + name="linuxLicenseType", visibility=["read", "create", "update", "delete", "query"] + ) + """The license type for Linux VM's. Known values are: \"NotSpecified\", \"NoLicenseType\", and + \"LinuxServer\".""" + perform_sql_bulk_registration: Optional[str] = rest_field( + name="performSqlBulkRegistration", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether bulk SQL RP registration to be done.""" + data_mover_run_as_account_id: str = rest_field( + name="dataMoverRunAsAccountId", visibility=["read", "create", "update", "delete", "query"] + ) + """The data mover run as account Id. Required.""" + snapshot_run_as_account_id: str = rest_field( + name="snapshotRunAsAccountId", visibility=["read", "create", "update", "delete", "query"] + ) + """The snapshot run as account Id. Required.""" + target_vm_name: Optional[str] = rest_field( + name="targetVmName", visibility=["read", "create", "update", "delete", "query"] + ) + """The target VM name.""" + target_vm_size: Optional[str] = rest_field( + name="targetVmSize", visibility=["read", "create", "update", "delete", "query"] + ) + """The target VM size.""" + target_resource_group_id: str = rest_field( + name="targetResourceGroupId", visibility=["read", "create", "update", "delete", "query"] + ) + """The target resource group ARM Id. Required.""" + target_network_id: str = rest_field( + name="targetNetworkId", visibility=["read", "create", "update", "delete", "query"] + ) + """The target network ARM Id. Required.""" + test_network_id: Optional[str] = rest_field( + name="testNetworkId", visibility=["read", "create", "update", "delete", "query"] + ) + """The selected test network ARM Id.""" + target_subnet_name: Optional[str] = rest_field( + name="targetSubnetName", visibility=["read", "create", "update", "delete", "query"] + ) + """The target subnet name.""" + test_subnet_name: Optional[str] = rest_field( + name="testSubnetName", visibility=["read", "create", "update", "delete", "query"] + ) + """The selected test subnet name.""" + target_availability_set_id: Optional[str] = rest_field( + name="targetAvailabilitySetId", visibility=["read", "create", "update", "delete", "query"] + ) + """The target availability set ARM Id.""" + target_availability_zone: Optional[str] = rest_field( + name="targetAvailabilityZone", visibility=["read", "create", "update", "delete", "query"] + ) + """The target availability zone.""" + target_proximity_placement_group_id: Optional[str] = rest_field( + name="targetProximityPlacementGroupId", visibility=["read", "create", "update", "delete", "query"] + ) + """The target proximity placement group ARM Id.""" + confidential_vm_key_vault_id: Optional[str] = rest_field( + name="confidentialVmKeyVaultId", visibility=["read", "create", "update", "delete", "query"] + ) + """The confidential VM key vault Id for ADE installation.""" + target_vm_security_profile: Optional["_models.VMwareCbtSecurityProfileProperties"] = rest_field( + name="targetVmSecurityProfile", visibility=["read", "create", "update", "delete", "query"] + ) + """The target VM security profile.""" + target_boot_diagnostics_storage_account_id: Optional[str] = rest_field( + name="targetBootDiagnosticsStorageAccountId", visibility=["read", "create", "update", "delete", "query"] + ) + """The target boot diagnostics storage account ARM Id.""" + perform_auto_resync: Optional[str] = rest_field( + name="performAutoResync", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether auto resync is to be done.""" + target_vm_tags: Optional[dict[str, str]] = rest_field( + name="targetVmTags", visibility=["read", "create", "update", "delete", "query"] + ) + """The target VM tags.""" + seed_disk_tags: Optional[dict[str, str]] = rest_field( + name="seedDiskTags", visibility=["read", "create", "update", "delete", "query"] + ) + """The tags for the seed disks.""" + target_disk_tags: Optional[dict[str, str]] = rest_field( + name="targetDiskTags", visibility=["read", "create", "update", "delete", "query"] + ) + """The tags for the target disks.""" + target_nic_tags: Optional[dict[str, str]] = rest_field( + name="targetNicTags", visibility=["read", "create", "update", "delete", "query"] + ) + """The tags for the target NICs.""" + user_selected_os_name: Optional[str] = rest_field( + name="userSelectedOSName", visibility=["read", "create", "update", "delete", "query"] + ) + """The OS name selected by user.""" + target_capacity_reservation_group_id: Optional[str] = rest_field( + name="targetCapacityReservationGroupId", visibility=["read", "create", "update", "delete", "query"] + ) + """The target capacity reservation group ARM Id.""" + instance_type: Literal["VMwareCbt"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The class type. Required. Default value is \"VMwareCbt\".""" + + @overload + def __init__( # pylint: disable=too-many-locals + self, + *, + vmware_machine_id: str, + disks_to_include: list["_models.VMwareCbtDiskInput"], + data_mover_run_as_account_id: str, + snapshot_run_as_account_id: str, + target_resource_group_id: str, + target_network_id: str, + license_type: Optional[Union[str, "_models.LicenseType"]] = None, + sql_server_license_type: Optional[Union[str, "_models.SqlServerLicenseType"]] = None, + linux_license_type: Optional[Union[str, "_models.LinuxLicenseType"]] = None, + perform_sql_bulk_registration: Optional[str] = None, + target_vm_name: Optional[str] = None, + target_vm_size: Optional[str] = None, + test_network_id: Optional[str] = None, + target_subnet_name: Optional[str] = None, + test_subnet_name: Optional[str] = None, + target_availability_set_id: Optional[str] = None, + target_availability_zone: Optional[str] = None, + target_proximity_placement_group_id: Optional[str] = None, + confidential_vm_key_vault_id: Optional[str] = None, + target_vm_security_profile: Optional["_models.VMwareCbtSecurityProfileProperties"] = None, + target_boot_diagnostics_storage_account_id: Optional[str] = None, + perform_auto_resync: Optional[str] = None, + target_vm_tags: Optional[dict[str, str]] = None, + seed_disk_tags: Optional[dict[str, str]] = None, + target_disk_tags: Optional[dict[str, str]] = None, + target_nic_tags: Optional[dict[str, str]] = None, + user_selected_os_name: Optional[str] = None, + target_capacity_reservation_group_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) + self.instance_type = "VMwareCbt" # type: ignore + + +class VMwareCbtEventDetails(EventProviderSpecificDetails, discriminator="VMwareCbt"): + """Event details for VMwareCbt provider. + + :ivar migration_item_name: The migration item name. + :vartype migration_item_name: str + :ivar instance_type: Gets the class type. Overridden in derived classes. Required. Default + value is "VMwareCbt". + :vartype instance_type: str + """ + + migration_item_name: Optional[str] = rest_field(name="migrationItemName", visibility=["read"]) + """The migration item name.""" + instance_type: Literal["VMwareCbt"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets the class type. Overridden in derived classes. Required. Default value is \"VMwareCbt\".""" + + @overload + def __init__( + self, + ) -> 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) + self.instance_type = "VMwareCbt" # type: ignore + + +class VMwareCbtMigrateInput(MigrateProviderSpecificInput, discriminator="VMwareCbt"): + """VMwareCbt specific migrate input. + + :ivar perform_shutdown: A value indicating whether VM is to be shutdown. Required. + :vartype perform_shutdown: str + :ivar os_upgrade_version: A value indicating the inplace OS Upgrade version. + :vartype os_upgrade_version: str + :ivar post_migration_steps: The managed run command script input. + :vartype post_migration_steps: + list[~azure.mgmt.recoveryservicessiterecovery.models.ManagedRunCommandScriptInput] + :ivar target_capacity_reservation_group_id: The target capacity reservation group ARM Id. + :vartype target_capacity_reservation_group_id: str + :ivar instance_type: The class type. Required. Default value is "VMwareCbt". + :vartype instance_type: str + """ + + perform_shutdown: str = rest_field( + name="performShutdown", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether VM is to be shutdown. Required.""" + os_upgrade_version: Optional[str] = rest_field( + name="osUpgradeVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating the inplace OS Upgrade version.""" + post_migration_steps: Optional[list["_models.ManagedRunCommandScriptInput"]] = rest_field( + name="postMigrationSteps", visibility=["read", "create", "update", "delete", "query"] + ) + """The managed run command script input.""" + target_capacity_reservation_group_id: Optional[str] = rest_field( + name="targetCapacityReservationGroupId", visibility=["read", "create", "update", "delete", "query"] + ) + """The target capacity reservation group ARM Id.""" + instance_type: Literal["VMwareCbt"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The class type. Required. Default value is \"VMwareCbt\".""" + + @overload + def __init__( + self, + *, + perform_shutdown: str, + os_upgrade_version: Optional[str] = None, + post_migration_steps: Optional[list["_models.ManagedRunCommandScriptInput"]] = None, + target_capacity_reservation_group_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) + self.instance_type = "VMwareCbt" # type: ignore + + +class VMwareCbtMigrationDetails(MigrationProviderSpecificSettings, discriminator="VMwareCbt"): + """VMwareCbt provider specific settings. + + :ivar vmware_machine_id: The ARM Id of the VM discovered in VMware. + :vartype vmware_machine_id: str + :ivar os_type: The type of the OS on the VM. + :vartype os_type: str + :ivar os_name: The name of the OS on the VM. + :vartype os_name: str + :ivar firmware_type: The firmware type. + :vartype firmware_type: str + :ivar target_generation: The target generation. + :vartype target_generation: str + :ivar license_type: License Type of the VM to be used. + :vartype license_type: str + :ivar sql_server_license_type: The SQL Server license type. + :vartype sql_server_license_type: str + :ivar linux_license_type: The license type for Linux VM's. Known values are: "NotSpecified", + "NoLicenseType", and "LinuxServer". + :vartype linux_license_type: str or + ~azure.mgmt.recoveryservicessiterecovery.models.LinuxLicenseType + :ivar data_mover_run_as_account_id: The data mover run as account Id. + :vartype data_mover_run_as_account_id: str + :ivar snapshot_run_as_account_id: The snapshot run as account Id. + :vartype snapshot_run_as_account_id: str + :ivar storage_account_id: The replication storage account ARM Id. This is applicable only for + the blob based replication test hook. + :vartype storage_account_id: str + :ivar target_vm_name: Target VM name. + :vartype target_vm_name: str + :ivar target_vm_size: The target VM size. + :vartype target_vm_size: str + :ivar target_location: The target location. + :vartype target_location: str + :ivar target_resource_group_id: The target resource group Id. + :vartype target_resource_group_id: str + :ivar target_availability_set_id: The target availability set Id. + :vartype target_availability_set_id: str + :ivar target_availability_zone: The target availability zone. + :vartype target_availability_zone: str + :ivar target_proximity_placement_group_id: The target proximity placement group Id. + :vartype target_proximity_placement_group_id: str + :ivar confidential_vm_key_vault_id: The confidential VM key vault Id for ADE installation. + :vartype confidential_vm_key_vault_id: str + :ivar target_vm_security_profile: The target VM security profile. + :vartype target_vm_security_profile: + ~azure.mgmt.recoveryservicessiterecovery.models.VMwareCbtSecurityProfileProperties + :ivar target_boot_diagnostics_storage_account_id: The target boot diagnostics storage account + ARM Id. + :vartype target_boot_diagnostics_storage_account_id: str + :ivar target_vm_tags: The target VM tags. + :vartype target_vm_tags: dict[str, str] + :ivar protected_disks: The list of protected disks. + :vartype protected_disks: + list[~azure.mgmt.recoveryservicessiterecovery.models.VMwareCbtProtectedDiskDetails] + :ivar target_network_id: The target network Id. + :vartype target_network_id: str + :ivar test_network_id: The test network Id. + :vartype test_network_id: str + :ivar vm_nics: The network details. + :vartype vm_nics: list[~azure.mgmt.recoveryservicessiterecovery.models.VMwareCbtNicDetails] + :ivar target_nic_tags: The tags for the target NICs. + :vartype target_nic_tags: dict[str, str] + :ivar migration_recovery_point_id: The recovery point Id to which the VM was migrated. + :vartype migration_recovery_point_id: str + :ivar last_recovery_point_received: The last recovery point received time. + :vartype last_recovery_point_received: ~datetime.datetime + :ivar last_recovery_point_id: The last recovery point Id. + :vartype last_recovery_point_id: str + :ivar initial_seeding_progress_percentage: The initial seeding progress percentage. + :vartype initial_seeding_progress_percentage: int + :ivar migration_progress_percentage: The migration progress percentage. + :vartype migration_progress_percentage: int + :ivar resync_progress_percentage: The resync progress percentage. + :vartype resync_progress_percentage: int + :ivar resume_progress_percentage: The resume progress percentage. + :vartype resume_progress_percentage: int + :ivar delta_sync_progress_percentage: The delta sync progress percentage. + :vartype delta_sync_progress_percentage: int + :ivar is_check_sum_resync_cycle: A value indicating whether checksum resync cycle is in + progress. + :vartype is_check_sum_resync_cycle: str + :ivar initial_seeding_retry_count: The initial seeding retry count. + :vartype initial_seeding_retry_count: int + :ivar resync_retry_count: The resync retry count. + :vartype resync_retry_count: int + :ivar resume_retry_count: The resume retry count. + :vartype resume_retry_count: int + :ivar delta_sync_retry_count: The delta sync retry count. + :vartype delta_sync_retry_count: int + :ivar resync_required: A value indicating whether resync is required. + :vartype resync_required: str + :ivar resync_state: The resync state. Known values are: "None", "PreparedForResynchronization", + and "StartedResynchronization". + :vartype resync_state: str or ~azure.mgmt.recoveryservicessiterecovery.models.ResyncState + :ivar perform_auto_resync: A value indicating whether auto resync is to be done. + :vartype perform_auto_resync: str + :ivar seed_disk_tags: The tags for the seed disks. + :vartype seed_disk_tags: dict[str, str] + :ivar target_disk_tags: The tags for the target disks. + :vartype target_disk_tags: dict[str, str] + :ivar supported_os_versions: A value indicating the inplace OS Upgrade version. + :vartype supported_os_versions: list[str] + :ivar appliance_monitoring_details: A value indicating the appliance monitoring details. + :vartype appliance_monitoring_details: + ~azure.mgmt.recoveryservicessiterecovery.models.ApplianceMonitoringDetails + :ivar gateway_operation_details: A value indicating the gateway operation details. + :vartype gateway_operation_details: + ~azure.mgmt.recoveryservicessiterecovery.models.GatewayOperationDetails + :ivar operation_name: A value indicating the SRS operation name. + :vartype operation_name: str + :ivar target_capacity_reservation_group_id: The target capacity reservation group ARM Id. + :vartype target_capacity_reservation_group_id: str + :ivar instance_type: Gets the instance type. Required. Default value is "VMwareCbt". + :vartype instance_type: str + """ + + vmware_machine_id: Optional[str] = rest_field(name="vmwareMachineId", visibility=["read"]) + """The ARM Id of the VM discovered in VMware.""" + os_type: Optional[str] = rest_field(name="osType", visibility=["read"]) + """The type of the OS on the VM.""" + os_name: Optional[str] = rest_field(name="osName", visibility=["read"]) + """The name of the OS on the VM.""" + firmware_type: Optional[str] = rest_field(name="firmwareType", visibility=["read"]) + """The firmware type.""" + target_generation: Optional[str] = rest_field(name="targetGeneration", visibility=["read"]) + """The target generation.""" + license_type: Optional[str] = rest_field( + name="licenseType", visibility=["read", "create", "update", "delete", "query"] + ) + """License Type of the VM to be used.""" + sql_server_license_type: Optional[str] = rest_field( + name="sqlServerLicenseType", visibility=["read", "create", "update", "delete", "query"] + ) + """The SQL Server license type.""" + linux_license_type: Optional[Union[str, "_models.LinuxLicenseType"]] = rest_field( + name="linuxLicenseType", visibility=["read", "create", "update", "delete", "query"] + ) + """The license type for Linux VM's. Known values are: \"NotSpecified\", \"NoLicenseType\", and + \"LinuxServer\".""" + data_mover_run_as_account_id: Optional[str] = rest_field(name="dataMoverRunAsAccountId", visibility=["read"]) + """The data mover run as account Id.""" + snapshot_run_as_account_id: Optional[str] = rest_field(name="snapshotRunAsAccountId", visibility=["read"]) + """The snapshot run as account Id.""" + storage_account_id: Optional[str] = rest_field(name="storageAccountId", visibility=["read"]) + """The replication storage account ARM Id. This is applicable only for the blob based replication + test hook.""" + target_vm_name: Optional[str] = rest_field( + name="targetVmName", visibility=["read", "create", "update", "delete", "query"] + ) + """Target VM name.""" + target_vm_size: Optional[str] = rest_field( + name="targetVmSize", visibility=["read", "create", "update", "delete", "query"] + ) + """The target VM size.""" + target_location: Optional[str] = rest_field(name="targetLocation", visibility=["read"]) + """The target location.""" + target_resource_group_id: Optional[str] = rest_field( + name="targetResourceGroupId", visibility=["read", "create", "update", "delete", "query"] + ) + """The target resource group Id.""" + target_availability_set_id: Optional[str] = rest_field( + name="targetAvailabilitySetId", visibility=["read", "create", "update", "delete", "query"] + ) + """The target availability set Id.""" + target_availability_zone: Optional[str] = rest_field( + name="targetAvailabilityZone", visibility=["read", "create", "update", "delete", "query"] + ) + """The target availability zone.""" + target_proximity_placement_group_id: Optional[str] = rest_field( + name="targetProximityPlacementGroupId", visibility=["read", "create", "update", "delete", "query"] + ) + """The target proximity placement group Id.""" + confidential_vm_key_vault_id: Optional[str] = rest_field( + name="confidentialVmKeyVaultId", visibility=["read", "create", "update", "delete", "query"] + ) + """The confidential VM key vault Id for ADE installation.""" + target_vm_security_profile: Optional["_models.VMwareCbtSecurityProfileProperties"] = rest_field( + name="targetVmSecurityProfile", visibility=["read", "create", "update", "delete", "query"] + ) + """The target VM security profile.""" + target_boot_diagnostics_storage_account_id: Optional[str] = rest_field( + name="targetBootDiagnosticsStorageAccountId", visibility=["read", "create", "update", "delete", "query"] + ) + """The target boot diagnostics storage account ARM Id.""" + target_vm_tags: Optional[dict[str, str]] = rest_field( + name="targetVmTags", visibility=["read", "create", "update", "delete", "query"] + ) + """The target VM tags.""" + protected_disks: Optional[list["_models.VMwareCbtProtectedDiskDetails"]] = rest_field( + name="protectedDisks", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of protected disks.""" + target_network_id: Optional[str] = rest_field( + name="targetNetworkId", visibility=["read", "create", "update", "delete", "query"] + ) + """The target network Id.""" + test_network_id: Optional[str] = rest_field( + name="testNetworkId", visibility=["read", "create", "update", "delete", "query"] + ) + """The test network Id.""" + vm_nics: Optional[list["_models.VMwareCbtNicDetails"]] = rest_field( + name="vmNics", visibility=["read", "create", "update", "delete", "query"] + ) + """The network details.""" + target_nic_tags: Optional[dict[str, str]] = rest_field( + name="targetNicTags", visibility=["read", "create", "update", "delete", "query"] + ) + """The tags for the target NICs.""" + migration_recovery_point_id: Optional[str] = rest_field(name="migrationRecoveryPointId", visibility=["read"]) + """The recovery point Id to which the VM was migrated.""" + last_recovery_point_received: Optional[datetime.datetime] = rest_field( + name="lastRecoveryPointReceived", visibility=["read"], format="rfc3339" + ) + """The last recovery point received time.""" + last_recovery_point_id: Optional[str] = rest_field(name="lastRecoveryPointId", visibility=["read"]) + """The last recovery point Id.""" + initial_seeding_progress_percentage: Optional[int] = rest_field( + name="initialSeedingProgressPercentage", visibility=["read"] + ) + """The initial seeding progress percentage.""" + migration_progress_percentage: Optional[int] = rest_field(name="migrationProgressPercentage", visibility=["read"]) + """The migration progress percentage.""" + resync_progress_percentage: Optional[int] = rest_field(name="resyncProgressPercentage", visibility=["read"]) + """The resync progress percentage.""" + resume_progress_percentage: Optional[int] = rest_field(name="resumeProgressPercentage", visibility=["read"]) + """The resume progress percentage.""" + delta_sync_progress_percentage: Optional[int] = rest_field(name="deltaSyncProgressPercentage", visibility=["read"]) + """The delta sync progress percentage.""" + is_check_sum_resync_cycle: Optional[str] = rest_field(name="isCheckSumResyncCycle", visibility=["read"]) + """A value indicating whether checksum resync cycle is in progress.""" + initial_seeding_retry_count: Optional[int] = rest_field(name="initialSeedingRetryCount", visibility=["read"]) + """The initial seeding retry count.""" + resync_retry_count: Optional[int] = rest_field(name="resyncRetryCount", visibility=["read"]) + """The resync retry count.""" + resume_retry_count: Optional[int] = rest_field(name="resumeRetryCount", visibility=["read"]) + """The resume retry count.""" + delta_sync_retry_count: Optional[int] = rest_field(name="deltaSyncRetryCount", visibility=["read"]) + """The delta sync retry count.""" + resync_required: Optional[str] = rest_field(name="resyncRequired", visibility=["read"]) + """A value indicating whether resync is required.""" + resync_state: Optional[Union[str, "_models.ResyncState"]] = rest_field(name="resyncState", visibility=["read"]) + """The resync state. Known values are: \"None\", \"PreparedForResynchronization\", and + \"StartedResynchronization\".""" + perform_auto_resync: Optional[str] = rest_field( + name="performAutoResync", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether auto resync is to be done.""" + seed_disk_tags: Optional[dict[str, str]] = rest_field( + name="seedDiskTags", visibility=["read", "create", "update", "delete", "query"] + ) + """The tags for the seed disks.""" + target_disk_tags: Optional[dict[str, str]] = rest_field( + name="targetDiskTags", visibility=["read", "create", "update", "delete", "query"] + ) + """The tags for the target disks.""" + supported_os_versions: Optional[list[str]] = rest_field( + name="supportedOSVersions", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating the inplace OS Upgrade version.""" + appliance_monitoring_details: Optional["_models.ApplianceMonitoringDetails"] = rest_field( + name="applianceMonitoringDetails", visibility=["read"] + ) + """A value indicating the appliance monitoring details.""" + gateway_operation_details: Optional["_models.GatewayOperationDetails"] = rest_field( + name="gatewayOperationDetails", visibility=["read"] + ) + """A value indicating the gateway operation details.""" + operation_name: Optional[str] = rest_field(name="operationName", visibility=["read"]) + """A value indicating the SRS operation name.""" + target_capacity_reservation_group_id: Optional[str] = rest_field( + name="targetCapacityReservationGroupId", visibility=["read", "create", "update", "delete", "query"] + ) + """The target capacity reservation group ARM Id.""" + instance_type: Literal["VMwareCbt"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets the instance type. Required. Default value is \"VMwareCbt\".""" + + @overload + def __init__( # pylint: disable=too-many-locals + self, + *, + license_type: Optional[str] = None, + sql_server_license_type: Optional[str] = None, + linux_license_type: Optional[Union[str, "_models.LinuxLicenseType"]] = None, + target_vm_name: Optional[str] = None, + target_vm_size: Optional[str] = None, + target_resource_group_id: Optional[str] = None, + target_availability_set_id: Optional[str] = None, + target_availability_zone: Optional[str] = None, + target_proximity_placement_group_id: Optional[str] = None, + confidential_vm_key_vault_id: Optional[str] = None, + target_vm_security_profile: Optional["_models.VMwareCbtSecurityProfileProperties"] = None, + target_boot_diagnostics_storage_account_id: Optional[str] = None, + target_vm_tags: Optional[dict[str, str]] = None, + protected_disks: Optional[list["_models.VMwareCbtProtectedDiskDetails"]] = None, + target_network_id: Optional[str] = None, + test_network_id: Optional[str] = None, + vm_nics: Optional[list["_models.VMwareCbtNicDetails"]] = None, + target_nic_tags: Optional[dict[str, str]] = None, + perform_auto_resync: Optional[str] = None, + seed_disk_tags: Optional[dict[str, str]] = None, + target_disk_tags: Optional[dict[str, str]] = None, + supported_os_versions: Optional[list[str]] = None, + target_capacity_reservation_group_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) + self.instance_type = "VMwareCbt" # type: ignore + + +class VMwareCbtNicDetails(_Model): + """VMwareCbt NIC details. + + :ivar nic_id: The NIC Id. + :vartype nic_id: str + :ivar is_primary_nic: A value indicating whether this is the primary NIC. + :vartype is_primary_nic: str + :ivar source_ip_address: The source IP address. + :vartype source_ip_address: str + :ivar source_ip_address_type: The source IP address type. Known values are: "Dynamic" and + "Static". + :vartype source_ip_address_type: str or + ~azure.mgmt.recoveryservicessiterecovery.models.EthernetAddressType + :ivar source_network_id: Source network Id. + :vartype source_network_id: str + :ivar target_ip_address: The target IP address. + :vartype target_ip_address: str + :ivar target_ip_address_type: The target IP address type. Known values are: "Dynamic" and + "Static". + :vartype target_ip_address_type: str or + ~azure.mgmt.recoveryservicessiterecovery.models.EthernetAddressType + :ivar target_subnet_name: Target subnet name. + :vartype target_subnet_name: str + :ivar test_network_id: Source network Id. + :vartype test_network_id: str + :ivar test_subnet_name: Test subnet name. + :vartype test_subnet_name: str + :ivar test_ip_address: The test IP address. + :vartype test_ip_address: str + :ivar test_ip_address_type: The test IP address type. Known values are: "Dynamic" and "Static". + :vartype test_ip_address_type: str or + ~azure.mgmt.recoveryservicessiterecovery.models.EthernetAddressType + :ivar target_nic_name: Target NIC name. + :vartype target_nic_name: str + :ivar is_selected_for_migration: A value indicating whether this NIC is selected for migration. + :vartype is_selected_for_migration: str + """ + + nic_id: Optional[str] = rest_field(name="nicId", visibility=["read"]) + """The NIC Id.""" + is_primary_nic: Optional[str] = rest_field( + name="isPrimaryNic", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether this is the primary NIC.""" + source_ip_address: Optional[str] = rest_field(name="sourceIPAddress", visibility=["read"]) + """The source IP address.""" + source_ip_address_type: Optional[Union[str, "_models.EthernetAddressType"]] = rest_field( + name="sourceIPAddressType", visibility=["read"] + ) + """The source IP address type. Known values are: \"Dynamic\" and \"Static\".""" + source_network_id: Optional[str] = rest_field(name="sourceNetworkId", visibility=["read"]) + """Source network Id.""" + target_ip_address: Optional[str] = rest_field( + name="targetIPAddress", visibility=["read", "create", "update", "delete", "query"] + ) + """The target IP address.""" + target_ip_address_type: Optional[Union[str, "_models.EthernetAddressType"]] = rest_field( + name="targetIPAddressType", visibility=["read", "create", "update", "delete", "query"] + ) + """The target IP address type. Known values are: \"Dynamic\" and \"Static\".""" + target_subnet_name: Optional[str] = rest_field( + name="targetSubnetName", visibility=["read", "create", "update", "delete", "query"] + ) + """Target subnet name.""" + test_network_id: Optional[str] = rest_field( + name="testNetworkId", visibility=["read", "create", "update", "delete", "query"] + ) + """Source network Id.""" + test_subnet_name: Optional[str] = rest_field( + name="testSubnetName", visibility=["read", "create", "update", "delete", "query"] + ) + """Test subnet name.""" + test_ip_address: Optional[str] = rest_field( + name="testIPAddress", visibility=["read", "create", "update", "delete", "query"] + ) + """The test IP address.""" + test_ip_address_type: Optional[Union[str, "_models.EthernetAddressType"]] = rest_field( + name="testIPAddressType", visibility=["read", "create", "update", "delete", "query"] + ) + """The test IP address type. Known values are: \"Dynamic\" and \"Static\".""" + target_nic_name: Optional[str] = rest_field( + name="targetNicName", visibility=["read", "create", "update", "delete", "query"] + ) + """Target NIC name.""" + is_selected_for_migration: Optional[str] = rest_field( + name="isSelectedForMigration", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether this NIC is selected for migration.""" + + @overload + def __init__( + self, + *, + is_primary_nic: Optional[str] = None, + target_ip_address: Optional[str] = None, + target_ip_address_type: Optional[Union[str, "_models.EthernetAddressType"]] = None, + target_subnet_name: Optional[str] = None, + test_network_id: Optional[str] = None, + test_subnet_name: Optional[str] = None, + test_ip_address: Optional[str] = None, + test_ip_address_type: Optional[Union[str, "_models.EthernetAddressType"]] = None, + target_nic_name: Optional[str] = None, + is_selected_for_migration: 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 VMwareCbtNicInput(_Model): + """VMwareCbt NIC input. + + :ivar nic_id: The NIC Id. Required. + :vartype nic_id: str + :ivar is_primary_nic: A value indicating whether this is the primary NIC. Required. + :vartype is_primary_nic: str + :ivar target_subnet_name: Target subnet name. + :vartype target_subnet_name: str + :ivar target_static_ip_address: The static IP address. + :vartype target_static_ip_address: str + :ivar is_selected_for_migration: A value indicating whether this NIC is selected for migration. + :vartype is_selected_for_migration: str + :ivar target_nic_name: Target NIC name. + :vartype target_nic_name: str + :ivar test_subnet_name: The test subnet name. + :vartype test_subnet_name: str + :ivar test_static_ip_address: The test static IP address. + :vartype test_static_ip_address: str + """ + + nic_id: str = rest_field(name="nicId", visibility=["read", "create", "update", "delete", "query"]) + """The NIC Id. Required.""" + is_primary_nic: str = rest_field(name="isPrimaryNic", visibility=["read", "create", "update", "delete", "query"]) + """A value indicating whether this is the primary NIC. Required.""" + target_subnet_name: Optional[str] = rest_field( + name="targetSubnetName", visibility=["read", "create", "update", "delete", "query"] + ) + """Target subnet name.""" + target_static_ip_address: Optional[str] = rest_field( + name="targetStaticIPAddress", visibility=["read", "create", "update", "delete", "query"] + ) + """The static IP address.""" + is_selected_for_migration: Optional[str] = rest_field( + name="isSelectedForMigration", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether this NIC is selected for migration.""" + target_nic_name: Optional[str] = rest_field( + name="targetNicName", visibility=["read", "create", "update", "delete", "query"] + ) + """Target NIC name.""" + test_subnet_name: Optional[str] = rest_field( + name="testSubnetName", visibility=["read", "create", "update", "delete", "query"] + ) + """The test subnet name.""" + test_static_ip_address: Optional[str] = rest_field( + name="testStaticIPAddress", visibility=["read", "create", "update", "delete", "query"] + ) + """The test static IP address.""" + + @overload + def __init__( + self, + *, + nic_id: str, + is_primary_nic: str, + target_subnet_name: Optional[str] = None, + target_static_ip_address: Optional[str] = None, + is_selected_for_migration: Optional[str] = None, + target_nic_name: Optional[str] = None, + test_subnet_name: Optional[str] = None, + test_static_ip_address: 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 VMwareCbtPolicyCreationInput(PolicyProviderSpecificInput, discriminator="VMwareCbt"): + """VMware Cbt policy creation input. + + :ivar recovery_point_history_in_minutes: The duration in minutes until which the recovery + points need to be stored. + :vartype recovery_point_history_in_minutes: int + :ivar crash_consistent_frequency_in_minutes: The crash consistent snapshot frequency (in + minutes). + :vartype crash_consistent_frequency_in_minutes: int + :ivar app_consistent_frequency_in_minutes: The app consistent snapshot frequency (in minutes). + :vartype app_consistent_frequency_in_minutes: int + :ivar instance_type: The class type. Required. Default value is "VMwareCbt". + :vartype instance_type: str + """ + + recovery_point_history_in_minutes: Optional[int] = rest_field( + name="recoveryPointHistoryInMinutes", visibility=["read", "create", "update", "delete", "query"] + ) + """The duration in minutes until which the recovery points need to be stored.""" + crash_consistent_frequency_in_minutes: Optional[int] = rest_field( + name="crashConsistentFrequencyInMinutes", visibility=["read", "create", "update", "delete", "query"] + ) + """The crash consistent snapshot frequency (in minutes).""" + app_consistent_frequency_in_minutes: Optional[int] = rest_field( + name="appConsistentFrequencyInMinutes", visibility=["read", "create", "update", "delete", "query"] + ) + """The app consistent snapshot frequency (in minutes).""" + instance_type: Literal["VMwareCbt"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The class type. Required. Default value is \"VMwareCbt\".""" + + @overload + def __init__( + self, + *, + recovery_point_history_in_minutes: Optional[int] = None, + crash_consistent_frequency_in_minutes: Optional[int] = None, + app_consistent_frequency_in_minutes: 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) + self.instance_type = "VMwareCbt" # type: ignore + + +class VmwareCbtPolicyDetails(PolicyProviderSpecificDetails, discriminator="VMwareCbt"): + """VMware Cbt specific policy details. + + :ivar recovery_point_history_in_minutes: The duration in minutes until which the recovery + points need to be stored. + :vartype recovery_point_history_in_minutes: int + :ivar app_consistent_frequency_in_minutes: The app consistent snapshot frequency in minutes. + :vartype app_consistent_frequency_in_minutes: int + :ivar crash_consistent_frequency_in_minutes: The crash consistent snapshot frequency in + minutes. + :vartype crash_consistent_frequency_in_minutes: int + :ivar instance_type: Gets the class type. Overridden in derived classes. Required. Default + value is "VMwareCbt". + :vartype instance_type: str + """ + + recovery_point_history_in_minutes: Optional[int] = rest_field( + name="recoveryPointHistoryInMinutes", visibility=["read", "create", "update", "delete", "query"] + ) + """The duration in minutes until which the recovery points need to be stored.""" + app_consistent_frequency_in_minutes: Optional[int] = rest_field( + name="appConsistentFrequencyInMinutes", visibility=["read", "create", "update", "delete", "query"] + ) + """The app consistent snapshot frequency in minutes.""" + crash_consistent_frequency_in_minutes: Optional[int] = rest_field( + name="crashConsistentFrequencyInMinutes", visibility=["read", "create", "update", "delete", "query"] + ) + """The crash consistent snapshot frequency in minutes.""" + instance_type: Literal["VMwareCbt"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets the class type. Overridden in derived classes. Required. Default value is \"VMwareCbt\".""" + + @overload + def __init__( + self, + *, + recovery_point_history_in_minutes: Optional[int] = None, + app_consistent_frequency_in_minutes: Optional[int] = None, + crash_consistent_frequency_in_minutes: 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) + self.instance_type = "VMwareCbt" # type: ignore + + +class VMwareCbtProtectedDiskDetails(_Model): + """VMwareCbt protected disk details. + + :ivar disk_id: The disk id. + :vartype disk_id: str + :ivar disk_name: The disk name. + :vartype disk_name: str + :ivar disk_type: The disk type. Known values are: "Standard_LRS", "Premium_LRS", + "StandardSSD_LRS", "PremiumV2_LRS", "UltraSSD_LRS", "StandardSSD_ZRS", and "Premium_ZRS". + :vartype disk_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.DiskAccountType + :ivar disk_path: The disk path. + :vartype disk_path: str + :ivar is_os_disk: A value indicating whether the disk is the OS disk. + :vartype is_os_disk: str + :ivar capacity_in_bytes: The disk capacity in bytes. + :vartype capacity_in_bytes: int + :ivar log_storage_account_id: The log storage account ARM Id. + :vartype log_storage_account_id: str + :ivar log_storage_account_sas_secret_name: The key vault secret name of the log storage + account. + :vartype log_storage_account_sas_secret_name: str + :ivar disk_encryption_set_id: The DiskEncryptionSet ARM Id. + :vartype disk_encryption_set_id: str + :ivar seed_managed_disk_id: The ARM Id of the seed managed disk. + :vartype seed_managed_disk_id: str + :ivar seed_blob_uri: The uri of the seed blob. + :vartype seed_blob_uri: str + :ivar target_managed_disk_id: The ARM Id of the target managed disk. + :vartype target_managed_disk_id: str + :ivar target_blob_uri: The uri of the target blob. + :vartype target_blob_uri: str + :ivar target_disk_name: The name for the target managed disk. + :vartype target_disk_name: str + :ivar gateway_operation_details: A value indicating the gateway operation details. + :vartype gateway_operation_details: + ~azure.mgmt.recoveryservicessiterecovery.models.GatewayOperationDetails + :ivar sector_size_in_bytes: The logical sector size (in bytes), 512 by default. + :vartype sector_size_in_bytes: int + :ivar iops: The number of IOPS allowed for Premium V2 and Ultra disks. + :vartype iops: int + :ivar throughput_in_mbps: The total throughput in Mbps for Premium V2 and Ultra disks. + :vartype throughput_in_mbps: int + :ivar disk_size_in_gb: The target disk size in GB. + :vartype disk_size_in_gb: int + """ + + disk_id: Optional[str] = rest_field(name="diskId", visibility=["read"]) + """The disk id.""" + disk_name: Optional[str] = rest_field(name="diskName", visibility=["read"]) + """The disk name.""" + disk_type: Optional[Union[str, "_models.DiskAccountType"]] = rest_field( + name="diskType", visibility=["read", "create", "update", "delete", "query"] + ) + """The disk type. Known values are: \"Standard_LRS\", \"Premium_LRS\", \"StandardSSD_LRS\", + \"PremiumV2_LRS\", \"UltraSSD_LRS\", \"StandardSSD_ZRS\", and \"Premium_ZRS\".""" + disk_path: Optional[str] = rest_field(name="diskPath", visibility=["read"]) + """The disk path.""" + is_os_disk: Optional[str] = rest_field(name="isOSDisk", visibility=["read"]) + """A value indicating whether the disk is the OS disk.""" + capacity_in_bytes: Optional[int] = rest_field(name="capacityInBytes", visibility=["read"]) + """The disk capacity in bytes.""" + log_storage_account_id: Optional[str] = rest_field(name="logStorageAccountId", visibility=["read"]) + """The log storage account ARM Id.""" + log_storage_account_sas_secret_name: Optional[str] = rest_field( + name="logStorageAccountSasSecretName", visibility=["read"] + ) + """The key vault secret name of the log storage account.""" + disk_encryption_set_id: Optional[str] = rest_field(name="diskEncryptionSetId", visibility=["read"]) + """The DiskEncryptionSet ARM Id.""" + seed_managed_disk_id: Optional[str] = rest_field(name="seedManagedDiskId", visibility=["read"]) + """The ARM Id of the seed managed disk.""" + seed_blob_uri: Optional[str] = rest_field(name="seedBlobUri", visibility=["read"]) + """The uri of the seed blob.""" + target_managed_disk_id: Optional[str] = rest_field(name="targetManagedDiskId", visibility=["read"]) + """The ARM Id of the target managed disk.""" + target_blob_uri: Optional[str] = rest_field(name="targetBlobUri", visibility=["read"]) + """The uri of the target blob.""" + target_disk_name: Optional[str] = rest_field( + name="targetDiskName", visibility=["read", "create", "update", "delete", "query"] + ) + """The name for the target managed disk.""" + gateway_operation_details: Optional["_models.GatewayOperationDetails"] = rest_field( + name="gatewayOperationDetails", visibility=["read"] + ) + """A value indicating the gateway operation details.""" + sector_size_in_bytes: Optional[int] = rest_field( + name="sectorSizeInBytes", visibility=["read", "create", "update", "delete", "query"] + ) + """The logical sector size (in bytes), 512 by default.""" + iops: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The number of IOPS allowed for Premium V2 and Ultra disks.""" + throughput_in_mbps: Optional[int] = rest_field( + name="throughputInMbps", visibility=["read", "create", "update", "delete", "query"] + ) + """The total throughput in Mbps for Premium V2 and Ultra disks.""" + disk_size_in_gb: Optional[int] = rest_field( + name="diskSizeInGB", visibility=["read", "create", "update", "delete", "query"] + ) + """The target disk size in GB.""" + + @overload + def __init__( + self, + *, + disk_type: Optional[Union[str, "_models.DiskAccountType"]] = None, + target_disk_name: Optional[str] = None, + sector_size_in_bytes: Optional[int] = None, + iops: Optional[int] = None, + throughput_in_mbps: Optional[int] = None, + disk_size_in_gb: 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 VMwareCbtProtectionContainerMappingDetails( + ProtectionContainerMappingProviderSpecificDetails, discriminator="VMwareCbt" +): # pylint: disable=name-too-long + """VMwareCbt provider specific container mapping details. + + :ivar key_vault_id: The target key vault ARM Id. + :vartype key_vault_id: str + :ivar key_vault_uri: The target key vault URI. + :vartype key_vault_uri: str + :ivar storage_account_id: The storage account ARM Id. + :vartype storage_account_id: str + :ivar storage_account_sas_secret_name: The secret name of the storage account. + :vartype storage_account_sas_secret_name: str + :ivar service_bus_connection_string_secret_name: The secret name of the service bus connection + string. + :vartype service_bus_connection_string_secret_name: str + :ivar target_location: The target location. + :vartype target_location: str + :ivar role_size_to_nic_count_map: The role size to NIC count map. + :vartype role_size_to_nic_count_map: dict[str, int] + :ivar excluded_skus: The SKUs to be excluded. + :vartype excluded_skus: list[str] + :ivar instance_type: Gets the class type. Overridden in derived classes. Required. Default + value is "VMwareCbt". + :vartype instance_type: str + """ + + key_vault_id: Optional[str] = rest_field(name="keyVaultId", visibility=["read"]) + """The target key vault ARM Id.""" + key_vault_uri: Optional[str] = rest_field(name="keyVaultUri", visibility=["read"]) + """The target key vault URI.""" + storage_account_id: Optional[str] = rest_field(name="storageAccountId", visibility=["read"]) + """The storage account ARM Id.""" + storage_account_sas_secret_name: Optional[str] = rest_field(name="storageAccountSasSecretName", visibility=["read"]) + """The secret name of the storage account.""" + service_bus_connection_string_secret_name: Optional[str] = rest_field( + name="serviceBusConnectionStringSecretName", visibility=["read"] + ) + """The secret name of the service bus connection string.""" + target_location: Optional[str] = rest_field(name="targetLocation", visibility=["read"]) + """The target location.""" + role_size_to_nic_count_map: Optional[dict[str, int]] = rest_field(name="roleSizeToNicCountMap", visibility=["read"]) + """The role size to NIC count map.""" + excluded_skus: Optional[list[str]] = rest_field( + name="excludedSkus", visibility=["read", "create", "update", "delete", "query"] + ) + """The SKUs to be excluded.""" + instance_type: Literal["VMwareCbt"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets the class type. Overridden in derived classes. Required. Default value is \"VMwareCbt\".""" + + @overload + def __init__( + self, + *, + excluded_skus: 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) + self.instance_type = "VMwareCbt" # type: ignore + + +class VMwareCbtResumeReplicationInput(ResumeReplicationProviderSpecificInput, discriminator="VMwareCbt"): + """VMwareCbt specific resume replication input. + + :ivar delete_migration_resources: A value indicating whether Migration resources to be deleted. + :vartype delete_migration_resources: str + :ivar instance_type: The class type. Required. Default value is "VMwareCbt". + :vartype instance_type: str + """ + + delete_migration_resources: Optional[str] = rest_field( + name="deleteMigrationResources", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether Migration resources to be deleted.""" + instance_type: Literal["VMwareCbt"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The class type. Required. Default value is \"VMwareCbt\".""" + + @overload + def __init__( + self, + *, + delete_migration_resources: 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) + self.instance_type = "VMwareCbt" # type: ignore + + +class VMwareCbtResyncInput(ResyncProviderSpecificInput, discriminator="VMwareCbt"): + """VMwareCbt specific resync input. + + :ivar skip_cbt_reset: A value indicating whether CBT is to be reset. Required. + :vartype skip_cbt_reset: str + :ivar instance_type: The class type. Required. Default value is "VMwareCbt". + :vartype instance_type: str + """ + + skip_cbt_reset: str = rest_field(name="skipCbtReset", visibility=["read", "create", "update", "delete", "query"]) + """A value indicating whether CBT is to be reset. Required.""" + instance_type: Literal["VMwareCbt"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The class type. Required. Default value is \"VMwareCbt\".""" + + @overload + def __init__( + self, + *, + skip_cbt_reset: str, + ) -> 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) + self.instance_type = "VMwareCbt" # type: ignore + + +class VMwareCbtSecurityProfileProperties(_Model): + """VMwareCbt security profile input. + + :ivar target_vm_security_type: The target VM security type. Known values are: "None", + "TrustedLaunch", and "ConfidentialVM". + :vartype target_vm_security_type: str or + ~azure.mgmt.recoveryservicessiterecovery.models.SecurityType + :ivar is_target_vm_secure_boot_enabled: A value indicating whether secure boot to be enabled. + :vartype is_target_vm_secure_boot_enabled: str + :ivar is_target_vm_tpm_enabled: A value indicating whether trusted platform module to be + enabled. + :vartype is_target_vm_tpm_enabled: str + :ivar is_target_vm_integrity_monitoring_enabled: A value indicating whether integrity + monitoring to be enabled. + :vartype is_target_vm_integrity_monitoring_enabled: str + :ivar is_target_vm_confidential_encryption_enabled: A value indicating whether confidential + compute encryption to be enabled. + :vartype is_target_vm_confidential_encryption_enabled: str + """ + + target_vm_security_type: Optional[Union[str, "_models.SecurityType"]] = rest_field( + name="targetVmSecurityType", visibility=["read", "create", "update", "delete", "query"] + ) + """The target VM security type. Known values are: \"None\", \"TrustedLaunch\", and + \"ConfidentialVM\".""" + is_target_vm_secure_boot_enabled: Optional[str] = rest_field( + name="isTargetVmSecureBootEnabled", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether secure boot to be enabled.""" + is_target_vm_tpm_enabled: Optional[str] = rest_field( + name="isTargetVmTpmEnabled", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether trusted platform module to be enabled.""" + is_target_vm_integrity_monitoring_enabled: Optional[str] = rest_field( + name="isTargetVmIntegrityMonitoringEnabled", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether integrity monitoring to be enabled.""" + is_target_vm_confidential_encryption_enabled: Optional[str] = rest_field( + name="isTargetVmConfidentialEncryptionEnabled", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether confidential compute encryption to be enabled.""" + + @overload + def __init__( + self, + *, + target_vm_security_type: Optional[Union[str, "_models.SecurityType"]] = None, + is_target_vm_secure_boot_enabled: Optional[str] = None, + is_target_vm_tpm_enabled: Optional[str] = None, + is_target_vm_integrity_monitoring_enabled: Optional[str] = None, + is_target_vm_confidential_encryption_enabled: 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 VMwareCbtTestMigrateInput(TestMigrateProviderSpecificInput, discriminator="VMwareCbt"): + """VMwareCbt specific test migrate input. + + :ivar recovery_point_id: The recovery point Id. Required. + :vartype recovery_point_id: str + :ivar network_id: The test network Id. Required. + :vartype network_id: str + :ivar vm_nics: The list of NIC details. + :vartype vm_nics: list[~azure.mgmt.recoveryservicessiterecovery.models.VMwareCbtNicInput] + :ivar os_upgrade_version: A value indicating the inplace OS Upgrade version. + :vartype os_upgrade_version: str + :ivar post_migration_steps: The managed run command script input. + :vartype post_migration_steps: + list[~azure.mgmt.recoveryservicessiterecovery.models.ManagedRunCommandScriptInput] + :ivar instance_type: The class type. Required. Default value is "VMwareCbt". + :vartype instance_type: str + """ + + recovery_point_id: str = rest_field( + name="recoveryPointId", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery point Id. Required.""" + network_id: str = rest_field(name="networkId", visibility=["read", "create", "update", "delete", "query"]) + """The test network Id. Required.""" + vm_nics: Optional[list["_models.VMwareCbtNicInput"]] = rest_field( + name="vmNics", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of NIC details.""" + os_upgrade_version: Optional[str] = rest_field( + name="osUpgradeVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating the inplace OS Upgrade version.""" + post_migration_steps: Optional[list["_models.ManagedRunCommandScriptInput"]] = rest_field( + name="postMigrationSteps", visibility=["read", "create", "update", "delete", "query"] + ) + """The managed run command script input.""" + instance_type: Literal["VMwareCbt"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The class type. Required. Default value is \"VMwareCbt\".""" + + @overload + def __init__( + self, + *, + recovery_point_id: str, + network_id: str, + vm_nics: Optional[list["_models.VMwareCbtNicInput"]] = None, + os_upgrade_version: Optional[str] = None, + post_migration_steps: Optional[list["_models.ManagedRunCommandScriptInput"]] = 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) + self.instance_type = "VMwareCbt" # type: ignore + + +class VMwareCbtUpdateDiskInput(_Model): + """VMwareCbt disk input for update. + + :ivar disk_id: The disk Id. Required. + :vartype disk_id: str + :ivar target_disk_name: The target disk name. + :vartype target_disk_name: str + :ivar is_os_disk: A value indicating whether the disk is the OS disk. + :vartype is_os_disk: str + :ivar iops: The number of IOPS allowed for Premium V2 and Ultra disks. + :vartype iops: int + :ivar throughput_in_mbps: The total throughput in Mbps for Premium V2 and Ultra disks. + :vartype throughput_in_mbps: int + :ivar disk_size_in_gb: The target disk size in GB. + :vartype disk_size_in_gb: int + """ + + disk_id: str = rest_field(name="diskId", visibility=["read", "create", "update", "delete", "query"]) + """The disk Id. Required.""" + target_disk_name: Optional[str] = rest_field( + name="targetDiskName", visibility=["read", "create", "update", "delete", "query"] + ) + """The target disk name.""" + is_os_disk: Optional[str] = rest_field(name="isOSDisk", visibility=["read", "create", "update", "delete", "query"]) + """A value indicating whether the disk is the OS disk.""" + iops: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The number of IOPS allowed for Premium V2 and Ultra disks.""" + throughput_in_mbps: Optional[int] = rest_field( + name="throughputInMbps", visibility=["read", "create", "update", "delete", "query"] + ) + """The total throughput in Mbps for Premium V2 and Ultra disks.""" + disk_size_in_gb: Optional[int] = rest_field( + name="diskSizeInGB", visibility=["read", "create", "update", "delete", "query"] + ) + """The target disk size in GB.""" + + @overload + def __init__( + self, + *, + disk_id: str, + target_disk_name: Optional[str] = None, + is_os_disk: Optional[str] = None, + iops: Optional[int] = None, + throughput_in_mbps: Optional[int] = None, + disk_size_in_gb: 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 VMwareCbtUpdateMigrationItemInput(UpdateMigrationItemProviderSpecificInput, discriminator="VMwareCbt"): + """VMwareCbt specific update migration item input. + + :ivar target_vm_name: The target VM name. + :vartype target_vm_name: str + :ivar target_vm_size: The target VM size. + :vartype target_vm_size: str + :ivar target_resource_group_id: The target resource group ARM Id. + :vartype target_resource_group_id: str + :ivar target_availability_set_id: The target availability set ARM Id. + :vartype target_availability_set_id: str + :ivar target_availability_zone: The target availability zone. + :vartype target_availability_zone: str + :ivar target_proximity_placement_group_id: The target proximity placement group ARM Id. + :vartype target_proximity_placement_group_id: str + :ivar target_boot_diagnostics_storage_account_id: The target boot diagnostics storage account + ARM Id. + :vartype target_boot_diagnostics_storage_account_id: str + :ivar target_network_id: The target network ARM Id. + :vartype target_network_id: str + :ivar test_network_id: The test network ARM Id. + :vartype test_network_id: str + :ivar vm_nics: The list of NIC details. + :vartype vm_nics: list[~azure.mgmt.recoveryservicessiterecovery.models.VMwareCbtNicInput] + :ivar vm_disks: The list of disk update properties. + :vartype vm_disks: + list[~azure.mgmt.recoveryservicessiterecovery.models.VMwareCbtUpdateDiskInput] + :ivar license_type: The license type. Known values are: "NotSpecified", "NoLicenseType", and + "WindowsServer". + :vartype license_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.LicenseType + :ivar sql_server_license_type: The SQL Server license type. Known values are: "NotSpecified", + "NoLicenseType", "PAYG", and "AHUB". + :vartype sql_server_license_type: str or + ~azure.mgmt.recoveryservicessiterecovery.models.SqlServerLicenseType + :ivar linux_license_type: The license type for Linux VM's. Known values are: "NotSpecified", + "NoLicenseType", and "LinuxServer". + :vartype linux_license_type: str or + ~azure.mgmt.recoveryservicessiterecovery.models.LinuxLicenseType + :ivar user_selected_os_name: The OS name selected by user. + :vartype user_selected_os_name: str + :ivar perform_auto_resync: A value indicating whether auto resync is to be done. + :vartype perform_auto_resync: str + :ivar target_vm_tags: The target VM tags. + :vartype target_vm_tags: dict[str, str] + :ivar target_disk_tags: The tags for the target disks. + :vartype target_disk_tags: dict[str, str] + :ivar target_nic_tags: The tags for the target NICs. + :vartype target_nic_tags: dict[str, str] + :ivar target_capacity_reservation_group_id: The target capacity reservation group ARM Id. + :vartype target_capacity_reservation_group_id: str + :ivar instance_type: The class type. Required. Default value is "VMwareCbt". + :vartype instance_type: str + """ + + target_vm_name: Optional[str] = rest_field( + name="targetVmName", visibility=["read", "create", "update", "delete", "query"] + ) + """The target VM name.""" + target_vm_size: Optional[str] = rest_field( + name="targetVmSize", visibility=["read", "create", "update", "delete", "query"] + ) + """The target VM size.""" + target_resource_group_id: Optional[str] = rest_field( + name="targetResourceGroupId", visibility=["read", "create", "update", "delete", "query"] + ) + """The target resource group ARM Id.""" + target_availability_set_id: Optional[str] = rest_field( + name="targetAvailabilitySetId", visibility=["read", "create", "update", "delete", "query"] + ) + """The target availability set ARM Id.""" + target_availability_zone: Optional[str] = rest_field( + name="targetAvailabilityZone", visibility=["read", "create", "update", "delete", "query"] + ) + """The target availability zone.""" + target_proximity_placement_group_id: Optional[str] = rest_field( + name="targetProximityPlacementGroupId", visibility=["read", "create", "update", "delete", "query"] + ) + """The target proximity placement group ARM Id.""" + target_boot_diagnostics_storage_account_id: Optional[str] = rest_field( + name="targetBootDiagnosticsStorageAccountId", visibility=["read", "create", "update", "delete", "query"] + ) + """The target boot diagnostics storage account ARM Id.""" + target_network_id: Optional[str] = rest_field( + name="targetNetworkId", visibility=["read", "create", "update", "delete", "query"] + ) + """The target network ARM Id.""" + test_network_id: Optional[str] = rest_field( + name="testNetworkId", visibility=["read", "create", "update", "delete", "query"] + ) + """The test network ARM Id.""" + vm_nics: Optional[list["_models.VMwareCbtNicInput"]] = rest_field( + name="vmNics", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of NIC details.""" + vm_disks: Optional[list["_models.VMwareCbtUpdateDiskInput"]] = rest_field( + name="vmDisks", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of disk update properties.""" + license_type: Optional[Union[str, "_models.LicenseType"]] = rest_field( + name="licenseType", visibility=["read", "create", "update", "delete", "query"] + ) + """The license type. Known values are: \"NotSpecified\", \"NoLicenseType\", and \"WindowsServer\".""" + sql_server_license_type: Optional[Union[str, "_models.SqlServerLicenseType"]] = rest_field( + name="sqlServerLicenseType", visibility=["read", "create", "update", "delete", "query"] + ) + """The SQL Server license type. Known values are: \"NotSpecified\", \"NoLicenseType\", \"PAYG\", + and \"AHUB\".""" + linux_license_type: Optional[Union[str, "_models.LinuxLicenseType"]] = rest_field( + name="linuxLicenseType", visibility=["read", "create", "update", "delete", "query"] + ) + """The license type for Linux VM's. Known values are: \"NotSpecified\", \"NoLicenseType\", and + \"LinuxServer\".""" + user_selected_os_name: Optional[str] = rest_field( + name="userSelectedOSName", visibility=["read", "create", "update", "delete", "query"] + ) + """The OS name selected by user.""" + perform_auto_resync: Optional[str] = rest_field( + name="performAutoResync", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether auto resync is to be done.""" + target_vm_tags: Optional[dict[str, str]] = rest_field( + name="targetVmTags", visibility=["read", "create", "update", "delete", "query"] + ) + """The target VM tags.""" + target_disk_tags: Optional[dict[str, str]] = rest_field( + name="targetDiskTags", visibility=["read", "create", "update", "delete", "query"] + ) + """The tags for the target disks.""" + target_nic_tags: Optional[dict[str, str]] = rest_field( + name="targetNicTags", visibility=["read", "create", "update", "delete", "query"] + ) + """The tags for the target NICs.""" + target_capacity_reservation_group_id: Optional[str] = rest_field( + name="targetCapacityReservationGroupId", visibility=["read", "create", "update", "delete", "query"] + ) + """The target capacity reservation group ARM Id.""" + instance_type: Literal["VMwareCbt"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The class type. Required. Default value is \"VMwareCbt\".""" + + @overload + def __init__( + self, + *, + target_vm_name: Optional[str] = None, + target_vm_size: Optional[str] = None, + target_resource_group_id: Optional[str] = None, + target_availability_set_id: Optional[str] = None, + target_availability_zone: Optional[str] = None, + target_proximity_placement_group_id: Optional[str] = None, + target_boot_diagnostics_storage_account_id: Optional[str] = None, + target_network_id: Optional[str] = None, + test_network_id: Optional[str] = None, + vm_nics: Optional[list["_models.VMwareCbtNicInput"]] = None, + vm_disks: Optional[list["_models.VMwareCbtUpdateDiskInput"]] = None, + license_type: Optional[Union[str, "_models.LicenseType"]] = None, + sql_server_license_type: Optional[Union[str, "_models.SqlServerLicenseType"]] = None, + linux_license_type: Optional[Union[str, "_models.LinuxLicenseType"]] = None, + user_selected_os_name: Optional[str] = None, + perform_auto_resync: Optional[str] = None, + target_vm_tags: Optional[dict[str, str]] = None, + target_disk_tags: Optional[dict[str, str]] = None, + target_nic_tags: Optional[dict[str, str]] = None, + target_capacity_reservation_group_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) + self.instance_type = "VMwareCbt" # type: ignore + + +class VMwareDetails(FabricSpecificDetails, discriminator="VMware"): + """Store the fabric details specific to the VMware fabric. + + :ivar process_servers: The list of Process Servers associated with the fabric. + :vartype process_servers: list[~azure.mgmt.recoveryservicessiterecovery.models.ProcessServer] + :ivar master_target_servers: The list of Master Target servers associated with the fabric. + :vartype master_target_servers: + list[~azure.mgmt.recoveryservicessiterecovery.models.MasterTargetServer] + :ivar run_as_accounts: The list of run as accounts created on the server. + :vartype run_as_accounts: list[~azure.mgmt.recoveryservicessiterecovery.models.RunAsAccount] + :ivar replication_pair_count: The number of replication pairs configured in this CS. + :vartype replication_pair_count: str + :ivar process_server_count: The number of process servers. + :vartype process_server_count: str + :ivar agent_count: The number of source and target servers configured to talk to this CS. + :vartype agent_count: str + :ivar protected_servers: The number of protected servers. + :vartype protected_servers: str + :ivar system_load: The percentage of the system load. + :vartype system_load: str + :ivar system_load_status: The system load status. + :vartype system_load_status: str + :ivar cpu_load: The percentage of the CPU load. + :vartype cpu_load: str + :ivar cpu_load_status: The CPU load status. + :vartype cpu_load_status: str + :ivar total_memory_in_bytes: The total memory. + :vartype total_memory_in_bytes: int + :ivar available_memory_in_bytes: The available memory. + :vartype available_memory_in_bytes: int + :ivar memory_usage_status: The memory usage status. + :vartype memory_usage_status: str + :ivar total_space_in_bytes: The total space. + :vartype total_space_in_bytes: int + :ivar available_space_in_bytes: The available space. + :vartype available_space_in_bytes: int + :ivar space_usage_status: The space usage status. + :vartype space_usage_status: str + :ivar web_load: The web load. + :vartype web_load: str + :ivar web_load_status: The web load status. + :vartype web_load_status: str + :ivar database_server_load: The database server load. + :vartype database_server_load: str + :ivar database_server_load_status: The database server load status. + :vartype database_server_load_status: str + :ivar cs_service_status: The CS service status. + :vartype cs_service_status: str + :ivar ip_address: The IP address. + :vartype ip_address: str + :ivar agent_version: The agent Version. + :vartype agent_version: str + :ivar host_name: The host name. + :vartype host_name: str + :ivar last_heartbeat: The last heartbeat received from CS server. + :vartype last_heartbeat: ~datetime.datetime + :ivar version_status: Version status. + :vartype version_status: str + :ivar ssl_cert_expiry_date: CS SSL cert expiry date. + :vartype ssl_cert_expiry_date: ~datetime.datetime + :ivar ssl_cert_expiry_remaining_days: CS SSL cert expiry date. + :vartype ssl_cert_expiry_remaining_days: int + :ivar ps_template_version: PS template version. + :vartype ps_template_version: str + :ivar agent_expiry_date: Agent expiry date. + :vartype agent_expiry_date: ~datetime.datetime + :ivar agent_version_details: The agent version details. + :vartype agent_version_details: ~azure.mgmt.recoveryservicessiterecovery.models.VersionDetails + :ivar switch_provider_blocking_error_details: The switch provider blocking error information. + :vartype switch_provider_blocking_error_details: + list[~azure.mgmt.recoveryservicessiterecovery.models.InMageFabricSwitchProviderBlockingErrorDetails] + :ivar instance_type: Gets the class type. Overridden in derived classes. Required. Default + value is "VMware". + :vartype instance_type: str + """ + + process_servers: Optional[list["_models.ProcessServer"]] = rest_field( + name="processServers", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of Process Servers associated with the fabric.""" + master_target_servers: Optional[list["_models.MasterTargetServer"]] = rest_field( + name="masterTargetServers", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of Master Target servers associated with the fabric.""" + run_as_accounts: Optional[list["_models.RunAsAccount"]] = rest_field( + name="runAsAccounts", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of run as accounts created on the server.""" + replication_pair_count: Optional[str] = rest_field( + name="replicationPairCount", visibility=["read", "create", "update", "delete", "query"] + ) + """The number of replication pairs configured in this CS.""" + process_server_count: Optional[str] = rest_field( + name="processServerCount", visibility=["read", "create", "update", "delete", "query"] + ) + """The number of process servers.""" + agent_count: Optional[str] = rest_field( + name="agentCount", visibility=["read", "create", "update", "delete", "query"] + ) + """The number of source and target servers configured to talk to this CS.""" + protected_servers: Optional[str] = rest_field( + name="protectedServers", visibility=["read", "create", "update", "delete", "query"] + ) + """The number of protected servers.""" + system_load: Optional[str] = rest_field( + name="systemLoad", visibility=["read", "create", "update", "delete", "query"] + ) + """The percentage of the system load.""" + system_load_status: Optional[str] = rest_field( + name="systemLoadStatus", visibility=["read", "create", "update", "delete", "query"] + ) + """The system load status.""" + cpu_load: Optional[str] = rest_field(name="cpuLoad", visibility=["read", "create", "update", "delete", "query"]) + """The percentage of the CPU load.""" + cpu_load_status: Optional[str] = rest_field( + name="cpuLoadStatus", visibility=["read", "create", "update", "delete", "query"] + ) + """The CPU load status.""" + total_memory_in_bytes: Optional[int] = rest_field( + name="totalMemoryInBytes", visibility=["read", "create", "update", "delete", "query"] + ) + """The total memory.""" + available_memory_in_bytes: Optional[int] = rest_field( + name="availableMemoryInBytes", visibility=["read", "create", "update", "delete", "query"] + ) + """The available memory.""" + memory_usage_status: Optional[str] = rest_field( + name="memoryUsageStatus", visibility=["read", "create", "update", "delete", "query"] + ) + """The memory usage status.""" + total_space_in_bytes: Optional[int] = rest_field( + name="totalSpaceInBytes", visibility=["read", "create", "update", "delete", "query"] + ) + """The total space.""" + available_space_in_bytes: Optional[int] = rest_field( + name="availableSpaceInBytes", visibility=["read", "create", "update", "delete", "query"] + ) + """The available space.""" + space_usage_status: Optional[str] = rest_field( + name="spaceUsageStatus", visibility=["read", "create", "update", "delete", "query"] + ) + """The space usage status.""" + web_load: Optional[str] = rest_field(name="webLoad", visibility=["read", "create", "update", "delete", "query"]) + """The web load.""" + web_load_status: Optional[str] = rest_field( + name="webLoadStatus", visibility=["read", "create", "update", "delete", "query"] + ) + """The web load status.""" + database_server_load: Optional[str] = rest_field( + name="databaseServerLoad", visibility=["read", "create", "update", "delete", "query"] + ) + """The database server load.""" + database_server_load_status: Optional[str] = rest_field( + name="databaseServerLoadStatus", visibility=["read", "create", "update", "delete", "query"] + ) + """The database server load status.""" + cs_service_status: Optional[str] = rest_field( + name="csServiceStatus", visibility=["read", "create", "update", "delete", "query"] + ) + """The CS service status.""" + ip_address: Optional[str] = rest_field(name="ipAddress", visibility=["read", "create", "update", "delete", "query"]) + """The IP address.""" + agent_version: Optional[str] = rest_field( + name="agentVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """The agent Version.""" + host_name: Optional[str] = rest_field(name="hostName", visibility=["read", "create", "update", "delete", "query"]) + """The host name.""" + last_heartbeat: Optional[datetime.datetime] = rest_field( + name="lastHeartbeat", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The last heartbeat received from CS server.""" + version_status: Optional[str] = rest_field( + name="versionStatus", visibility=["read", "create", "update", "delete", "query"] + ) + """Version status.""" + ssl_cert_expiry_date: Optional[datetime.datetime] = rest_field( + name="sslCertExpiryDate", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """CS SSL cert expiry date.""" + ssl_cert_expiry_remaining_days: Optional[int] = rest_field( + name="sslCertExpiryRemainingDays", visibility=["read", "create", "update", "delete", "query"] + ) + """CS SSL cert expiry date.""" + ps_template_version: Optional[str] = rest_field( + name="psTemplateVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """PS template version.""" + agent_expiry_date: Optional[datetime.datetime] = rest_field( + name="agentExpiryDate", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """Agent expiry date.""" + agent_version_details: Optional["_models.VersionDetails"] = rest_field( + name="agentVersionDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """The agent version details.""" + switch_provider_blocking_error_details: Optional[list["_models.InMageFabricSwitchProviderBlockingErrorDetails"]] = ( + rest_field( + name="switchProviderBlockingErrorDetails", visibility=["read", "create", "update", "delete", "query"] + ) + ) + """The switch provider blocking error information.""" + instance_type: Literal["VMware"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets the class type. Overridden in derived classes. Required. Default value is \"VMware\".""" + + @overload + def __init__( # pylint: disable=too-many-locals + self, + *, + process_servers: Optional[list["_models.ProcessServer"]] = None, + master_target_servers: Optional[list["_models.MasterTargetServer"]] = None, + run_as_accounts: Optional[list["_models.RunAsAccount"]] = None, + replication_pair_count: Optional[str] = None, + process_server_count: Optional[str] = None, + agent_count: Optional[str] = None, + protected_servers: Optional[str] = None, + system_load: Optional[str] = None, + system_load_status: Optional[str] = None, + cpu_load: Optional[str] = None, + cpu_load_status: Optional[str] = None, + total_memory_in_bytes: Optional[int] = None, + available_memory_in_bytes: Optional[int] = None, + memory_usage_status: Optional[str] = None, + total_space_in_bytes: Optional[int] = None, + available_space_in_bytes: Optional[int] = None, + space_usage_status: Optional[str] = None, + web_load: Optional[str] = None, + web_load_status: Optional[str] = None, + database_server_load: Optional[str] = None, + database_server_load_status: Optional[str] = None, + cs_service_status: Optional[str] = None, + ip_address: Optional[str] = None, + agent_version: Optional[str] = None, + host_name: Optional[str] = None, + last_heartbeat: Optional[datetime.datetime] = None, + version_status: Optional[str] = None, + ssl_cert_expiry_date: Optional[datetime.datetime] = None, + ssl_cert_expiry_remaining_days: Optional[int] = None, + ps_template_version: Optional[str] = None, + agent_expiry_date: Optional[datetime.datetime] = None, + agent_version_details: Optional["_models.VersionDetails"] = None, + switch_provider_blocking_error_details: Optional[ + list["_models.InMageFabricSwitchProviderBlockingErrorDetails"] + ] = 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) + self.instance_type = "VMware" # type: ignore + + +class VMwareV2FabricCreationInput(FabricSpecificCreationInput, discriminator="VMwareV2"): + """VMwareV2 fabric provider specific settings. + + :ivar vmware_site_id: The ARM Id of the VMware site. + :vartype vmware_site_id: str + :ivar physical_site_id: The ARM Id of the physical site. + :vartype physical_site_id: str + :ivar migration_solution_id: The ARM Id of the migration solution. Required. + :vartype migration_solution_id: str + :ivar instance_type: Gets the class type. Required. Default value is "VMwareV2". + :vartype instance_type: str + """ + + vmware_site_id: Optional[str] = rest_field( + name="vmwareSiteId", visibility=["read", "create", "update", "delete", "query"] + ) + """The ARM Id of the VMware site.""" + physical_site_id: Optional[str] = rest_field( + name="physicalSiteId", visibility=["read", "create", "update", "delete", "query"] + ) + """The ARM Id of the physical site.""" + migration_solution_id: str = rest_field( + name="migrationSolutionId", visibility=["read", "create", "update", "delete", "query"] + ) + """The ARM Id of the migration solution. Required.""" + instance_type: Literal["VMwareV2"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets the class type. Required. Default value is \"VMwareV2\".""" + + @overload + def __init__( + self, + *, + migration_solution_id: str, + vmware_site_id: Optional[str] = None, + physical_site_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) + self.instance_type = "VMwareV2" # type: ignore + + +class VMwareV2FabricSpecificDetails(FabricSpecificDetails, discriminator="VMwareV2"): + """VMwareV2 fabric specific details. + + :ivar vmware_site_id: The ARM Id of the VMware site. + :vartype vmware_site_id: str + :ivar physical_site_id: The ARM Id of the physical site. + :vartype physical_site_id: str + :ivar migration_solution_id: The Migration solution ARM Id. + :vartype migration_solution_id: str + :ivar service_endpoint: The service endpoint. + :vartype service_endpoint: str + :ivar service_resource_id: The service resource Id. + :vartype service_resource_id: str + :ivar service_container_id: The service container Id. + :vartype service_container_id: str + :ivar process_servers: The list of process servers. + :vartype process_servers: + list[~azure.mgmt.recoveryservicessiterecovery.models.ProcessServerDetails] + :ivar instance_type: Gets the class type. Overridden in derived classes. Required. Default + value is "VMwareV2". + :vartype instance_type: str + """ + + vmware_site_id: Optional[str] = rest_field(name="vmwareSiteId", visibility=["read"]) + """The ARM Id of the VMware site.""" + physical_site_id: Optional[str] = rest_field(name="physicalSiteId", visibility=["read"]) + """The ARM Id of the physical site.""" + migration_solution_id: Optional[str] = rest_field(name="migrationSolutionId", visibility=["read"]) + """The Migration solution ARM Id.""" + service_endpoint: Optional[str] = rest_field(name="serviceEndpoint", visibility=["read"]) + """The service endpoint.""" + service_resource_id: Optional[str] = rest_field(name="serviceResourceId", visibility=["read"]) + """The service resource Id.""" + service_container_id: Optional[str] = rest_field(name="serviceContainerId", visibility=["read"]) + """The service container Id.""" + process_servers: Optional[list["_models.ProcessServerDetails"]] = rest_field( + name="processServers", visibility=["read"] + ) + """The list of process servers.""" + instance_type: Literal["VMwareV2"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets the class type. Overridden in derived classes. Required. Default value is \"VMwareV2\".""" + + @overload + def __init__( + self, + ) -> 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) + self.instance_type = "VMwareV2" # type: ignore + + +class VMwareVirtualMachineDetails(ConfigurationSettings, discriminator="VMwareVirtualMachine"): + """VMware provider specific settings. + + :ivar agent_generated_id: The ID generated by the InMage agent after it gets installed on + guest. This is the ID to be used during InMage CreateProtection. + :vartype agent_generated_id: str + :ivar agent_installed: The value indicating if InMage scout agent is installed on guest. + :vartype agent_installed: str + :ivar os_type: The OsType installed on VM. + :vartype os_type: str + :ivar agent_version: The agent version. + :vartype agent_version: str + :ivar ip_address: The IP address. + :vartype ip_address: str + :ivar powered_on: The value indicating whether VM is powered on. + :vartype powered_on: str + :ivar v_center_infrastructure_id: The VCenter infrastructure Id. + :vartype v_center_infrastructure_id: str + :ivar discovery_type: A value indicating the discovery type of the machine. Value can be + vCenter or physical. + :vartype discovery_type: str + :ivar disk_details: The disk details. + :vartype disk_details: list[~azure.mgmt.recoveryservicessiterecovery.models.InMageDiskDetails] + :ivar validation_errors: The validation errors. + :vartype validation_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] + :ivar instance_type: Gets the class type. Overridden in derived classes. Required. Default + value is "VMwareVirtualMachine". + :vartype instance_type: str + """ + + agent_generated_id: Optional[str] = rest_field( + name="agentGeneratedId", visibility=["read", "create", "update", "delete", "query"] + ) + """The ID generated by the InMage agent after it gets installed on guest. This is the ID to be + used during InMage CreateProtection.""" + agent_installed: Optional[str] = rest_field( + name="agentInstalled", visibility=["read", "create", "update", "delete", "query"] + ) + """The value indicating if InMage scout agent is installed on guest.""" + os_type: Optional[str] = rest_field(name="osType", visibility=["read", "create", "update", "delete", "query"]) + """The OsType installed on VM.""" + agent_version: Optional[str] = rest_field( + name="agentVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """The agent version.""" + ip_address: Optional[str] = rest_field(name="ipAddress", visibility=["read", "create", "update", "delete", "query"]) + """The IP address.""" + powered_on: Optional[str] = rest_field(name="poweredOn", visibility=["read", "create", "update", "delete", "query"]) + """The value indicating whether VM is powered on.""" + v_center_infrastructure_id: Optional[str] = rest_field( + name="vCenterInfrastructureId", visibility=["read", "create", "update", "delete", "query"] + ) + """The VCenter infrastructure Id.""" + discovery_type: Optional[str] = rest_field( + name="discoveryType", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating the discovery type of the machine. Value can be vCenter or physical.""" + disk_details: Optional[list["_models.InMageDiskDetails"]] = rest_field( + name="diskDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """The disk details.""" + validation_errors: Optional[list["_models.HealthError"]] = rest_field( + name="validationErrors", visibility=["read", "create", "update", "delete", "query"] + ) + """The validation errors.""" + instance_type: Literal["VMwareVirtualMachine"] = rest_discriminator(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets the class type. Overridden in derived classes. Required. Default value is + \"VMwareVirtualMachine\".""" + + @overload + def __init__( + self, + *, + agent_generated_id: Optional[str] = None, + agent_installed: Optional[str] = None, + os_type: Optional[str] = None, + agent_version: Optional[str] = None, + ip_address: Optional[str] = None, + powered_on: Optional[str] = None, + v_center_infrastructure_id: Optional[str] = None, + discovery_type: Optional[str] = None, + disk_details: Optional[list["_models.InMageDiskDetails"]] = None, + validation_errors: Optional[list["_models.HealthError"]] = 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) + self.instance_type = "VMwareVirtualMachine" # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/models/_models_py3.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/models/_models_py3.py deleted file mode 100644 index 5b45a5295ab4..000000000000 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/models/_models_py3.py +++ /dev/null @@ -1,32461 +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 -import datetime -from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union - -from .. import _serialization - -if TYPE_CHECKING: - from .. import models as _models -JSON = MutableMapping[str, Any] - - -class AddDisksProviderSpecificInput(_serialization.Model): - """Add Disks provider specific input. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - A2AAddDisksInput, InMageRcmAddDisksInput - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - } - - _subtype_map = {"instance_type": {"A2A": "A2AAddDisksInput", "InMageRcm": "InMageRcmAddDisksInput"}} - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.instance_type: Optional[str] = None - - -class A2AAddDisksInput(AddDisksProviderSpecificInput): - """A2A add disk(s) input. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - :ivar vm_disks: The list of vm disk details. - :vartype vm_disks: list[~azure.mgmt.recoveryservicessiterecovery.models.A2AVmDiskInputDetails] - :ivar vm_managed_disks: The list of vm managed disk details. - :vartype vm_managed_disks: - list[~azure.mgmt.recoveryservicessiterecovery.models.A2AVmManagedDiskInputDetails] - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "vm_disks": {"key": "vmDisks", "type": "[A2AVmDiskInputDetails]"}, - "vm_managed_disks": {"key": "vmManagedDisks", "type": "[A2AVmManagedDiskInputDetails]"}, - } - - def __init__( - self, - *, - vm_disks: Optional[List["_models.A2AVmDiskInputDetails"]] = None, - vm_managed_disks: Optional[List["_models.A2AVmManagedDiskInputDetails"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword vm_disks: The list of vm disk details. - :paramtype vm_disks: - list[~azure.mgmt.recoveryservicessiterecovery.models.A2AVmDiskInputDetails] - :keyword vm_managed_disks: The list of vm managed disk details. - :paramtype vm_managed_disks: - list[~azure.mgmt.recoveryservicessiterecovery.models.A2AVmManagedDiskInputDetails] - """ - super().__init__(**kwargs) - self.instance_type: str = "A2A" - self.vm_disks = vm_disks - self.vm_managed_disks = vm_managed_disks - - -class ApplyClusterRecoveryPointProviderSpecificInput(_serialization.Model): # pylint: disable=name-too-long - """Provider specific input for apply cluster recovery point. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - A2AApplyClusterRecoveryPointInput - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - } - - _subtype_map = {"instance_type": {"A2A": "A2AApplyClusterRecoveryPointInput"}} - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.instance_type: Optional[str] = None - - -class A2AApplyClusterRecoveryPointInput(ApplyClusterRecoveryPointProviderSpecificInput): - """A2A provider specific input for apply cluster recovery point. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.instance_type: str = "A2A" - - -class ApplyRecoveryPointProviderSpecificInput(_serialization.Model): - """Provider specific input for apply recovery point. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - A2AApplyRecoveryPointInput, A2ACrossClusterMigrationApplyRecoveryPointInput, - HyperVReplicaAzureApplyRecoveryPointInput, InMageAzureV2ApplyRecoveryPointInput, - InMageRcmApplyRecoveryPointInput - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - } - - _subtype_map = { - "instance_type": { - "A2A": "A2AApplyRecoveryPointInput", - "A2ACrossClusterMigration": "A2ACrossClusterMigrationApplyRecoveryPointInput", - "HyperVReplicaAzure": "HyperVReplicaAzureApplyRecoveryPointInput", - "InMageAzureV2": "InMageAzureV2ApplyRecoveryPointInput", - "InMageRcm": "InMageRcmApplyRecoveryPointInput", - } - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.instance_type: Optional[str] = None - - -class A2AApplyRecoveryPointInput(ApplyRecoveryPointProviderSpecificInput): - """ApplyRecoveryPoint input specific to A2A provider. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.instance_type: str = "A2A" - - -class ClusterProviderSpecificRecoveryPointDetails(_serialization.Model): # pylint: disable=name-too-long - """Replication provider specific cluster recovery point details. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - A2AClusterRecoveryPointDetails - - 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 instance_type: Gets the provider type. Required. - :vartype instance_type: str - """ - - _validation = { - "instance_type": {"required": True, "readonly": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - } - - _subtype_map = {"instance_type": {"A2A": "A2AClusterRecoveryPointDetails"}} - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.instance_type: Optional[str] = None - - -class A2AClusterRecoveryPointDetails(ClusterProviderSpecificRecoveryPointDetails): - """A2A provider specific cluster recovery point details. - - 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 instance_type: Gets the provider type. Required. - :vartype instance_type: str - :ivar recovery_point_sync_type: A value indicating whether the recovery point is multi VM - consistent. Known values are: "MultiVmSyncRecoveryPoint" and "PerVmRecoveryPoint". - :vartype recovery_point_sync_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPointSyncType - :ivar nodes: The list of nodes representing the cluster. - :vartype nodes: list[str] - """ - - _validation = { - "instance_type": {"required": True, "readonly": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "recovery_point_sync_type": {"key": "recoveryPointSyncType", "type": "str"}, - "nodes": {"key": "nodes", "type": "[str]"}, - } - - def __init__( - self, - *, - recovery_point_sync_type: Optional[Union[str, "_models.RecoveryPointSyncType"]] = None, - nodes: Optional[List[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword recovery_point_sync_type: A value indicating whether the recovery point is multi VM - consistent. Known values are: "MultiVmSyncRecoveryPoint" and "PerVmRecoveryPoint". - :paramtype recovery_point_sync_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPointSyncType - :keyword nodes: The list of nodes representing the cluster. - :paramtype nodes: list[str] - """ - super().__init__(**kwargs) - self.instance_type: str = "A2A" - self.recovery_point_sync_type = recovery_point_sync_type - self.nodes = nodes - - -class ClusterTestFailoverProviderSpecificInput(_serialization.Model): - """Provider specific test cluster failover input. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - A2AClusterTestFailoverInput - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - } - - _subtype_map = {"instance_type": {"A2A": "A2AClusterTestFailoverInput"}} - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.instance_type: Optional[str] = None - - -class A2AClusterTestFailoverInput(ClusterTestFailoverProviderSpecificInput): - """A2A provider specific input for test cluster failover. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - :ivar cluster_recovery_point_id: The cluster recovery point id to be passed to failover to a - particular recovery point. - :vartype cluster_recovery_point_id: str - :ivar individual_node_recovery_points: The list of individual node recovery points. - :vartype individual_node_recovery_points: list[str] - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "cluster_recovery_point_id": {"key": "clusterRecoveryPointId", "type": "str"}, - "individual_node_recovery_points": {"key": "individualNodeRecoveryPoints", "type": "[str]"}, - } - - def __init__( - self, - *, - cluster_recovery_point_id: Optional[str] = None, - individual_node_recovery_points: Optional[List[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword cluster_recovery_point_id: The cluster recovery point id to be passed to failover to a - particular recovery point. - :paramtype cluster_recovery_point_id: str - :keyword individual_node_recovery_points: The list of individual node recovery points. - :paramtype individual_node_recovery_points: list[str] - """ - super().__init__(**kwargs) - self.instance_type: str = "A2A" - self.cluster_recovery_point_id = cluster_recovery_point_id - self.individual_node_recovery_points = individual_node_recovery_points - - -class ClusterUnplannedFailoverProviderSpecificInput(_serialization.Model): # pylint: disable=name-too-long - """Provider specific unplanned cluster failover input. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - A2AClusterUnplannedFailoverInput - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - } - - _subtype_map = {"instance_type": {"A2A": "A2AClusterUnplannedFailoverInput"}} - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.instance_type: Optional[str] = None - - -class A2AClusterUnplannedFailoverInput(ClusterUnplannedFailoverProviderSpecificInput): - """A2A provider specific input for unplanned cluster failover. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - :ivar cluster_recovery_point_id: The cluster recovery point id to be passed to failover to a - particular recovery point. - :vartype cluster_recovery_point_id: str - :ivar individual_node_recovery_points: The list of individual node recovery points. - :vartype individual_node_recovery_points: list[str] - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "cluster_recovery_point_id": {"key": "clusterRecoveryPointId", "type": "str"}, - "individual_node_recovery_points": {"key": "individualNodeRecoveryPoints", "type": "[str]"}, - } - - def __init__( - self, - *, - cluster_recovery_point_id: Optional[str] = None, - individual_node_recovery_points: Optional[List[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword cluster_recovery_point_id: The cluster recovery point id to be passed to failover to a - particular recovery point. - :paramtype cluster_recovery_point_id: str - :keyword individual_node_recovery_points: The list of individual node recovery points. - :paramtype individual_node_recovery_points: list[str] - """ - super().__init__(**kwargs) - self.instance_type: str = "A2A" - self.cluster_recovery_point_id = cluster_recovery_point_id - self.individual_node_recovery_points = individual_node_recovery_points - - -class ReplicationProviderSpecificContainerCreationInput(_serialization.Model): # pylint: disable=name-too-long - """Provider specific input for container creation operation. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - A2AContainerCreationInput, A2ACrossClusterMigrationContainerCreationInput, - VMwareCbtContainerCreationInput - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - } - - _subtype_map = { - "instance_type": { - "A2A": "A2AContainerCreationInput", - "A2ACrossClusterMigration": "A2ACrossClusterMigrationContainerCreationInput", - "VMwareCbt": "VMwareCbtContainerCreationInput", - } - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.instance_type: Optional[str] = None - - -class A2AContainerCreationInput(ReplicationProviderSpecificContainerCreationInput): - """A2A cloud creation input. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.instance_type: str = "A2A" - - -class ReplicationProviderSpecificContainerMappingInput(_serialization.Model): # pylint: disable=name-too-long - """Provider specific input for pairing operations. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - A2AContainerMappingInput, VMwareCbtContainerMappingInput - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - } - - _subtype_map = {"instance_type": {"A2A": "A2AContainerMappingInput", "VMwareCbt": "VMwareCbtContainerMappingInput"}} - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.instance_type: Optional[str] = None - - -class A2AContainerMappingInput(ReplicationProviderSpecificContainerMappingInput): - """A2A container mapping input. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - :ivar agent_auto_update_status: A value indicating whether the auto update is enabled. Known - values are: "Disabled" and "Enabled". - :vartype agent_auto_update_status: str or - ~azure.mgmt.recoveryservicessiterecovery.models.AgentAutoUpdateStatus - :ivar automation_account_arm_id: The automation account arm id. - :vartype automation_account_arm_id: str - :ivar automation_account_authentication_type: A value indicating the type authentication to use - for automation Account. Known values are: "RunAsAccount" and "SystemAssignedIdentity". - :vartype automation_account_authentication_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.AutomationAccountAuthenticationType - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "agent_auto_update_status": {"key": "agentAutoUpdateStatus", "type": "str"}, - "automation_account_arm_id": {"key": "automationAccountArmId", "type": "str"}, - "automation_account_authentication_type": {"key": "automationAccountAuthenticationType", "type": "str"}, - } - - def __init__( - self, - *, - agent_auto_update_status: Optional[Union[str, "_models.AgentAutoUpdateStatus"]] = None, - automation_account_arm_id: Optional[str] = None, - automation_account_authentication_type: Optional[ - Union[str, "_models.AutomationAccountAuthenticationType"] - ] = None, - **kwargs: Any - ) -> None: - """ - :keyword agent_auto_update_status: A value indicating whether the auto update is enabled. Known - values are: "Disabled" and "Enabled". - :paramtype agent_auto_update_status: str or - ~azure.mgmt.recoveryservicessiterecovery.models.AgentAutoUpdateStatus - :keyword automation_account_arm_id: The automation account arm id. - :paramtype automation_account_arm_id: str - :keyword automation_account_authentication_type: A value indicating the type authentication to - use for automation Account. Known values are: "RunAsAccount" and "SystemAssignedIdentity". - :paramtype automation_account_authentication_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.AutomationAccountAuthenticationType - """ - super().__init__(**kwargs) - self.instance_type: str = "A2A" - self.agent_auto_update_status = agent_auto_update_status - self.automation_account_arm_id = automation_account_arm_id - self.automation_account_authentication_type = automation_account_authentication_type - - -class CreateProtectionIntentProviderSpecificDetails(_serialization.Model): # pylint: disable=name-too-long - """Create protection intent provider specific input. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - A2ACreateProtectionIntentInput - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - } - - _subtype_map = {"instance_type": {"A2A": "A2ACreateProtectionIntentInput"}} - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.instance_type: Optional[str] = None - - -class A2ACreateProtectionIntentInput(CreateProtectionIntentProviderSpecificDetails): - """A2A create protection intent input. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - :ivar fabric_object_id: The fabric specific object Id of the virtual machine. Required. - :vartype fabric_object_id: str - :ivar primary_location: The primary location for the virtual machine. Required. - :vartype primary_location: str - :ivar recovery_location: The recovery location for the virtual machine. Required. - :vartype recovery_location: str - :ivar recovery_subscription_id: The recovery subscription Id of the virtual machine. Required. - :vartype recovery_subscription_id: str - :ivar recovery_availability_type: The recovery availability type of the virtual machine. - Required. Known values are: "Single", "AvailabilitySet", and "AvailabilityZone". - :vartype recovery_availability_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.A2ARecoveryAvailabilityType - :ivar protection_profile_custom_input: The protection profile custom inputs. - :vartype protection_profile_custom_input: - ~azure.mgmt.recoveryservicessiterecovery.models.ProtectionProfileCustomDetails - :ivar recovery_resource_group_id: The recovery resource group Id. Valid for V2 scenarios. - Required. - :vartype recovery_resource_group_id: str - :ivar primary_staging_storage_account_custom_input: The primary staging storage account input. - :vartype primary_staging_storage_account_custom_input: - ~azure.mgmt.recoveryservicessiterecovery.models.StorageAccountCustomDetails - :ivar recovery_availability_set_custom_input: The recovery availability set input. - :vartype recovery_availability_set_custom_input: - ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryAvailabilitySetCustomDetails - :ivar recovery_virtual_network_custom_input: The recovery virtual network input. - :vartype recovery_virtual_network_custom_input: - ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryVirtualNetworkCustomDetails - :ivar recovery_proximity_placement_group_custom_input: The recovery proximity placement group - custom input. - :vartype recovery_proximity_placement_group_custom_input: - ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryProximityPlacementGroupCustomDetails - :ivar auto_protection_of_data_disk: A value indicating whether the auto protection is enabled. - Known values are: "Disabled" and "Enabled". - :vartype auto_protection_of_data_disk: str or - ~azure.mgmt.recoveryservicessiterecovery.models.AutoProtectionOfDataDisk - :ivar vm_disks: The list of vm disk inputs. - :vartype vm_disks: - list[~azure.mgmt.recoveryservicessiterecovery.models.A2AProtectionIntentDiskInputDetails] - :ivar vm_managed_disks: The list of vm managed disk inputs. - :vartype vm_managed_disks: - list[~azure.mgmt.recoveryservicessiterecovery.models.A2AProtectionIntentManagedDiskInputDetails] - :ivar multi_vm_group_name: The multi vm group name. - :vartype multi_vm_group_name: str - :ivar multi_vm_group_id: The multi vm group id. - :vartype multi_vm_group_id: str - :ivar recovery_boot_diag_storage_account: The boot diagnostic storage account. - :vartype recovery_boot_diag_storage_account: - ~azure.mgmt.recoveryservicessiterecovery.models.StorageAccountCustomDetails - :ivar disk_encryption_info: The recovery disk encryption information (for two pass flows). - :vartype disk_encryption_info: - ~azure.mgmt.recoveryservicessiterecovery.models.DiskEncryptionInfo - :ivar recovery_availability_zone: The recovery availability zone. - :vartype recovery_availability_zone: str - :ivar agent_auto_update_status: A value indicating whether the auto update is enabled. Known - values are: "Disabled" and "Enabled". - :vartype agent_auto_update_status: str or - ~azure.mgmt.recoveryservicessiterecovery.models.AgentAutoUpdateStatus - :ivar automation_account_authentication_type: A value indicating the authentication type for - automation account. The default value is "RunAsAccount". Known values are: "RunAsAccount" and - "SystemAssignedIdentity". - :vartype automation_account_authentication_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.AutomationAccountAuthenticationType - :ivar automation_account_arm_id: The automation account arm id. - :vartype automation_account_arm_id: str - """ - - _validation = { - "instance_type": {"required": True}, - "fabric_object_id": {"required": True}, - "primary_location": {"required": True}, - "recovery_location": {"required": True}, - "recovery_subscription_id": {"required": True}, - "recovery_availability_type": {"required": True}, - "recovery_resource_group_id": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "fabric_object_id": {"key": "fabricObjectId", "type": "str"}, - "primary_location": {"key": "primaryLocation", "type": "str"}, - "recovery_location": {"key": "recoveryLocation", "type": "str"}, - "recovery_subscription_id": {"key": "recoverySubscriptionId", "type": "str"}, - "recovery_availability_type": {"key": "recoveryAvailabilityType", "type": "str"}, - "protection_profile_custom_input": { - "key": "protectionProfileCustomInput", - "type": "ProtectionProfileCustomDetails", - }, - "recovery_resource_group_id": {"key": "recoveryResourceGroupId", "type": "str"}, - "primary_staging_storage_account_custom_input": { - "key": "primaryStagingStorageAccountCustomInput", - "type": "StorageAccountCustomDetails", - }, - "recovery_availability_set_custom_input": { - "key": "recoveryAvailabilitySetCustomInput", - "type": "RecoveryAvailabilitySetCustomDetails", - }, - "recovery_virtual_network_custom_input": { - "key": "recoveryVirtualNetworkCustomInput", - "type": "RecoveryVirtualNetworkCustomDetails", - }, - "recovery_proximity_placement_group_custom_input": { - "key": "recoveryProximityPlacementGroupCustomInput", - "type": "RecoveryProximityPlacementGroupCustomDetails", - }, - "auto_protection_of_data_disk": {"key": "autoProtectionOfDataDisk", "type": "str"}, - "vm_disks": {"key": "vmDisks", "type": "[A2AProtectionIntentDiskInputDetails]"}, - "vm_managed_disks": {"key": "vmManagedDisks", "type": "[A2AProtectionIntentManagedDiskInputDetails]"}, - "multi_vm_group_name": {"key": "multiVmGroupName", "type": "str"}, - "multi_vm_group_id": {"key": "multiVmGroupId", "type": "str"}, - "recovery_boot_diag_storage_account": { - "key": "recoveryBootDiagStorageAccount", - "type": "StorageAccountCustomDetails", - }, - "disk_encryption_info": {"key": "diskEncryptionInfo", "type": "DiskEncryptionInfo"}, - "recovery_availability_zone": {"key": "recoveryAvailabilityZone", "type": "str"}, - "agent_auto_update_status": {"key": "agentAutoUpdateStatus", "type": "str"}, - "automation_account_authentication_type": {"key": "automationAccountAuthenticationType", "type": "str"}, - "automation_account_arm_id": {"key": "automationAccountArmId", "type": "str"}, - } - - def __init__( - self, - *, - fabric_object_id: str, - primary_location: str, - recovery_location: str, - recovery_subscription_id: str, - recovery_availability_type: Union[str, "_models.A2ARecoveryAvailabilityType"], - recovery_resource_group_id: str, - protection_profile_custom_input: Optional["_models.ProtectionProfileCustomDetails"] = None, - primary_staging_storage_account_custom_input: Optional["_models.StorageAccountCustomDetails"] = None, - recovery_availability_set_custom_input: Optional["_models.RecoveryAvailabilitySetCustomDetails"] = None, - recovery_virtual_network_custom_input: Optional["_models.RecoveryVirtualNetworkCustomDetails"] = None, - recovery_proximity_placement_group_custom_input: Optional[ - "_models.RecoveryProximityPlacementGroupCustomDetails" - ] = None, - auto_protection_of_data_disk: Optional[Union[str, "_models.AutoProtectionOfDataDisk"]] = None, - vm_disks: Optional[List["_models.A2AProtectionIntentDiskInputDetails"]] = None, - vm_managed_disks: Optional[List["_models.A2AProtectionIntentManagedDiskInputDetails"]] = None, - multi_vm_group_name: Optional[str] = None, - multi_vm_group_id: Optional[str] = None, - recovery_boot_diag_storage_account: Optional["_models.StorageAccountCustomDetails"] = None, - disk_encryption_info: Optional["_models.DiskEncryptionInfo"] = None, - recovery_availability_zone: Optional[str] = None, - agent_auto_update_status: Optional[Union[str, "_models.AgentAutoUpdateStatus"]] = None, - automation_account_authentication_type: Optional[ - Union[str, "_models.AutomationAccountAuthenticationType"] - ] = None, - automation_account_arm_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword fabric_object_id: The fabric specific object Id of the virtual machine. Required. - :paramtype fabric_object_id: str - :keyword primary_location: The primary location for the virtual machine. Required. - :paramtype primary_location: str - :keyword recovery_location: The recovery location for the virtual machine. Required. - :paramtype recovery_location: str - :keyword recovery_subscription_id: The recovery subscription Id of the virtual machine. - Required. - :paramtype recovery_subscription_id: str - :keyword recovery_availability_type: The recovery availability type of the virtual machine. - Required. Known values are: "Single", "AvailabilitySet", and "AvailabilityZone". - :paramtype recovery_availability_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.A2ARecoveryAvailabilityType - :keyword protection_profile_custom_input: The protection profile custom inputs. - :paramtype protection_profile_custom_input: - ~azure.mgmt.recoveryservicessiterecovery.models.ProtectionProfileCustomDetails - :keyword recovery_resource_group_id: The recovery resource group Id. Valid for V2 scenarios. - Required. - :paramtype recovery_resource_group_id: str - :keyword primary_staging_storage_account_custom_input: The primary staging storage account - input. - :paramtype primary_staging_storage_account_custom_input: - ~azure.mgmt.recoveryservicessiterecovery.models.StorageAccountCustomDetails - :keyword recovery_availability_set_custom_input: The recovery availability set input. - :paramtype recovery_availability_set_custom_input: - ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryAvailabilitySetCustomDetails - :keyword recovery_virtual_network_custom_input: The recovery virtual network input. - :paramtype recovery_virtual_network_custom_input: - ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryVirtualNetworkCustomDetails - :keyword recovery_proximity_placement_group_custom_input: The recovery proximity placement - group custom input. - :paramtype recovery_proximity_placement_group_custom_input: - ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryProximityPlacementGroupCustomDetails - :keyword auto_protection_of_data_disk: A value indicating whether the auto protection is - enabled. Known values are: "Disabled" and "Enabled". - :paramtype auto_protection_of_data_disk: str or - ~azure.mgmt.recoveryservicessiterecovery.models.AutoProtectionOfDataDisk - :keyword vm_disks: The list of vm disk inputs. - :paramtype vm_disks: - list[~azure.mgmt.recoveryservicessiterecovery.models.A2AProtectionIntentDiskInputDetails] - :keyword vm_managed_disks: The list of vm managed disk inputs. - :paramtype vm_managed_disks: - list[~azure.mgmt.recoveryservicessiterecovery.models.A2AProtectionIntentManagedDiskInputDetails] - :keyword multi_vm_group_name: The multi vm group name. - :paramtype multi_vm_group_name: str - :keyword multi_vm_group_id: The multi vm group id. - :paramtype multi_vm_group_id: str - :keyword recovery_boot_diag_storage_account: The boot diagnostic storage account. - :paramtype recovery_boot_diag_storage_account: - ~azure.mgmt.recoveryservicessiterecovery.models.StorageAccountCustomDetails - :keyword disk_encryption_info: The recovery disk encryption information (for two pass flows). - :paramtype disk_encryption_info: - ~azure.mgmt.recoveryservicessiterecovery.models.DiskEncryptionInfo - :keyword recovery_availability_zone: The recovery availability zone. - :paramtype recovery_availability_zone: str - :keyword agent_auto_update_status: A value indicating whether the auto update is enabled. Known - values are: "Disabled" and "Enabled". - :paramtype agent_auto_update_status: str or - ~azure.mgmt.recoveryservicessiterecovery.models.AgentAutoUpdateStatus - :keyword automation_account_authentication_type: A value indicating the authentication type for - automation account. The default value is "RunAsAccount". Known values are: "RunAsAccount" and - "SystemAssignedIdentity". - :paramtype automation_account_authentication_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.AutomationAccountAuthenticationType - :keyword automation_account_arm_id: The automation account arm id. - :paramtype automation_account_arm_id: str - """ - super().__init__(**kwargs) - self.instance_type: str = "A2A" - self.fabric_object_id = fabric_object_id - self.primary_location = primary_location - self.recovery_location = recovery_location - self.recovery_subscription_id = recovery_subscription_id - self.recovery_availability_type = recovery_availability_type - self.protection_profile_custom_input = protection_profile_custom_input - self.recovery_resource_group_id = recovery_resource_group_id - self.primary_staging_storage_account_custom_input = primary_staging_storage_account_custom_input - self.recovery_availability_set_custom_input = recovery_availability_set_custom_input - self.recovery_virtual_network_custom_input = recovery_virtual_network_custom_input - self.recovery_proximity_placement_group_custom_input = recovery_proximity_placement_group_custom_input - self.auto_protection_of_data_disk = auto_protection_of_data_disk - self.vm_disks = vm_disks - self.vm_managed_disks = vm_managed_disks - self.multi_vm_group_name = multi_vm_group_name - self.multi_vm_group_id = multi_vm_group_id - self.recovery_boot_diag_storage_account = recovery_boot_diag_storage_account - self.disk_encryption_info = disk_encryption_info - self.recovery_availability_zone = recovery_availability_zone - self.agent_auto_update_status = agent_auto_update_status - self.automation_account_authentication_type = automation_account_authentication_type - self.automation_account_arm_id = automation_account_arm_id - - -class A2ACrossClusterMigrationApplyRecoveryPointInput( - ApplyRecoveryPointProviderSpecificInput -): # pylint: disable=name-too-long - """ApplyRecoveryPoint input specific to A2ACrossClusterMigration provider. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.instance_type: str = "A2ACrossClusterMigration" - - -class A2ACrossClusterMigrationContainerCreationInput( - ReplicationProviderSpecificContainerCreationInput -): # pylint: disable=name-too-long - """A2ACrossClusterMigration cloud creation input. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.instance_type: str = "A2ACrossClusterMigration" - - -class EnableProtectionProviderSpecificInput(_serialization.Model): - """Enable protection provider specific input. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - A2AEnableProtectionInput, A2ACrossClusterMigrationEnableProtectionInput, - HyperVReplicaAzureEnableProtectionInput, InMageEnableProtectionInput, - InMageAzureV2EnableProtectionInput, InMageRcmEnableProtectionInput - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - } - - _subtype_map = { - "instance_type": { - "A2A": "A2AEnableProtectionInput", - "A2ACrossClusterMigration": "A2ACrossClusterMigrationEnableProtectionInput", - "HyperVReplicaAzure": "HyperVReplicaAzureEnableProtectionInput", - "InMage": "InMageEnableProtectionInput", - "InMageAzureV2": "InMageAzureV2EnableProtectionInput", - "InMageRcm": "InMageRcmEnableProtectionInput", - } - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.instance_type: Optional[str] = None - - -class A2ACrossClusterMigrationEnableProtectionInput( - EnableProtectionProviderSpecificInput -): # pylint: disable=name-too-long - """A2A Cross-Cluster Migration enable protection input. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - :ivar fabric_object_id: The fabric specific object Id of the virtual machine. - :vartype fabric_object_id: str - :ivar recovery_container_id: The recovery container Id. - :vartype recovery_container_id: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "fabric_object_id": {"key": "fabricObjectId", "type": "str"}, - "recovery_container_id": {"key": "recoveryContainerId", "type": "str"}, - } - - def __init__( - self, *, fabric_object_id: Optional[str] = None, recovery_container_id: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword fabric_object_id: The fabric specific object Id of the virtual machine. - :paramtype fabric_object_id: str - :keyword recovery_container_id: The recovery container Id. - :paramtype recovery_container_id: str - """ - super().__init__(**kwargs) - self.instance_type: str = "A2ACrossClusterMigration" - self.fabric_object_id = fabric_object_id - self.recovery_container_id = recovery_container_id - - -class PolicyProviderSpecificInput(_serialization.Model): - """Base class for provider specific input. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - A2APolicyCreationInput, A2ACrossClusterMigrationPolicyCreationInput, HyperVReplicaPolicyInput, - HyperVReplicaAzurePolicyInput, InMagePolicyInput, InMageAzureV2PolicyInput, - InMageRcmPolicyCreationInput, InMageRcmFailbackPolicyCreationInput, - VMwareCbtPolicyCreationInput - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - } - - _subtype_map = { - "instance_type": { - "A2A": "A2APolicyCreationInput", - "A2ACrossClusterMigration": "A2ACrossClusterMigrationPolicyCreationInput", - "HyperVReplica2012": "HyperVReplicaPolicyInput", - "HyperVReplicaAzure": "HyperVReplicaAzurePolicyInput", - "InMage": "InMagePolicyInput", - "InMageAzureV2": "InMageAzureV2PolicyInput", - "InMageRcm": "InMageRcmPolicyCreationInput", - "InMageRcmFailback": "InMageRcmFailbackPolicyCreationInput", - "VMwareCbt": "VMwareCbtPolicyCreationInput", - } - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.instance_type: Optional[str] = None - - -class A2ACrossClusterMigrationPolicyCreationInput(PolicyProviderSpecificInput): # pylint: disable=name-too-long - """A2A Cross-Cluster Migration Policy creation input. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.instance_type: str = "A2ACrossClusterMigration" - - -class ReplicationProviderSpecificSettings(_serialization.Model): - """Replication provider specific settings. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - A2AReplicationDetails, A2ACrossClusterMigrationReplicationDetails, - HyperVReplicaReplicationDetails, HyperVReplicaBlueReplicationDetails, - HyperVReplicaAzureReplicationDetails, HyperVReplicaBaseReplicationDetails, - InMageReplicationDetails, InMageAzureV2ReplicationDetails, InMageRcmReplicationDetails, - InMageRcmFailbackReplicationDetails - - All required parameters must be populated in order to send to server. - - :ivar instance_type: Gets the Instance type. Required. - :vartype instance_type: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - } - - _subtype_map = { - "instance_type": { - "A2A": "A2AReplicationDetails", - "A2ACrossClusterMigration": "A2ACrossClusterMigrationReplicationDetails", - "HyperVReplica2012": "HyperVReplicaReplicationDetails", - "HyperVReplica2012R2": "HyperVReplicaBlueReplicationDetails", - "HyperVReplicaAzure": "HyperVReplicaAzureReplicationDetails", - "HyperVReplicaBaseReplicationDetails": "HyperVReplicaBaseReplicationDetails", - "InMage": "InMageReplicationDetails", - "InMageAzureV2": "InMageAzureV2ReplicationDetails", - "InMageRcm": "InMageRcmReplicationDetails", - "InMageRcmFailback": "InMageRcmFailbackReplicationDetails", - } - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.instance_type: Optional[str] = None - - -class A2ACrossClusterMigrationReplicationDetails(ReplicationProviderSpecificSettings): # pylint: disable=name-too-long - """A2A provider specific settings. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: Gets the Instance type. Required. - :vartype instance_type: str - :ivar fabric_object_id: The fabric specific object Id of the virtual machine. - :vartype fabric_object_id: str - :ivar primary_fabric_location: Primary fabric location. - :vartype primary_fabric_location: str - :ivar os_type: The type of operating system. - :vartype os_type: str - :ivar vm_protection_state: The protection state for the vm. - :vartype vm_protection_state: str - :ivar vm_protection_state_description: The protection state description for the vm. - :vartype vm_protection_state_description: str - :ivar lifecycle_id: An id associated with the PE that survives actions like switch protection - which change the backing PE/CPE objects internally.The lifecycle id gets carried forward to - have a link/continuity in being able to have an Id that denotes the "same" protected item even - though other internal Ids/ARM Id might be changing. - :vartype lifecycle_id: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "fabric_object_id": {"key": "fabricObjectId", "type": "str"}, - "primary_fabric_location": {"key": "primaryFabricLocation", "type": "str"}, - "os_type": {"key": "osType", "type": "str"}, - "vm_protection_state": {"key": "vmProtectionState", "type": "str"}, - "vm_protection_state_description": {"key": "vmProtectionStateDescription", "type": "str"}, - "lifecycle_id": {"key": "lifecycleId", "type": "str"}, - } - - def __init__( - self, - *, - fabric_object_id: Optional[str] = None, - primary_fabric_location: Optional[str] = None, - os_type: Optional[str] = None, - vm_protection_state: Optional[str] = None, - vm_protection_state_description: Optional[str] = None, - lifecycle_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword fabric_object_id: The fabric specific object Id of the virtual machine. - :paramtype fabric_object_id: str - :keyword primary_fabric_location: Primary fabric location. - :paramtype primary_fabric_location: str - :keyword os_type: The type of operating system. - :paramtype os_type: str - :keyword vm_protection_state: The protection state for the vm. - :paramtype vm_protection_state: str - :keyword vm_protection_state_description: The protection state description for the vm. - :paramtype vm_protection_state_description: str - :keyword lifecycle_id: An id associated with the PE that survives actions like switch - protection which change the backing PE/CPE objects internally.The lifecycle id gets carried - forward to have a link/continuity in being able to have an Id that denotes the "same" protected - item even though other internal Ids/ARM Id might be changing. - :paramtype lifecycle_id: str - """ - super().__init__(**kwargs) - self.instance_type: str = "A2ACrossClusterMigration" - self.fabric_object_id = fabric_object_id - self.primary_fabric_location = primary_fabric_location - self.os_type = os_type - self.vm_protection_state = vm_protection_state - self.vm_protection_state_description = vm_protection_state_description - self.lifecycle_id = lifecycle_id - - -class A2AEnableProtectionInput(EnableProtectionProviderSpecificInput): - """A2A enable protection input. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - :ivar fabric_object_id: The fabric specific object Id of the virtual machine. Required. - :vartype fabric_object_id: str - :ivar recovery_container_id: The recovery container Id. - :vartype recovery_container_id: str - :ivar recovery_resource_group_id: The recovery resource group Id. Valid for V2 scenarios. - :vartype recovery_resource_group_id: str - :ivar recovery_cloud_service_id: The recovery cloud service Id. Valid for V1 scenarios. - :vartype recovery_cloud_service_id: str - :ivar recovery_availability_set_id: The recovery availability set Id. - :vartype recovery_availability_set_id: str - :ivar recovery_proximity_placement_group_id: The recovery proximity placement group Id. - :vartype recovery_proximity_placement_group_id: str - :ivar vm_disks: The list of vm disk details. - :vartype vm_disks: list[~azure.mgmt.recoveryservicessiterecovery.models.A2AVmDiskInputDetails] - :ivar vm_managed_disks: The list of vm managed disk details. - :vartype vm_managed_disks: - list[~azure.mgmt.recoveryservicessiterecovery.models.A2AVmManagedDiskInputDetails] - :ivar multi_vm_group_name: The multi vm group name. - :vartype multi_vm_group_name: str - :ivar multi_vm_group_id: The multi vm group id. - :vartype multi_vm_group_id: str - :ivar protection_cluster_id: The replication protection cluster Id. - :vartype protection_cluster_id: str - :ivar recovery_boot_diag_storage_account_id: The boot diagnostic storage account. - :vartype recovery_boot_diag_storage_account_id: str - :ivar disk_encryption_info: The recovery disk encryption information (for two pass flows). - :vartype disk_encryption_info: - ~azure.mgmt.recoveryservicessiterecovery.models.DiskEncryptionInfo - :ivar recovery_availability_zone: The recovery availability zone. - :vartype recovery_availability_zone: str - :ivar recovery_extended_location: The recovery extended location. - :vartype recovery_extended_location: - ~azure.mgmt.recoveryservicessiterecovery.models.ExtendedLocation - :ivar recovery_azure_network_id: The recovery Azure virtual network ARM id. - :vartype recovery_azure_network_id: str - :ivar recovery_subnet_name: The recovery subnet name. - :vartype recovery_subnet_name: str - :ivar recovery_virtual_machine_scale_set_id: The virtual machine scale set Id. - :vartype recovery_virtual_machine_scale_set_id: str - :ivar recovery_capacity_reservation_group_id: The recovery capacity reservation group Id. - :vartype recovery_capacity_reservation_group_id: str - :ivar auto_protection_of_data_disk: A value indicating whether the auto protection is enabled. - Known values are: "Disabled" and "Enabled". - :vartype auto_protection_of_data_disk: str or - ~azure.mgmt.recoveryservicessiterecovery.models.AutoProtectionOfDataDisk - """ - - _validation = { - "instance_type": {"required": True}, - "fabric_object_id": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "fabric_object_id": {"key": "fabricObjectId", "type": "str"}, - "recovery_container_id": {"key": "recoveryContainerId", "type": "str"}, - "recovery_resource_group_id": {"key": "recoveryResourceGroupId", "type": "str"}, - "recovery_cloud_service_id": {"key": "recoveryCloudServiceId", "type": "str"}, - "recovery_availability_set_id": {"key": "recoveryAvailabilitySetId", "type": "str"}, - "recovery_proximity_placement_group_id": {"key": "recoveryProximityPlacementGroupId", "type": "str"}, - "vm_disks": {"key": "vmDisks", "type": "[A2AVmDiskInputDetails]"}, - "vm_managed_disks": {"key": "vmManagedDisks", "type": "[A2AVmManagedDiskInputDetails]"}, - "multi_vm_group_name": {"key": "multiVmGroupName", "type": "str"}, - "multi_vm_group_id": {"key": "multiVmGroupId", "type": "str"}, - "protection_cluster_id": {"key": "protectionClusterId", "type": "str"}, - "recovery_boot_diag_storage_account_id": {"key": "recoveryBootDiagStorageAccountId", "type": "str"}, - "disk_encryption_info": {"key": "diskEncryptionInfo", "type": "DiskEncryptionInfo"}, - "recovery_availability_zone": {"key": "recoveryAvailabilityZone", "type": "str"}, - "recovery_extended_location": {"key": "recoveryExtendedLocation", "type": "ExtendedLocation"}, - "recovery_azure_network_id": {"key": "recoveryAzureNetworkId", "type": "str"}, - "recovery_subnet_name": {"key": "recoverySubnetName", "type": "str"}, - "recovery_virtual_machine_scale_set_id": {"key": "recoveryVirtualMachineScaleSetId", "type": "str"}, - "recovery_capacity_reservation_group_id": {"key": "recoveryCapacityReservationGroupId", "type": "str"}, - "auto_protection_of_data_disk": {"key": "autoProtectionOfDataDisk", "type": "str"}, - } - - def __init__( - self, - *, - fabric_object_id: str, - recovery_container_id: Optional[str] = None, - recovery_resource_group_id: Optional[str] = None, - recovery_cloud_service_id: Optional[str] = None, - recovery_availability_set_id: Optional[str] = None, - recovery_proximity_placement_group_id: Optional[str] = None, - vm_disks: Optional[List["_models.A2AVmDiskInputDetails"]] = None, - vm_managed_disks: Optional[List["_models.A2AVmManagedDiskInputDetails"]] = None, - multi_vm_group_name: Optional[str] = None, - multi_vm_group_id: Optional[str] = None, - protection_cluster_id: Optional[str] = None, - recovery_boot_diag_storage_account_id: Optional[str] = None, - disk_encryption_info: Optional["_models.DiskEncryptionInfo"] = None, - recovery_availability_zone: Optional[str] = None, - recovery_extended_location: Optional["_models.ExtendedLocation"] = None, - recovery_azure_network_id: Optional[str] = None, - recovery_subnet_name: Optional[str] = None, - recovery_virtual_machine_scale_set_id: Optional[str] = None, - recovery_capacity_reservation_group_id: Optional[str] = None, - auto_protection_of_data_disk: Optional[Union[str, "_models.AutoProtectionOfDataDisk"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword fabric_object_id: The fabric specific object Id of the virtual machine. Required. - :paramtype fabric_object_id: str - :keyword recovery_container_id: The recovery container Id. - :paramtype recovery_container_id: str - :keyword recovery_resource_group_id: The recovery resource group Id. Valid for V2 scenarios. - :paramtype recovery_resource_group_id: str - :keyword recovery_cloud_service_id: The recovery cloud service Id. Valid for V1 scenarios. - :paramtype recovery_cloud_service_id: str - :keyword recovery_availability_set_id: The recovery availability set Id. - :paramtype recovery_availability_set_id: str - :keyword recovery_proximity_placement_group_id: The recovery proximity placement group Id. - :paramtype recovery_proximity_placement_group_id: str - :keyword vm_disks: The list of vm disk details. - :paramtype vm_disks: - list[~azure.mgmt.recoveryservicessiterecovery.models.A2AVmDiskInputDetails] - :keyword vm_managed_disks: The list of vm managed disk details. - :paramtype vm_managed_disks: - list[~azure.mgmt.recoveryservicessiterecovery.models.A2AVmManagedDiskInputDetails] - :keyword multi_vm_group_name: The multi vm group name. - :paramtype multi_vm_group_name: str - :keyword multi_vm_group_id: The multi vm group id. - :paramtype multi_vm_group_id: str - :keyword protection_cluster_id: The replication protection cluster Id. - :paramtype protection_cluster_id: str - :keyword recovery_boot_diag_storage_account_id: The boot diagnostic storage account. - :paramtype recovery_boot_diag_storage_account_id: str - :keyword disk_encryption_info: The recovery disk encryption information (for two pass flows). - :paramtype disk_encryption_info: - ~azure.mgmt.recoveryservicessiterecovery.models.DiskEncryptionInfo - :keyword recovery_availability_zone: The recovery availability zone. - :paramtype recovery_availability_zone: str - :keyword recovery_extended_location: The recovery extended location. - :paramtype recovery_extended_location: - ~azure.mgmt.recoveryservicessiterecovery.models.ExtendedLocation - :keyword recovery_azure_network_id: The recovery Azure virtual network ARM id. - :paramtype recovery_azure_network_id: str - :keyword recovery_subnet_name: The recovery subnet name. - :paramtype recovery_subnet_name: str - :keyword recovery_virtual_machine_scale_set_id: The virtual machine scale set Id. - :paramtype recovery_virtual_machine_scale_set_id: str - :keyword recovery_capacity_reservation_group_id: The recovery capacity reservation group Id. - :paramtype recovery_capacity_reservation_group_id: str - :keyword auto_protection_of_data_disk: A value indicating whether the auto protection is - enabled. Known values are: "Disabled" and "Enabled". - :paramtype auto_protection_of_data_disk: str or - ~azure.mgmt.recoveryservicessiterecovery.models.AutoProtectionOfDataDisk - """ - super().__init__(**kwargs) - self.instance_type: str = "A2A" - self.fabric_object_id = fabric_object_id - self.recovery_container_id = recovery_container_id - self.recovery_resource_group_id = recovery_resource_group_id - self.recovery_cloud_service_id = recovery_cloud_service_id - self.recovery_availability_set_id = recovery_availability_set_id - self.recovery_proximity_placement_group_id = recovery_proximity_placement_group_id - self.vm_disks = vm_disks - self.vm_managed_disks = vm_managed_disks - self.multi_vm_group_name = multi_vm_group_name - self.multi_vm_group_id = multi_vm_group_id - self.protection_cluster_id = protection_cluster_id - self.recovery_boot_diag_storage_account_id = recovery_boot_diag_storage_account_id - self.disk_encryption_info = disk_encryption_info - self.recovery_availability_zone = recovery_availability_zone - self.recovery_extended_location = recovery_extended_location - self.recovery_azure_network_id = recovery_azure_network_id - self.recovery_subnet_name = recovery_subnet_name - self.recovery_virtual_machine_scale_set_id = recovery_virtual_machine_scale_set_id - self.recovery_capacity_reservation_group_id = recovery_capacity_reservation_group_id - self.auto_protection_of_data_disk = auto_protection_of_data_disk - - -class EventProviderSpecificDetails(_serialization.Model): - """Model class for provider specific details for an event. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - A2AEventDetails, HyperVReplica2012EventDetails, HyperVReplica2012R2EventDetails, - HyperVReplicaAzureEventDetails, HyperVReplicaBaseEventDetails, InMageAzureV2EventDetails, - InMageRcmEventDetails, InMageRcmFailbackEventDetails, VMwareCbtEventDetails - - All required parameters must be populated in order to send to server. - - :ivar instance_type: Gets the class type. Overridden in derived classes. Required. - :vartype instance_type: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - } - - _subtype_map = { - "instance_type": { - "A2A": "A2AEventDetails", - "HyperVReplica2012": "HyperVReplica2012EventDetails", - "HyperVReplica2012R2": "HyperVReplica2012R2EventDetails", - "HyperVReplicaAzure": "HyperVReplicaAzureEventDetails", - "HyperVReplicaBaseEventDetails": "HyperVReplicaBaseEventDetails", - "InMageAzureV2": "InMageAzureV2EventDetails", - "InMageRcm": "InMageRcmEventDetails", - "InMageRcmFailback": "InMageRcmFailbackEventDetails", - "VMwareCbt": "VMwareCbtEventDetails", - } - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.instance_type: Optional[str] = None - - -class A2AEventDetails(EventProviderSpecificDetails): - """Model class for event details of a A2A event. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: Gets the class type. Overridden in derived classes. Required. - :vartype instance_type: str - :ivar protected_item_name: The protected item arm name. - :vartype protected_item_name: str - :ivar fabric_object_id: The azure vm arm id. - :vartype fabric_object_id: str - :ivar fabric_name: Fabric arm name. - :vartype fabric_name: str - :ivar fabric_location: The fabric location. - :vartype fabric_location: str - :ivar remote_fabric_name: Remote fabric arm name. - :vartype remote_fabric_name: str - :ivar remote_fabric_location: Remote fabric location. - :vartype remote_fabric_location: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "protected_item_name": {"key": "protectedItemName", "type": "str"}, - "fabric_object_id": {"key": "fabricObjectId", "type": "str"}, - "fabric_name": {"key": "fabricName", "type": "str"}, - "fabric_location": {"key": "fabricLocation", "type": "str"}, - "remote_fabric_name": {"key": "remoteFabricName", "type": "str"}, - "remote_fabric_location": {"key": "remoteFabricLocation", "type": "str"}, - } - - def __init__( - self, - *, - protected_item_name: Optional[str] = None, - fabric_object_id: Optional[str] = None, - fabric_name: Optional[str] = None, - fabric_location: Optional[str] = None, - remote_fabric_name: Optional[str] = None, - remote_fabric_location: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword protected_item_name: The protected item arm name. - :paramtype protected_item_name: str - :keyword fabric_object_id: The azure vm arm id. - :paramtype fabric_object_id: str - :keyword fabric_name: Fabric arm name. - :paramtype fabric_name: str - :keyword fabric_location: The fabric location. - :paramtype fabric_location: str - :keyword remote_fabric_name: Remote fabric arm name. - :paramtype remote_fabric_name: str - :keyword remote_fabric_location: Remote fabric location. - :paramtype remote_fabric_location: str - """ - super().__init__(**kwargs) - self.instance_type: str = "A2A" - self.protected_item_name = protected_item_name - self.fabric_object_id = fabric_object_id - self.fabric_name = fabric_name - self.fabric_location = fabric_location - self.remote_fabric_name = remote_fabric_name - self.remote_fabric_location = remote_fabric_location - - -class A2AExtendedLocationDetails(_serialization.Model): - """ExtendedLocation details data. - - :ivar primary_extended_location: The primary ExtendedLocation. - :vartype primary_extended_location: - ~azure.mgmt.recoveryservicessiterecovery.models.ExtendedLocation - :ivar recovery_extended_location: The recovery ExtendedLocation. - :vartype recovery_extended_location: - ~azure.mgmt.recoveryservicessiterecovery.models.ExtendedLocation - """ - - _attribute_map = { - "primary_extended_location": {"key": "primaryExtendedLocation", "type": "ExtendedLocation"}, - "recovery_extended_location": {"key": "recoveryExtendedLocation", "type": "ExtendedLocation"}, - } - - def __init__( - self, - *, - primary_extended_location: Optional["_models.ExtendedLocation"] = None, - recovery_extended_location: Optional["_models.ExtendedLocation"] = None, - **kwargs: Any - ) -> None: - """ - :keyword primary_extended_location: The primary ExtendedLocation. - :paramtype primary_extended_location: - ~azure.mgmt.recoveryservicessiterecovery.models.ExtendedLocation - :keyword recovery_extended_location: The recovery ExtendedLocation. - :paramtype recovery_extended_location: - ~azure.mgmt.recoveryservicessiterecovery.models.ExtendedLocation - """ - super().__init__(**kwargs) - self.primary_extended_location = primary_extended_location - self.recovery_extended_location = recovery_extended_location - - -class A2AFabricSpecificLocationDetails(_serialization.Model): - """ExtendedLocation details data. - - :ivar initial_primary_zone: The initial source zone info. - :vartype initial_primary_zone: str - :ivar initial_recovery_zone: The initial target zone info. - :vartype initial_recovery_zone: str - :ivar initial_primary_extended_location: The initial primary ExtendedLocation. - :vartype initial_primary_extended_location: - ~azure.mgmt.recoveryservicessiterecovery.models.ExtendedLocation - :ivar initial_recovery_extended_location: The initial recovery ExtendedLocation. - :vartype initial_recovery_extended_location: - ~azure.mgmt.recoveryservicessiterecovery.models.ExtendedLocation - :ivar initial_primary_fabric_location: Initial primary fabric location info. - :vartype initial_primary_fabric_location: str - :ivar initial_recovery_fabric_location: The initial recovery fabric location info. - :vartype initial_recovery_fabric_location: str - :ivar primary_zone: Source zone info. - :vartype primary_zone: str - :ivar recovery_zone: The target zone info. - :vartype recovery_zone: str - :ivar primary_extended_location: The primary ExtendedLocation. - :vartype primary_extended_location: - ~azure.mgmt.recoveryservicessiterecovery.models.ExtendedLocation - :ivar recovery_extended_location: The recovery ExtendedLocation. - :vartype recovery_extended_location: - ~azure.mgmt.recoveryservicessiterecovery.models.ExtendedLocation - :ivar primary_fabric_location: Primary fabric location info. - :vartype primary_fabric_location: str - :ivar recovery_fabric_location: The recovery fabric location info. - :vartype recovery_fabric_location: str - """ - - _attribute_map = { - "initial_primary_zone": {"key": "initialPrimaryZone", "type": "str"}, - "initial_recovery_zone": {"key": "initialRecoveryZone", "type": "str"}, - "initial_primary_extended_location": {"key": "initialPrimaryExtendedLocation", "type": "ExtendedLocation"}, - "initial_recovery_extended_location": {"key": "initialRecoveryExtendedLocation", "type": "ExtendedLocation"}, - "initial_primary_fabric_location": {"key": "initialPrimaryFabricLocation", "type": "str"}, - "initial_recovery_fabric_location": {"key": "initialRecoveryFabricLocation", "type": "str"}, - "primary_zone": {"key": "primaryZone", "type": "str"}, - "recovery_zone": {"key": "recoveryZone", "type": "str"}, - "primary_extended_location": {"key": "primaryExtendedLocation", "type": "ExtendedLocation"}, - "recovery_extended_location": {"key": "recoveryExtendedLocation", "type": "ExtendedLocation"}, - "primary_fabric_location": {"key": "primaryFabricLocation", "type": "str"}, - "recovery_fabric_location": {"key": "recoveryFabricLocation", "type": "str"}, - } - - def __init__( - self, - *, - initial_primary_zone: Optional[str] = None, - initial_recovery_zone: Optional[str] = None, - initial_primary_extended_location: Optional["_models.ExtendedLocation"] = None, - initial_recovery_extended_location: Optional["_models.ExtendedLocation"] = None, - initial_primary_fabric_location: Optional[str] = None, - initial_recovery_fabric_location: Optional[str] = None, - primary_zone: Optional[str] = None, - recovery_zone: Optional[str] = None, - primary_extended_location: Optional["_models.ExtendedLocation"] = None, - recovery_extended_location: Optional["_models.ExtendedLocation"] = None, - primary_fabric_location: Optional[str] = None, - recovery_fabric_location: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword initial_primary_zone: The initial source zone info. - :paramtype initial_primary_zone: str - :keyword initial_recovery_zone: The initial target zone info. - :paramtype initial_recovery_zone: str - :keyword initial_primary_extended_location: The initial primary ExtendedLocation. - :paramtype initial_primary_extended_location: - ~azure.mgmt.recoveryservicessiterecovery.models.ExtendedLocation - :keyword initial_recovery_extended_location: The initial recovery ExtendedLocation. - :paramtype initial_recovery_extended_location: - ~azure.mgmt.recoveryservicessiterecovery.models.ExtendedLocation - :keyword initial_primary_fabric_location: Initial primary fabric location info. - :paramtype initial_primary_fabric_location: str - :keyword initial_recovery_fabric_location: The initial recovery fabric location info. - :paramtype initial_recovery_fabric_location: str - :keyword primary_zone: Source zone info. - :paramtype primary_zone: str - :keyword recovery_zone: The target zone info. - :paramtype recovery_zone: str - :keyword primary_extended_location: The primary ExtendedLocation. - :paramtype primary_extended_location: - ~azure.mgmt.recoveryservicessiterecovery.models.ExtendedLocation - :keyword recovery_extended_location: The recovery ExtendedLocation. - :paramtype recovery_extended_location: - ~azure.mgmt.recoveryservicessiterecovery.models.ExtendedLocation - :keyword primary_fabric_location: Primary fabric location info. - :paramtype primary_fabric_location: str - :keyword recovery_fabric_location: The recovery fabric location info. - :paramtype recovery_fabric_location: str - """ - super().__init__(**kwargs) - self.initial_primary_zone = initial_primary_zone - self.initial_recovery_zone = initial_recovery_zone - self.initial_primary_extended_location = initial_primary_extended_location - self.initial_recovery_extended_location = initial_recovery_extended_location - self.initial_primary_fabric_location = initial_primary_fabric_location - self.initial_recovery_fabric_location = initial_recovery_fabric_location - self.primary_zone = primary_zone - self.recovery_zone = recovery_zone - self.primary_extended_location = primary_extended_location - self.recovery_extended_location = recovery_extended_location - self.primary_fabric_location = primary_fabric_location - self.recovery_fabric_location = recovery_fabric_location - - -class A2APolicyCreationInput(PolicyProviderSpecificInput): - """A2A Policy creation input. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - :ivar recovery_point_history: The duration in minutes until which the recovery points need to - be stored. - :vartype recovery_point_history: int - :ivar crash_consistent_frequency_in_minutes: The crash consistent snapshot frequency (in - minutes). - :vartype crash_consistent_frequency_in_minutes: int - :ivar app_consistent_frequency_in_minutes: The app consistent snapshot frequency (in minutes). - :vartype app_consistent_frequency_in_minutes: int - :ivar multi_vm_sync_status: A value indicating whether multi-VM sync has to be enabled. Value - should be 'Enabled' or 'Disabled'. Required. Known values are: "Enable" and "Disable". - :vartype multi_vm_sync_status: str or - ~azure.mgmt.recoveryservicessiterecovery.models.SetMultiVmSyncStatus - """ - - _validation = { - "instance_type": {"required": True}, - "multi_vm_sync_status": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "recovery_point_history": {"key": "recoveryPointHistory", "type": "int"}, - "crash_consistent_frequency_in_minutes": {"key": "crashConsistentFrequencyInMinutes", "type": "int"}, - "app_consistent_frequency_in_minutes": {"key": "appConsistentFrequencyInMinutes", "type": "int"}, - "multi_vm_sync_status": {"key": "multiVmSyncStatus", "type": "str"}, - } - - def __init__( - self, - *, - multi_vm_sync_status: Union[str, "_models.SetMultiVmSyncStatus"], - recovery_point_history: Optional[int] = None, - crash_consistent_frequency_in_minutes: Optional[int] = None, - app_consistent_frequency_in_minutes: Optional[int] = None, - **kwargs: Any - ) -> None: - """ - :keyword recovery_point_history: The duration in minutes until which the recovery points need - to be stored. - :paramtype recovery_point_history: int - :keyword crash_consistent_frequency_in_minutes: The crash consistent snapshot frequency (in - minutes). - :paramtype crash_consistent_frequency_in_minutes: int - :keyword app_consistent_frequency_in_minutes: The app consistent snapshot frequency (in - minutes). - :paramtype app_consistent_frequency_in_minutes: int - :keyword multi_vm_sync_status: A value indicating whether multi-VM sync has to be enabled. - Value should be 'Enabled' or 'Disabled'. Required. Known values are: "Enable" and "Disable". - :paramtype multi_vm_sync_status: str or - ~azure.mgmt.recoveryservicessiterecovery.models.SetMultiVmSyncStatus - """ - super().__init__(**kwargs) - self.instance_type: str = "A2A" - self.recovery_point_history = recovery_point_history - self.crash_consistent_frequency_in_minutes = crash_consistent_frequency_in_minutes - self.app_consistent_frequency_in_minutes = app_consistent_frequency_in_minutes - self.multi_vm_sync_status = multi_vm_sync_status - - -class PolicyProviderSpecificDetails(_serialization.Model): - """Base class for Provider specific details for policies. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - A2APolicyDetails, HyperVReplicaPolicyDetails, HyperVReplicaBluePolicyDetails, - HyperVReplicaAzurePolicyDetails, HyperVReplicaBasePolicyDetails, InMagePolicyDetails, - InMageAzureV2PolicyDetails, InMageBasePolicyDetails, InMageRcmPolicyDetails, - InMageRcmFailbackPolicyDetails, VmwareCbtPolicyDetails - - All required parameters must be populated in order to send to server. - - :ivar instance_type: Gets the class type. Overridden in derived classes. Required. - :vartype instance_type: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - } - - _subtype_map = { - "instance_type": { - "A2A": "A2APolicyDetails", - "HyperVReplica2012": "HyperVReplicaPolicyDetails", - "HyperVReplica2012R2": "HyperVReplicaBluePolicyDetails", - "HyperVReplicaAzure": "HyperVReplicaAzurePolicyDetails", - "HyperVReplicaBasePolicyDetails": "HyperVReplicaBasePolicyDetails", - "InMage": "InMagePolicyDetails", - "InMageAzureV2": "InMageAzureV2PolicyDetails", - "InMageBasePolicyDetails": "InMageBasePolicyDetails", - "InMageRcm": "InMageRcmPolicyDetails", - "InMageRcmFailback": "InMageRcmFailbackPolicyDetails", - "VMwareCbt": "VmwareCbtPolicyDetails", - } - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.instance_type: Optional[str] = None - - -class A2APolicyDetails(PolicyProviderSpecificDetails): - """A2A specific policy details. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: Gets the class type. Overridden in derived classes. Required. - :vartype instance_type: str - :ivar recovery_point_threshold_in_minutes: The recovery point threshold in minutes. - :vartype recovery_point_threshold_in_minutes: int - :ivar recovery_point_history: The duration in minutes until which the recovery points need to - be stored. - :vartype recovery_point_history: int - :ivar app_consistent_frequency_in_minutes: The app consistent snapshot frequency in minutes. - :vartype app_consistent_frequency_in_minutes: int - :ivar multi_vm_sync_status: A value indicating whether multi-VM sync has to be enabled. - :vartype multi_vm_sync_status: str - :ivar crash_consistent_frequency_in_minutes: The crash consistent snapshot frequency in - minutes. - :vartype crash_consistent_frequency_in_minutes: int - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "recovery_point_threshold_in_minutes": {"key": "recoveryPointThresholdInMinutes", "type": "int"}, - "recovery_point_history": {"key": "recoveryPointHistory", "type": "int"}, - "app_consistent_frequency_in_minutes": {"key": "appConsistentFrequencyInMinutes", "type": "int"}, - "multi_vm_sync_status": {"key": "multiVmSyncStatus", "type": "str"}, - "crash_consistent_frequency_in_minutes": {"key": "crashConsistentFrequencyInMinutes", "type": "int"}, - } - - def __init__( - self, - *, - recovery_point_threshold_in_minutes: Optional[int] = None, - recovery_point_history: Optional[int] = None, - app_consistent_frequency_in_minutes: Optional[int] = None, - multi_vm_sync_status: Optional[str] = None, - crash_consistent_frequency_in_minutes: Optional[int] = None, - **kwargs: Any - ) -> None: - """ - :keyword recovery_point_threshold_in_minutes: The recovery point threshold in minutes. - :paramtype recovery_point_threshold_in_minutes: int - :keyword recovery_point_history: The duration in minutes until which the recovery points need - to be stored. - :paramtype recovery_point_history: int - :keyword app_consistent_frequency_in_minutes: The app consistent snapshot frequency in minutes. - :paramtype app_consistent_frequency_in_minutes: int - :keyword multi_vm_sync_status: A value indicating whether multi-VM sync has to be enabled. - :paramtype multi_vm_sync_status: str - :keyword crash_consistent_frequency_in_minutes: The crash consistent snapshot frequency in - minutes. - :paramtype crash_consistent_frequency_in_minutes: int - """ - super().__init__(**kwargs) - self.instance_type: str = "A2A" - self.recovery_point_threshold_in_minutes = recovery_point_threshold_in_minutes - self.recovery_point_history = recovery_point_history - self.app_consistent_frequency_in_minutes = app_consistent_frequency_in_minutes - self.multi_vm_sync_status = multi_vm_sync_status - self.crash_consistent_frequency_in_minutes = crash_consistent_frequency_in_minutes - - -class A2AProtectedDiskDetails(_serialization.Model): - """A2A protected disk details. - - :ivar disk_uri: The disk uri. - :vartype disk_uri: str - :ivar recovery_azure_storage_account_id: The recovery disk storage account. - :vartype recovery_azure_storage_account_id: str - :ivar primary_disk_azure_storage_account_id: The primary disk storage account. - :vartype primary_disk_azure_storage_account_id: str - :ivar recovery_disk_uri: Recovery disk uri. - :vartype recovery_disk_uri: str - :ivar disk_name: The disk name. - :vartype disk_name: str - :ivar disk_capacity_in_bytes: The disk capacity in bytes. - :vartype disk_capacity_in_bytes: int - :ivar primary_staging_azure_storage_account_id: The primary staging storage account. - :vartype primary_staging_azure_storage_account_id: str - :ivar disk_type: The type of disk. - :vartype disk_type: str - :ivar resync_required: A value indicating whether resync is required for this disk. - :vartype resync_required: bool - :ivar monitoring_percentage_completion: The percentage of the monitoring job. The type of the - monitoring job is defined by MonitoringJobType property. - :vartype monitoring_percentage_completion: int - :ivar monitoring_job_type: The type of the monitoring job. The progress is contained in - MonitoringPercentageCompletion property. - :vartype monitoring_job_type: str - :ivar data_pending_in_staging_storage_account_in_mb: The data pending for replication in MB at - staging account. - :vartype data_pending_in_staging_storage_account_in_mb: float - :ivar data_pending_at_source_agent_in_mb: The data pending at source virtual machine in MB. - :vartype data_pending_at_source_agent_in_mb: float - :ivar disk_state: The disk state. - :vartype disk_state: str - :ivar allowed_disk_level_operation: The disk level operations list. - :vartype allowed_disk_level_operation: list[str] - :ivar is_disk_encrypted: A value indicating whether vm has encrypted os disk or not. - :vartype is_disk_encrypted: bool - :ivar secret_identifier: The secret URL / identifier (BEK). - :vartype secret_identifier: str - :ivar dek_key_vault_arm_id: The KeyVault resource id for secret (BEK). - :vartype dek_key_vault_arm_id: str - :ivar is_disk_key_encrypted: A value indicating whether disk key got encrypted or not. - :vartype is_disk_key_encrypted: bool - :ivar key_identifier: The key URL / identifier (KEK). - :vartype key_identifier: str - :ivar kek_key_vault_arm_id: The KeyVault resource id for key (KEK). - :vartype kek_key_vault_arm_id: str - :ivar failover_disk_name: The failover name for the managed disk. - :vartype failover_disk_name: str - :ivar tfo_disk_name: The test failover name for the managed disk. - :vartype tfo_disk_name: str - """ - - _attribute_map = { - "disk_uri": {"key": "diskUri", "type": "str"}, - "recovery_azure_storage_account_id": {"key": "recoveryAzureStorageAccountId", "type": "str"}, - "primary_disk_azure_storage_account_id": {"key": "primaryDiskAzureStorageAccountId", "type": "str"}, - "recovery_disk_uri": {"key": "recoveryDiskUri", "type": "str"}, - "disk_name": {"key": "diskName", "type": "str"}, - "disk_capacity_in_bytes": {"key": "diskCapacityInBytes", "type": "int"}, - "primary_staging_azure_storage_account_id": {"key": "primaryStagingAzureStorageAccountId", "type": "str"}, - "disk_type": {"key": "diskType", "type": "str"}, - "resync_required": {"key": "resyncRequired", "type": "bool"}, - "monitoring_percentage_completion": {"key": "monitoringPercentageCompletion", "type": "int"}, - "monitoring_job_type": {"key": "monitoringJobType", "type": "str"}, - "data_pending_in_staging_storage_account_in_mb": { - "key": "dataPendingInStagingStorageAccountInMB", - "type": "float", - }, - "data_pending_at_source_agent_in_mb": {"key": "dataPendingAtSourceAgentInMB", "type": "float"}, - "disk_state": {"key": "diskState", "type": "str"}, - "allowed_disk_level_operation": {"key": "allowedDiskLevelOperation", "type": "[str]"}, - "is_disk_encrypted": {"key": "isDiskEncrypted", "type": "bool"}, - "secret_identifier": {"key": "secretIdentifier", "type": "str"}, - "dek_key_vault_arm_id": {"key": "dekKeyVaultArmId", "type": "str"}, - "is_disk_key_encrypted": {"key": "isDiskKeyEncrypted", "type": "bool"}, - "key_identifier": {"key": "keyIdentifier", "type": "str"}, - "kek_key_vault_arm_id": {"key": "kekKeyVaultArmId", "type": "str"}, - "failover_disk_name": {"key": "failoverDiskName", "type": "str"}, - "tfo_disk_name": {"key": "tfoDiskName", "type": "str"}, - } - - def __init__( - self, - *, - disk_uri: Optional[str] = None, - recovery_azure_storage_account_id: Optional[str] = None, - primary_disk_azure_storage_account_id: Optional[str] = None, - recovery_disk_uri: Optional[str] = None, - disk_name: Optional[str] = None, - disk_capacity_in_bytes: Optional[int] = None, - primary_staging_azure_storage_account_id: Optional[str] = None, - disk_type: Optional[str] = None, - resync_required: Optional[bool] = None, - monitoring_percentage_completion: Optional[int] = None, - monitoring_job_type: Optional[str] = None, - data_pending_in_staging_storage_account_in_mb: Optional[float] = None, - data_pending_at_source_agent_in_mb: Optional[float] = None, - disk_state: Optional[str] = None, - allowed_disk_level_operation: Optional[List[str]] = None, - is_disk_encrypted: Optional[bool] = None, - secret_identifier: Optional[str] = None, - dek_key_vault_arm_id: Optional[str] = None, - is_disk_key_encrypted: Optional[bool] = None, - key_identifier: Optional[str] = None, - kek_key_vault_arm_id: Optional[str] = None, - failover_disk_name: Optional[str] = None, - tfo_disk_name: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword disk_uri: The disk uri. - :paramtype disk_uri: str - :keyword recovery_azure_storage_account_id: The recovery disk storage account. - :paramtype recovery_azure_storage_account_id: str - :keyword primary_disk_azure_storage_account_id: The primary disk storage account. - :paramtype primary_disk_azure_storage_account_id: str - :keyword recovery_disk_uri: Recovery disk uri. - :paramtype recovery_disk_uri: str - :keyword disk_name: The disk name. - :paramtype disk_name: str - :keyword disk_capacity_in_bytes: The disk capacity in bytes. - :paramtype disk_capacity_in_bytes: int - :keyword primary_staging_azure_storage_account_id: The primary staging storage account. - :paramtype primary_staging_azure_storage_account_id: str - :keyword disk_type: The type of disk. - :paramtype disk_type: str - :keyword resync_required: A value indicating whether resync is required for this disk. - :paramtype resync_required: bool - :keyword monitoring_percentage_completion: The percentage of the monitoring job. The type of - the monitoring job is defined by MonitoringJobType property. - :paramtype monitoring_percentage_completion: int - :keyword monitoring_job_type: The type of the monitoring job. The progress is contained in - MonitoringPercentageCompletion property. - :paramtype monitoring_job_type: str - :keyword data_pending_in_staging_storage_account_in_mb: The data pending for replication in MB - at staging account. - :paramtype data_pending_in_staging_storage_account_in_mb: float - :keyword data_pending_at_source_agent_in_mb: The data pending at source virtual machine in MB. - :paramtype data_pending_at_source_agent_in_mb: float - :keyword disk_state: The disk state. - :paramtype disk_state: str - :keyword allowed_disk_level_operation: The disk level operations list. - :paramtype allowed_disk_level_operation: list[str] - :keyword is_disk_encrypted: A value indicating whether vm has encrypted os disk or not. - :paramtype is_disk_encrypted: bool - :keyword secret_identifier: The secret URL / identifier (BEK). - :paramtype secret_identifier: str - :keyword dek_key_vault_arm_id: The KeyVault resource id for secret (BEK). - :paramtype dek_key_vault_arm_id: str - :keyword is_disk_key_encrypted: A value indicating whether disk key got encrypted or not. - :paramtype is_disk_key_encrypted: bool - :keyword key_identifier: The key URL / identifier (KEK). - :paramtype key_identifier: str - :keyword kek_key_vault_arm_id: The KeyVault resource id for key (KEK). - :paramtype kek_key_vault_arm_id: str - :keyword failover_disk_name: The failover name for the managed disk. - :paramtype failover_disk_name: str - :keyword tfo_disk_name: The test failover name for the managed disk. - :paramtype tfo_disk_name: str - """ - super().__init__(**kwargs) - self.disk_uri = disk_uri - self.recovery_azure_storage_account_id = recovery_azure_storage_account_id - self.primary_disk_azure_storage_account_id = primary_disk_azure_storage_account_id - self.recovery_disk_uri = recovery_disk_uri - self.disk_name = disk_name - self.disk_capacity_in_bytes = disk_capacity_in_bytes - self.primary_staging_azure_storage_account_id = primary_staging_azure_storage_account_id - self.disk_type = disk_type - self.resync_required = resync_required - self.monitoring_percentage_completion = monitoring_percentage_completion - self.monitoring_job_type = monitoring_job_type - self.data_pending_in_staging_storage_account_in_mb = data_pending_in_staging_storage_account_in_mb - self.data_pending_at_source_agent_in_mb = data_pending_at_source_agent_in_mb - self.disk_state = disk_state - self.allowed_disk_level_operation = allowed_disk_level_operation - self.is_disk_encrypted = is_disk_encrypted - self.secret_identifier = secret_identifier - self.dek_key_vault_arm_id = dek_key_vault_arm_id - self.is_disk_key_encrypted = is_disk_key_encrypted - self.key_identifier = key_identifier - self.kek_key_vault_arm_id = kek_key_vault_arm_id - self.failover_disk_name = failover_disk_name - self.tfo_disk_name = tfo_disk_name - - -class A2AProtectedItemDetail(_serialization.Model): - """A2A specific switch cluster protection input. - - :ivar vm_managed_disks: The list of vm managed disk details. - :vartype vm_managed_disks: - list[~azure.mgmt.recoveryservicessiterecovery.models.A2AVmManagedDiskInputDetails] - :ivar recovery_resource_group_id: The recovery resource group Id. - :vartype recovery_resource_group_id: str - :ivar recovery_availability_set_id: The recovery availability set. - :vartype recovery_availability_set_id: str - :ivar recovery_boot_diag_storage_account_id: The boot diagnostic storage account. - :vartype recovery_boot_diag_storage_account_id: str - :ivar recovery_availability_zone: The recovery availability zone. - :vartype recovery_availability_zone: str - :ivar recovery_proximity_placement_group_id: The recovery proximity placement group Id. - :vartype recovery_proximity_placement_group_id: str - :ivar recovery_virtual_machine_scale_set_id: The virtual machine scale set id. - :vartype recovery_virtual_machine_scale_set_id: str - :ivar recovery_capacity_reservation_group_id: The recovery capacity reservation group Id. - :vartype recovery_capacity_reservation_group_id: str - :ivar disk_encryption_info: The recovery disk encryption information. - :vartype disk_encryption_info: - ~azure.mgmt.recoveryservicessiterecovery.models.DiskEncryptionInfo - :ivar replication_protected_item_name: The Replication Protected item name. - :vartype replication_protected_item_name: str - """ - - _attribute_map = { - "vm_managed_disks": {"key": "vmManagedDisks", "type": "[A2AVmManagedDiskInputDetails]"}, - "recovery_resource_group_id": {"key": "recoveryResourceGroupId", "type": "str"}, - "recovery_availability_set_id": {"key": "recoveryAvailabilitySetId", "type": "str"}, - "recovery_boot_diag_storage_account_id": {"key": "recoveryBootDiagStorageAccountId", "type": "str"}, - "recovery_availability_zone": {"key": "recoveryAvailabilityZone", "type": "str"}, - "recovery_proximity_placement_group_id": {"key": "recoveryProximityPlacementGroupId", "type": "str"}, - "recovery_virtual_machine_scale_set_id": {"key": "recoveryVirtualMachineScaleSetId", "type": "str"}, - "recovery_capacity_reservation_group_id": {"key": "recoveryCapacityReservationGroupId", "type": "str"}, - "disk_encryption_info": {"key": "diskEncryptionInfo", "type": "DiskEncryptionInfo"}, - "replication_protected_item_name": {"key": "replicationProtectedItemName", "type": "str"}, - } - - def __init__( - self, - *, - vm_managed_disks: Optional[List["_models.A2AVmManagedDiskInputDetails"]] = None, - recovery_resource_group_id: Optional[str] = None, - recovery_availability_set_id: Optional[str] = None, - recovery_boot_diag_storage_account_id: Optional[str] = None, - recovery_availability_zone: Optional[str] = None, - recovery_proximity_placement_group_id: Optional[str] = None, - recovery_virtual_machine_scale_set_id: Optional[str] = None, - recovery_capacity_reservation_group_id: Optional[str] = None, - disk_encryption_info: Optional["_models.DiskEncryptionInfo"] = None, - replication_protected_item_name: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword vm_managed_disks: The list of vm managed disk details. - :paramtype vm_managed_disks: - list[~azure.mgmt.recoveryservicessiterecovery.models.A2AVmManagedDiskInputDetails] - :keyword recovery_resource_group_id: The recovery resource group Id. - :paramtype recovery_resource_group_id: str - :keyword recovery_availability_set_id: The recovery availability set. - :paramtype recovery_availability_set_id: str - :keyword recovery_boot_diag_storage_account_id: The boot diagnostic storage account. - :paramtype recovery_boot_diag_storage_account_id: str - :keyword recovery_availability_zone: The recovery availability zone. - :paramtype recovery_availability_zone: str - :keyword recovery_proximity_placement_group_id: The recovery proximity placement group Id. - :paramtype recovery_proximity_placement_group_id: str - :keyword recovery_virtual_machine_scale_set_id: The virtual machine scale set id. - :paramtype recovery_virtual_machine_scale_set_id: str - :keyword recovery_capacity_reservation_group_id: The recovery capacity reservation group Id. - :paramtype recovery_capacity_reservation_group_id: str - :keyword disk_encryption_info: The recovery disk encryption information. - :paramtype disk_encryption_info: - ~azure.mgmt.recoveryservicessiterecovery.models.DiskEncryptionInfo - :keyword replication_protected_item_name: The Replication Protected item name. - :paramtype replication_protected_item_name: str - """ - super().__init__(**kwargs) - self.vm_managed_disks = vm_managed_disks - self.recovery_resource_group_id = recovery_resource_group_id - self.recovery_availability_set_id = recovery_availability_set_id - self.recovery_boot_diag_storage_account_id = recovery_boot_diag_storage_account_id - self.recovery_availability_zone = recovery_availability_zone - self.recovery_proximity_placement_group_id = recovery_proximity_placement_group_id - self.recovery_virtual_machine_scale_set_id = recovery_virtual_machine_scale_set_id - self.recovery_capacity_reservation_group_id = recovery_capacity_reservation_group_id - self.disk_encryption_info = disk_encryption_info - self.replication_protected_item_name = replication_protected_item_name - - -class A2AProtectedManagedDiskDetails(_serialization.Model): - """A2A protected managed disk details. - - :ivar disk_id: The managed disk Arm id. - :vartype disk_id: str - :ivar recovery_resource_group_id: The recovery disk resource group Arm Id. - :vartype recovery_resource_group_id: str - :ivar recovery_target_disk_id: Recovery target disk Arm Id. - :vartype recovery_target_disk_id: str - :ivar recovery_replica_disk_id: Recovery replica disk Arm Id. - :vartype recovery_replica_disk_id: str - :ivar recovery_orignal_target_disk_id: Recovery original target disk Arm Id. - :vartype recovery_orignal_target_disk_id: str - :ivar recovery_replica_disk_account_type: The replica disk type. Its an optional value and will - be same as source disk type if not user provided. - :vartype recovery_replica_disk_account_type: str - :ivar recovery_target_disk_account_type: The target disk type after failover. Its an optional - value and will be same as source disk type if not user provided. - :vartype recovery_target_disk_account_type: str - :ivar recovery_disk_encryption_set_id: The recovery disk encryption set Id. - :vartype recovery_disk_encryption_set_id: str - :ivar primary_disk_encryption_set_id: The primary disk encryption set Id. - :vartype primary_disk_encryption_set_id: str - :ivar disk_name: The disk name. - :vartype disk_name: str - :ivar disk_capacity_in_bytes: The disk capacity in bytes. - :vartype disk_capacity_in_bytes: int - :ivar primary_staging_azure_storage_account_id: The primary staging storage account. - :vartype primary_staging_azure_storage_account_id: str - :ivar disk_type: The type of disk. - :vartype disk_type: str - :ivar resync_required: A value indicating whether resync is required for this disk. - :vartype resync_required: bool - :ivar monitoring_percentage_completion: The percentage of the monitoring job. The type of the - monitoring job is defined by MonitoringJobType property. - :vartype monitoring_percentage_completion: int - :ivar monitoring_job_type: The type of the monitoring job. The progress is contained in - MonitoringPercentageCompletion property. - :vartype monitoring_job_type: str - :ivar data_pending_in_staging_storage_account_in_mb: The data pending for replication in MB at - staging account. - :vartype data_pending_in_staging_storage_account_in_mb: float - :ivar data_pending_at_source_agent_in_mb: The data pending at source virtual machine in MB. - :vartype data_pending_at_source_agent_in_mb: float - :ivar disk_state: The disk state. - :vartype disk_state: str - :ivar allowed_disk_level_operation: The disk level operations list. - :vartype allowed_disk_level_operation: list[str] - :ivar is_disk_encrypted: A value indicating whether vm has encrypted os disk or not. - :vartype is_disk_encrypted: bool - :ivar secret_identifier: The secret URL / identifier (BEK). - :vartype secret_identifier: str - :ivar dek_key_vault_arm_id: The KeyVault resource id for secret (BEK). - :vartype dek_key_vault_arm_id: str - :ivar is_disk_key_encrypted: A value indicating whether disk key got encrypted or not. - :vartype is_disk_key_encrypted: bool - :ivar key_identifier: The key URL / identifier (KEK). - :vartype key_identifier: str - :ivar kek_key_vault_arm_id: The KeyVault resource id for key (KEK). - :vartype kek_key_vault_arm_id: str - :ivar failover_disk_name: The failover name for the managed disk. - :vartype failover_disk_name: str - :ivar tfo_disk_name: The test failover name for the managed disk. - :vartype tfo_disk_name: str - """ - - _attribute_map = { - "disk_id": {"key": "diskId", "type": "str"}, - "recovery_resource_group_id": {"key": "recoveryResourceGroupId", "type": "str"}, - "recovery_target_disk_id": {"key": "recoveryTargetDiskId", "type": "str"}, - "recovery_replica_disk_id": {"key": "recoveryReplicaDiskId", "type": "str"}, - "recovery_orignal_target_disk_id": {"key": "recoveryOrignalTargetDiskId", "type": "str"}, - "recovery_replica_disk_account_type": {"key": "recoveryReplicaDiskAccountType", "type": "str"}, - "recovery_target_disk_account_type": {"key": "recoveryTargetDiskAccountType", "type": "str"}, - "recovery_disk_encryption_set_id": {"key": "recoveryDiskEncryptionSetId", "type": "str"}, - "primary_disk_encryption_set_id": {"key": "primaryDiskEncryptionSetId", "type": "str"}, - "disk_name": {"key": "diskName", "type": "str"}, - "disk_capacity_in_bytes": {"key": "diskCapacityInBytes", "type": "int"}, - "primary_staging_azure_storage_account_id": {"key": "primaryStagingAzureStorageAccountId", "type": "str"}, - "disk_type": {"key": "diskType", "type": "str"}, - "resync_required": {"key": "resyncRequired", "type": "bool"}, - "monitoring_percentage_completion": {"key": "monitoringPercentageCompletion", "type": "int"}, - "monitoring_job_type": {"key": "monitoringJobType", "type": "str"}, - "data_pending_in_staging_storage_account_in_mb": { - "key": "dataPendingInStagingStorageAccountInMB", - "type": "float", - }, - "data_pending_at_source_agent_in_mb": {"key": "dataPendingAtSourceAgentInMB", "type": "float"}, - "disk_state": {"key": "diskState", "type": "str"}, - "allowed_disk_level_operation": {"key": "allowedDiskLevelOperation", "type": "[str]"}, - "is_disk_encrypted": {"key": "isDiskEncrypted", "type": "bool"}, - "secret_identifier": {"key": "secretIdentifier", "type": "str"}, - "dek_key_vault_arm_id": {"key": "dekKeyVaultArmId", "type": "str"}, - "is_disk_key_encrypted": {"key": "isDiskKeyEncrypted", "type": "bool"}, - "key_identifier": {"key": "keyIdentifier", "type": "str"}, - "kek_key_vault_arm_id": {"key": "kekKeyVaultArmId", "type": "str"}, - "failover_disk_name": {"key": "failoverDiskName", "type": "str"}, - "tfo_disk_name": {"key": "tfoDiskName", "type": "str"}, - } - - def __init__( # pylint: disable=too-many-locals - self, - *, - disk_id: Optional[str] = None, - recovery_resource_group_id: Optional[str] = None, - recovery_target_disk_id: Optional[str] = None, - recovery_replica_disk_id: Optional[str] = None, - recovery_orignal_target_disk_id: Optional[str] = None, - recovery_replica_disk_account_type: Optional[str] = None, - recovery_target_disk_account_type: Optional[str] = None, - recovery_disk_encryption_set_id: Optional[str] = None, - primary_disk_encryption_set_id: Optional[str] = None, - disk_name: Optional[str] = None, - disk_capacity_in_bytes: Optional[int] = None, - primary_staging_azure_storage_account_id: Optional[str] = None, - disk_type: Optional[str] = None, - resync_required: Optional[bool] = None, - monitoring_percentage_completion: Optional[int] = None, - monitoring_job_type: Optional[str] = None, - data_pending_in_staging_storage_account_in_mb: Optional[float] = None, - data_pending_at_source_agent_in_mb: Optional[float] = None, - disk_state: Optional[str] = None, - allowed_disk_level_operation: Optional[List[str]] = None, - is_disk_encrypted: Optional[bool] = None, - secret_identifier: Optional[str] = None, - dek_key_vault_arm_id: Optional[str] = None, - is_disk_key_encrypted: Optional[bool] = None, - key_identifier: Optional[str] = None, - kek_key_vault_arm_id: Optional[str] = None, - failover_disk_name: Optional[str] = None, - tfo_disk_name: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword disk_id: The managed disk Arm id. - :paramtype disk_id: str - :keyword recovery_resource_group_id: The recovery disk resource group Arm Id. - :paramtype recovery_resource_group_id: str - :keyword recovery_target_disk_id: Recovery target disk Arm Id. - :paramtype recovery_target_disk_id: str - :keyword recovery_replica_disk_id: Recovery replica disk Arm Id. - :paramtype recovery_replica_disk_id: str - :keyword recovery_orignal_target_disk_id: Recovery original target disk Arm Id. - :paramtype recovery_orignal_target_disk_id: str - :keyword recovery_replica_disk_account_type: The replica disk type. Its an optional value and - will be same as source disk type if not user provided. - :paramtype recovery_replica_disk_account_type: str - :keyword recovery_target_disk_account_type: The target disk type after failover. Its an - optional value and will be same as source disk type if not user provided. - :paramtype recovery_target_disk_account_type: str - :keyword recovery_disk_encryption_set_id: The recovery disk encryption set Id. - :paramtype recovery_disk_encryption_set_id: str - :keyword primary_disk_encryption_set_id: The primary disk encryption set Id. - :paramtype primary_disk_encryption_set_id: str - :keyword disk_name: The disk name. - :paramtype disk_name: str - :keyword disk_capacity_in_bytes: The disk capacity in bytes. - :paramtype disk_capacity_in_bytes: int - :keyword primary_staging_azure_storage_account_id: The primary staging storage account. - :paramtype primary_staging_azure_storage_account_id: str - :keyword disk_type: The type of disk. - :paramtype disk_type: str - :keyword resync_required: A value indicating whether resync is required for this disk. - :paramtype resync_required: bool - :keyword monitoring_percentage_completion: The percentage of the monitoring job. The type of - the monitoring job is defined by MonitoringJobType property. - :paramtype monitoring_percentage_completion: int - :keyword monitoring_job_type: The type of the monitoring job. The progress is contained in - MonitoringPercentageCompletion property. - :paramtype monitoring_job_type: str - :keyword data_pending_in_staging_storage_account_in_mb: The data pending for replication in MB - at staging account. - :paramtype data_pending_in_staging_storage_account_in_mb: float - :keyword data_pending_at_source_agent_in_mb: The data pending at source virtual machine in MB. - :paramtype data_pending_at_source_agent_in_mb: float - :keyword disk_state: The disk state. - :paramtype disk_state: str - :keyword allowed_disk_level_operation: The disk level operations list. - :paramtype allowed_disk_level_operation: list[str] - :keyword is_disk_encrypted: A value indicating whether vm has encrypted os disk or not. - :paramtype is_disk_encrypted: bool - :keyword secret_identifier: The secret URL / identifier (BEK). - :paramtype secret_identifier: str - :keyword dek_key_vault_arm_id: The KeyVault resource id for secret (BEK). - :paramtype dek_key_vault_arm_id: str - :keyword is_disk_key_encrypted: A value indicating whether disk key got encrypted or not. - :paramtype is_disk_key_encrypted: bool - :keyword key_identifier: The key URL / identifier (KEK). - :paramtype key_identifier: str - :keyword kek_key_vault_arm_id: The KeyVault resource id for key (KEK). - :paramtype kek_key_vault_arm_id: str - :keyword failover_disk_name: The failover name for the managed disk. - :paramtype failover_disk_name: str - :keyword tfo_disk_name: The test failover name for the managed disk. - :paramtype tfo_disk_name: str - """ - super().__init__(**kwargs) - self.disk_id = disk_id - self.recovery_resource_group_id = recovery_resource_group_id - self.recovery_target_disk_id = recovery_target_disk_id - self.recovery_replica_disk_id = recovery_replica_disk_id - self.recovery_orignal_target_disk_id = recovery_orignal_target_disk_id - self.recovery_replica_disk_account_type = recovery_replica_disk_account_type - self.recovery_target_disk_account_type = recovery_target_disk_account_type - self.recovery_disk_encryption_set_id = recovery_disk_encryption_set_id - self.primary_disk_encryption_set_id = primary_disk_encryption_set_id - self.disk_name = disk_name - self.disk_capacity_in_bytes = disk_capacity_in_bytes - self.primary_staging_azure_storage_account_id = primary_staging_azure_storage_account_id - self.disk_type = disk_type - self.resync_required = resync_required - self.monitoring_percentage_completion = monitoring_percentage_completion - self.monitoring_job_type = monitoring_job_type - self.data_pending_in_staging_storage_account_in_mb = data_pending_in_staging_storage_account_in_mb - self.data_pending_at_source_agent_in_mb = data_pending_at_source_agent_in_mb - self.disk_state = disk_state - self.allowed_disk_level_operation = allowed_disk_level_operation - self.is_disk_encrypted = is_disk_encrypted - self.secret_identifier = secret_identifier - self.dek_key_vault_arm_id = dek_key_vault_arm_id - self.is_disk_key_encrypted = is_disk_key_encrypted - self.key_identifier = key_identifier - self.kek_key_vault_arm_id = kek_key_vault_arm_id - self.failover_disk_name = failover_disk_name - self.tfo_disk_name = tfo_disk_name - - -class ProtectionContainerMappingProviderSpecificDetails(_serialization.Model): # pylint: disable=name-too-long - """Container mapping provider specific details. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - A2AProtectionContainerMappingDetails, InMageRcmProtectionContainerMappingDetails, - VMwareCbtProtectionContainerMappingDetails - - All required parameters must be populated in order to send to server. - - :ivar instance_type: Gets the class type. Overridden in derived classes. Required. - :vartype instance_type: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - } - - _subtype_map = { - "instance_type": { - "A2A": "A2AProtectionContainerMappingDetails", - "InMageRcm": "InMageRcmProtectionContainerMappingDetails", - "VMwareCbt": "VMwareCbtProtectionContainerMappingDetails", - } - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.instance_type: Optional[str] = None - - -class A2AProtectionContainerMappingDetails(ProtectionContainerMappingProviderSpecificDetails): - """A2A provider specific settings. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: Gets the class type. Overridden in derived classes. Required. - :vartype instance_type: str - :ivar agent_auto_update_status: A value indicating whether the auto update is enabled. Known - values are: "Disabled" and "Enabled". - :vartype agent_auto_update_status: str or - ~azure.mgmt.recoveryservicessiterecovery.models.AgentAutoUpdateStatus - :ivar automation_account_arm_id: The automation account arm id. - :vartype automation_account_arm_id: str - :ivar automation_account_authentication_type: A value indicating the type authentication to use - for automation Account. Known values are: "RunAsAccount" and "SystemAssignedIdentity". - :vartype automation_account_authentication_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.AutomationAccountAuthenticationType - :ivar schedule_name: The schedule arm name. - :vartype schedule_name: str - :ivar job_schedule_name: The job schedule arm name. - :vartype job_schedule_name: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "agent_auto_update_status": {"key": "agentAutoUpdateStatus", "type": "str"}, - "automation_account_arm_id": {"key": "automationAccountArmId", "type": "str"}, - "automation_account_authentication_type": {"key": "automationAccountAuthenticationType", "type": "str"}, - "schedule_name": {"key": "scheduleName", "type": "str"}, - "job_schedule_name": {"key": "jobScheduleName", "type": "str"}, - } - - def __init__( - self, - *, - agent_auto_update_status: Optional[Union[str, "_models.AgentAutoUpdateStatus"]] = None, - automation_account_arm_id: Optional[str] = None, - automation_account_authentication_type: Optional[ - Union[str, "_models.AutomationAccountAuthenticationType"] - ] = None, - schedule_name: Optional[str] = None, - job_schedule_name: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword agent_auto_update_status: A value indicating whether the auto update is enabled. Known - values are: "Disabled" and "Enabled". - :paramtype agent_auto_update_status: str or - ~azure.mgmt.recoveryservicessiterecovery.models.AgentAutoUpdateStatus - :keyword automation_account_arm_id: The automation account arm id. - :paramtype automation_account_arm_id: str - :keyword automation_account_authentication_type: A value indicating the type authentication to - use for automation Account. Known values are: "RunAsAccount" and "SystemAssignedIdentity". - :paramtype automation_account_authentication_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.AutomationAccountAuthenticationType - :keyword schedule_name: The schedule arm name. - :paramtype schedule_name: str - :keyword job_schedule_name: The job schedule arm name. - :paramtype job_schedule_name: str - """ - super().__init__(**kwargs) - self.instance_type: str = "A2A" - self.agent_auto_update_status = agent_auto_update_status - self.automation_account_arm_id = automation_account_arm_id - self.automation_account_authentication_type = automation_account_authentication_type - self.schedule_name = schedule_name - self.job_schedule_name = job_schedule_name - - -class A2AProtectionIntentDiskInputDetails(_serialization.Model): - """Azure VM unmanaged disk input details. - - All required parameters must be populated in order to send to server. - - :ivar disk_uri: The disk Uri. Required. - :vartype disk_uri: str - :ivar recovery_azure_storage_account_custom_input: The recovery VHD storage account input. - :vartype recovery_azure_storage_account_custom_input: - ~azure.mgmt.recoveryservicessiterecovery.models.StorageAccountCustomDetails - :ivar primary_staging_storage_account_custom_input: The primary staging storage account input. - :vartype primary_staging_storage_account_custom_input: - ~azure.mgmt.recoveryservicessiterecovery.models.StorageAccountCustomDetails - """ - - _validation = { - "disk_uri": {"required": True}, - } - - _attribute_map = { - "disk_uri": {"key": "diskUri", "type": "str"}, - "recovery_azure_storage_account_custom_input": { - "key": "recoveryAzureStorageAccountCustomInput", - "type": "StorageAccountCustomDetails", - }, - "primary_staging_storage_account_custom_input": { - "key": "primaryStagingStorageAccountCustomInput", - "type": "StorageAccountCustomDetails", - }, - } - - def __init__( - self, - *, - disk_uri: str, - recovery_azure_storage_account_custom_input: Optional["_models.StorageAccountCustomDetails"] = None, - primary_staging_storage_account_custom_input: Optional["_models.StorageAccountCustomDetails"] = None, - **kwargs: Any - ) -> None: - """ - :keyword disk_uri: The disk Uri. Required. - :paramtype disk_uri: str - :keyword recovery_azure_storage_account_custom_input: The recovery VHD storage account input. - :paramtype recovery_azure_storage_account_custom_input: - ~azure.mgmt.recoveryservicessiterecovery.models.StorageAccountCustomDetails - :keyword primary_staging_storage_account_custom_input: The primary staging storage account - input. - :paramtype primary_staging_storage_account_custom_input: - ~azure.mgmt.recoveryservicessiterecovery.models.StorageAccountCustomDetails - """ - super().__init__(**kwargs) - self.disk_uri = disk_uri - self.recovery_azure_storage_account_custom_input = recovery_azure_storage_account_custom_input - self.primary_staging_storage_account_custom_input = primary_staging_storage_account_custom_input - - -class A2AProtectionIntentManagedDiskInputDetails(_serialization.Model): # pylint: disable=name-too-long - """Azure VM managed disk input details. - - All required parameters must be populated in order to send to server. - - :ivar disk_id: The disk Id. Required. - :vartype disk_id: str - :ivar primary_staging_storage_account_custom_input: The primary staging storage account input. - :vartype primary_staging_storage_account_custom_input: - ~azure.mgmt.recoveryservicessiterecovery.models.StorageAccountCustomDetails - :ivar recovery_resource_group_custom_input: The recovery resource group input. - :vartype recovery_resource_group_custom_input: - ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryResourceGroupCustomDetails - :ivar recovery_replica_disk_account_type: The replica disk type. Its an optional value and will - be same as source disk type if not user provided. - :vartype recovery_replica_disk_account_type: str - :ivar recovery_target_disk_account_type: The target disk type after failover. Its an optional - value and will be same as source disk type if not user provided. - :vartype recovery_target_disk_account_type: str - :ivar recovery_disk_encryption_set_id: The recovery disk encryption set Id. - :vartype recovery_disk_encryption_set_id: str - :ivar disk_encryption_info: The recovery disk encryption information (for one / single pass - flows). - :vartype disk_encryption_info: - ~azure.mgmt.recoveryservicessiterecovery.models.DiskEncryptionInfo - """ - - _validation = { - "disk_id": {"required": True}, - } - - _attribute_map = { - "disk_id": {"key": "diskId", "type": "str"}, - "primary_staging_storage_account_custom_input": { - "key": "primaryStagingStorageAccountCustomInput", - "type": "StorageAccountCustomDetails", - }, - "recovery_resource_group_custom_input": { - "key": "recoveryResourceGroupCustomInput", - "type": "RecoveryResourceGroupCustomDetails", - }, - "recovery_replica_disk_account_type": {"key": "recoveryReplicaDiskAccountType", "type": "str"}, - "recovery_target_disk_account_type": {"key": "recoveryTargetDiskAccountType", "type": "str"}, - "recovery_disk_encryption_set_id": {"key": "recoveryDiskEncryptionSetId", "type": "str"}, - "disk_encryption_info": {"key": "diskEncryptionInfo", "type": "DiskEncryptionInfo"}, - } - - def __init__( - self, - *, - disk_id: str, - primary_staging_storage_account_custom_input: Optional["_models.StorageAccountCustomDetails"] = None, - recovery_resource_group_custom_input: Optional["_models.RecoveryResourceGroupCustomDetails"] = None, - recovery_replica_disk_account_type: Optional[str] = None, - recovery_target_disk_account_type: Optional[str] = None, - recovery_disk_encryption_set_id: Optional[str] = None, - disk_encryption_info: Optional["_models.DiskEncryptionInfo"] = None, - **kwargs: Any - ) -> None: - """ - :keyword disk_id: The disk Id. Required. - :paramtype disk_id: str - :keyword primary_staging_storage_account_custom_input: The primary staging storage account - input. - :paramtype primary_staging_storage_account_custom_input: - ~azure.mgmt.recoveryservicessiterecovery.models.StorageAccountCustomDetails - :keyword recovery_resource_group_custom_input: The recovery resource group input. - :paramtype recovery_resource_group_custom_input: - ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryResourceGroupCustomDetails - :keyword recovery_replica_disk_account_type: The replica disk type. Its an optional value and - will be same as source disk type if not user provided. - :paramtype recovery_replica_disk_account_type: str - :keyword recovery_target_disk_account_type: The target disk type after failover. Its an - optional value and will be same as source disk type if not user provided. - :paramtype recovery_target_disk_account_type: str - :keyword recovery_disk_encryption_set_id: The recovery disk encryption set Id. - :paramtype recovery_disk_encryption_set_id: str - :keyword disk_encryption_info: The recovery disk encryption information (for one / single pass - flows). - :paramtype disk_encryption_info: - ~azure.mgmt.recoveryservicessiterecovery.models.DiskEncryptionInfo - """ - super().__init__(**kwargs) - self.disk_id = disk_id - self.primary_staging_storage_account_custom_input = primary_staging_storage_account_custom_input - self.recovery_resource_group_custom_input = recovery_resource_group_custom_input - self.recovery_replica_disk_account_type = recovery_replica_disk_account_type - self.recovery_target_disk_account_type = recovery_target_disk_account_type - self.recovery_disk_encryption_set_id = recovery_disk_encryption_set_id - self.disk_encryption_info = disk_encryption_info - - -class ProviderSpecificRecoveryPointDetails(_serialization.Model): - """Replication provider specific recovery point details. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - A2ARecoveryPointDetails, InMageAzureV2RecoveryPointDetails, InMageRcmRecoveryPointDetails - - All required parameters must be populated in order to send to server. - - :ivar instance_type: Gets the provider type. Required. - :vartype instance_type: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - } - - _subtype_map = { - "instance_type": { - "A2A": "A2ARecoveryPointDetails", - "InMageAzureV2": "InMageAzureV2RecoveryPointDetails", - "InMageRcm": "InMageRcmRecoveryPointDetails", - } - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.instance_type: Optional[str] = None - - -class A2ARecoveryPointDetails(ProviderSpecificRecoveryPointDetails): - """A2A provider specific recovery point details. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: Gets the provider type. Required. - :vartype instance_type: str - :ivar recovery_point_sync_type: A value indicating whether the recovery point is multi VM - consistent. Known values are: "MultiVmSyncRecoveryPoint" and "PerVmRecoveryPoint". - :vartype recovery_point_sync_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPointSyncType - :ivar disks: List of disk ids representing a recovery point. - :vartype disks: list[str] - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "recovery_point_sync_type": {"key": "recoveryPointSyncType", "type": "str"}, - "disks": {"key": "disks", "type": "[str]"}, - } - - def __init__( - self, - *, - recovery_point_sync_type: Optional[Union[str, "_models.RecoveryPointSyncType"]] = None, - disks: Optional[List[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword recovery_point_sync_type: A value indicating whether the recovery point is multi VM - consistent. Known values are: "MultiVmSyncRecoveryPoint" and "PerVmRecoveryPoint". - :paramtype recovery_point_sync_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPointSyncType - :keyword disks: List of disk ids representing a recovery point. - :paramtype disks: list[str] - """ - super().__init__(**kwargs) - self.instance_type: str = "A2A" - self.recovery_point_sync_type = recovery_point_sync_type - self.disks = disks - - -class RemoveDisksProviderSpecificInput(_serialization.Model): - """Remove Disk provider specific input. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - A2ARemoveDisksInput - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - } - - _subtype_map = {"instance_type": {"A2A": "A2ARemoveDisksInput"}} - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.instance_type: Optional[str] = None - - -class A2ARemoveDisksInput(RemoveDisksProviderSpecificInput): - """A2A remove disk(s) input. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - :ivar vm_disks_uris: The list of vm disk vhd URIs. - :vartype vm_disks_uris: list[str] - :ivar vm_managed_disks_ids: The list of vm managed disk Ids. - :vartype vm_managed_disks_ids: list[str] - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "vm_disks_uris": {"key": "vmDisksUris", "type": "[str]"}, - "vm_managed_disks_ids": {"key": "vmManagedDisksIds", "type": "[str]"}, - } - - def __init__( - self, - *, - vm_disks_uris: Optional[List[str]] = None, - vm_managed_disks_ids: Optional[List[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword vm_disks_uris: The list of vm disk vhd URIs. - :paramtype vm_disks_uris: list[str] - :keyword vm_managed_disks_ids: The list of vm managed disk Ids. - :paramtype vm_managed_disks_ids: list[str] - """ - super().__init__(**kwargs) - self.instance_type: str = "A2A" - self.vm_disks_uris = vm_disks_uris - self.vm_managed_disks_ids = vm_managed_disks_ids - - -class A2AReplicationDetails(ReplicationProviderSpecificSettings): - """A2A provider specific settings. - - 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 instance_type: Gets the Instance type. Required. - :vartype instance_type: str - :ivar fabric_object_id: The fabric specific object Id of the virtual machine. - :vartype fabric_object_id: str - :ivar initial_primary_zone: The initial primary availability zone. - :vartype initial_primary_zone: str - :ivar initial_primary_fabric_location: The initial primary fabric location. - :vartype initial_primary_fabric_location: str - :ivar initial_recovery_zone: The initial recovery availability zone. - :vartype initial_recovery_zone: str - :ivar initial_primary_extended_location: The initial primary extended location. - :vartype initial_primary_extended_location: - ~azure.mgmt.recoveryservicessiterecovery.models.ExtendedLocation - :ivar initial_recovery_extended_location: The initial recovery extended location. - :vartype initial_recovery_extended_location: - ~azure.mgmt.recoveryservicessiterecovery.models.ExtendedLocation - :ivar initial_recovery_fabric_location: The initial recovery fabric location. - :vartype initial_recovery_fabric_location: str - :ivar multi_vm_group_id: The multi vm group Id. - :vartype multi_vm_group_id: str - :ivar multi_vm_group_name: The multi vm group name. - :vartype multi_vm_group_name: str - :ivar multi_vm_group_create_option: Whether Multi VM group is auto created or specified by - user. Known values are: "AutoCreated" and "UserSpecified". - :vartype multi_vm_group_create_option: str or - ~azure.mgmt.recoveryservicessiterecovery.models.MultiVmGroupCreateOption - :ivar management_id: The management Id. - :vartype management_id: str - :ivar protection_cluster_id: The replication protection cluster Id. - :vartype protection_cluster_id: str - :ivar is_cluster_infra_ready: A value indicating if the cluster infra is ready or not. - :vartype is_cluster_infra_ready: bool - :ivar protected_disks: The list of protected disks. - :vartype protected_disks: - list[~azure.mgmt.recoveryservicessiterecovery.models.A2AProtectedDiskDetails] - :ivar unprotected_disks: The list of unprotected disks. - :vartype unprotected_disks: - list[~azure.mgmt.recoveryservicessiterecovery.models.A2AUnprotectedDiskDetails] - :ivar protected_managed_disks: The list of protected managed disks. - :vartype protected_managed_disks: - list[~azure.mgmt.recoveryservicessiterecovery.models.A2AProtectedManagedDiskDetails] - :ivar recovery_boot_diag_storage_account_id: The recovery boot diagnostic storage account Arm - Id. - :vartype recovery_boot_diag_storage_account_id: str - :ivar primary_fabric_location: Primary fabric location. - :vartype primary_fabric_location: str - :ivar recovery_fabric_location: The recovery fabric location. - :vartype recovery_fabric_location: str - :ivar os_type: The type of operating system. - :vartype os_type: str - :ivar recovery_azure_vm_size: The size of recovery virtual machine. - :vartype recovery_azure_vm_size: str - :ivar recovery_azure_vm_name: The name of recovery virtual machine. - :vartype recovery_azure_vm_name: str - :ivar recovery_azure_resource_group_id: The recovery resource group. - :vartype recovery_azure_resource_group_id: str - :ivar recovery_cloud_service: The recovery cloud service. - :vartype recovery_cloud_service: str - :ivar recovery_availability_set: The recovery availability set. - :vartype recovery_availability_set: str - :ivar selected_recovery_azure_network_id: The recovery virtual network. - :vartype selected_recovery_azure_network_id: str - :ivar selected_tfo_azure_network_id: The test failover virtual network. - :vartype selected_tfo_azure_network_id: str - :ivar vm_nics: The virtual machine nic details. - :vartype vm_nics: list[~azure.mgmt.recoveryservicessiterecovery.models.VMNicDetails] - :ivar vm_synced_config_details: The synced configuration details. - :vartype vm_synced_config_details: - ~azure.mgmt.recoveryservicessiterecovery.models.AzureToAzureVmSyncedConfigDetails - :ivar monitoring_percentage_completion: The percentage of the monitoring job. The type of the - monitoring job is defined by MonitoringJobType property. - :vartype monitoring_percentage_completion: int - :ivar monitoring_job_type: The type of the monitoring job. The progress is contained in - MonitoringPercentageCompletion property. - :vartype monitoring_job_type: str - :ivar last_heartbeat: The last heartbeat received from the source server. - :vartype last_heartbeat: ~datetime.datetime - :ivar agent_version: The agent version. - :vartype agent_version: str - :ivar agent_expiry_date: Agent expiry date. - :vartype agent_expiry_date: ~datetime.datetime - :ivar is_replication_agent_update_required: A value indicating whether replication agent update - is required. - :vartype is_replication_agent_update_required: bool - :ivar agent_certificate_expiry_date: Agent certificate expiry date. - :vartype agent_certificate_expiry_date: ~datetime.datetime - :ivar is_replication_agent_certificate_update_required: A value indicating whether agent - certificate update is required. - :vartype is_replication_agent_certificate_update_required: bool - :ivar recovery_fabric_object_id: The recovery fabric object Id. - :vartype recovery_fabric_object_id: str - :ivar vm_protection_state: The protection state for the vm. - :vartype vm_protection_state: str - :ivar vm_protection_state_description: The protection state description for the vm. - :vartype vm_protection_state_description: str - :ivar lifecycle_id: An id associated with the PE that survives actions like switch protection - which change the backing PE/CPE objects internally.The lifecycle id gets carried forward to - have a link/continuity in being able to have an Id that denotes the "same" protected item even - though other internal Ids/ARM Id might be changing. - :vartype lifecycle_id: str - :ivar test_failover_recovery_fabric_object_id: The test failover fabric object Id. - :vartype test_failover_recovery_fabric_object_id: str - :ivar rpo_in_seconds: The last RPO value in seconds. - :vartype rpo_in_seconds: int - :ivar last_rpo_calculated_time: The time (in UTC) when the last RPO value was calculated by - Protection Service. - :vartype last_rpo_calculated_time: ~datetime.datetime - :ivar primary_availability_zone: The primary availability zone. - :vartype primary_availability_zone: str - :ivar recovery_availability_zone: The recovery availability zone. - :vartype recovery_availability_zone: str - :ivar primary_extended_location: The primary Extended Location. - :vartype primary_extended_location: - ~azure.mgmt.recoveryservicessiterecovery.models.ExtendedLocation - :ivar recovery_extended_location: The recovery Extended Location. - :vartype recovery_extended_location: - ~azure.mgmt.recoveryservicessiterecovery.models.ExtendedLocation - :ivar vm_encryption_type: The encryption type of the VM. Known values are: "NotEncrypted", - "OnePassEncrypted", and "TwoPassEncrypted". - :vartype vm_encryption_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.VmEncryptionType - :ivar tfo_azure_vm_name: The test failover vm name. - :vartype tfo_azure_vm_name: str - :ivar recovery_azure_generation: The recovery azure generation. - :vartype recovery_azure_generation: str - :ivar recovery_proximity_placement_group_id: The recovery proximity placement group Id. - :vartype recovery_proximity_placement_group_id: str - :ivar auto_protection_of_data_disk: A value indicating whether the auto protection is enabled. - Known values are: "Disabled" and "Enabled". - :vartype auto_protection_of_data_disk: str or - ~azure.mgmt.recoveryservicessiterecovery.models.AutoProtectionOfDataDisk - :ivar recovery_virtual_machine_scale_set_id: The recovery virtual machine scale set id. - :vartype recovery_virtual_machine_scale_set_id: str - :ivar recovery_capacity_reservation_group_id: The recovery capacity reservation group Id. - :vartype recovery_capacity_reservation_group_id: str - :ivar churn_option_selected: A value indicating the churn option selected by user. Known values - are: "Normal" and "High". - :vartype churn_option_selected: str or - ~azure.mgmt.recoveryservicessiterecovery.models.ChurnOptionSelected - """ - - _validation = { - "instance_type": {"required": True}, - "initial_primary_zone": {"readonly": True}, - "initial_primary_fabric_location": {"readonly": True}, - "initial_recovery_zone": {"readonly": True}, - "initial_recovery_fabric_location": {"readonly": True}, - "agent_certificate_expiry_date": {"readonly": True}, - "vm_encryption_type": {"readonly": True}, - "recovery_azure_generation": {"readonly": True}, - "churn_option_selected": {"readonly": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "fabric_object_id": {"key": "fabricObjectId", "type": "str"}, - "initial_primary_zone": {"key": "initialPrimaryZone", "type": "str"}, - "initial_primary_fabric_location": {"key": "initialPrimaryFabricLocation", "type": "str"}, - "initial_recovery_zone": {"key": "initialRecoveryZone", "type": "str"}, - "initial_primary_extended_location": {"key": "initialPrimaryExtendedLocation", "type": "ExtendedLocation"}, - "initial_recovery_extended_location": {"key": "initialRecoveryExtendedLocation", "type": "ExtendedLocation"}, - "initial_recovery_fabric_location": {"key": "initialRecoveryFabricLocation", "type": "str"}, - "multi_vm_group_id": {"key": "multiVmGroupId", "type": "str"}, - "multi_vm_group_name": {"key": "multiVmGroupName", "type": "str"}, - "multi_vm_group_create_option": {"key": "multiVmGroupCreateOption", "type": "str"}, - "management_id": {"key": "managementId", "type": "str"}, - "protection_cluster_id": {"key": "protectionClusterId", "type": "str"}, - "is_cluster_infra_ready": {"key": "isClusterInfraReady", "type": "bool"}, - "protected_disks": {"key": "protectedDisks", "type": "[A2AProtectedDiskDetails]"}, - "unprotected_disks": {"key": "unprotectedDisks", "type": "[A2AUnprotectedDiskDetails]"}, - "protected_managed_disks": {"key": "protectedManagedDisks", "type": "[A2AProtectedManagedDiskDetails]"}, - "recovery_boot_diag_storage_account_id": {"key": "recoveryBootDiagStorageAccountId", "type": "str"}, - "primary_fabric_location": {"key": "primaryFabricLocation", "type": "str"}, - "recovery_fabric_location": {"key": "recoveryFabricLocation", "type": "str"}, - "os_type": {"key": "osType", "type": "str"}, - "recovery_azure_vm_size": {"key": "recoveryAzureVMSize", "type": "str"}, - "recovery_azure_vm_name": {"key": "recoveryAzureVMName", "type": "str"}, - "recovery_azure_resource_group_id": {"key": "recoveryAzureResourceGroupId", "type": "str"}, - "recovery_cloud_service": {"key": "recoveryCloudService", "type": "str"}, - "recovery_availability_set": {"key": "recoveryAvailabilitySet", "type": "str"}, - "selected_recovery_azure_network_id": {"key": "selectedRecoveryAzureNetworkId", "type": "str"}, - "selected_tfo_azure_network_id": {"key": "selectedTfoAzureNetworkId", "type": "str"}, - "vm_nics": {"key": "vmNics", "type": "[VMNicDetails]"}, - "vm_synced_config_details": {"key": "vmSyncedConfigDetails", "type": "AzureToAzureVmSyncedConfigDetails"}, - "monitoring_percentage_completion": {"key": "monitoringPercentageCompletion", "type": "int"}, - "monitoring_job_type": {"key": "monitoringJobType", "type": "str"}, - "last_heartbeat": {"key": "lastHeartbeat", "type": "iso-8601"}, - "agent_version": {"key": "agentVersion", "type": "str"}, - "agent_expiry_date": {"key": "agentExpiryDate", "type": "iso-8601"}, - "is_replication_agent_update_required": {"key": "isReplicationAgentUpdateRequired", "type": "bool"}, - "agent_certificate_expiry_date": {"key": "agentCertificateExpiryDate", "type": "iso-8601"}, - "is_replication_agent_certificate_update_required": { - "key": "isReplicationAgentCertificateUpdateRequired", - "type": "bool", - }, - "recovery_fabric_object_id": {"key": "recoveryFabricObjectId", "type": "str"}, - "vm_protection_state": {"key": "vmProtectionState", "type": "str"}, - "vm_protection_state_description": {"key": "vmProtectionStateDescription", "type": "str"}, - "lifecycle_id": {"key": "lifecycleId", "type": "str"}, - "test_failover_recovery_fabric_object_id": {"key": "testFailoverRecoveryFabricObjectId", "type": "str"}, - "rpo_in_seconds": {"key": "rpoInSeconds", "type": "int"}, - "last_rpo_calculated_time": {"key": "lastRpoCalculatedTime", "type": "iso-8601"}, - "primary_availability_zone": {"key": "primaryAvailabilityZone", "type": "str"}, - "recovery_availability_zone": {"key": "recoveryAvailabilityZone", "type": "str"}, - "primary_extended_location": {"key": "primaryExtendedLocation", "type": "ExtendedLocation"}, - "recovery_extended_location": {"key": "recoveryExtendedLocation", "type": "ExtendedLocation"}, - "vm_encryption_type": {"key": "vmEncryptionType", "type": "str"}, - "tfo_azure_vm_name": {"key": "tfoAzureVMName", "type": "str"}, - "recovery_azure_generation": {"key": "recoveryAzureGeneration", "type": "str"}, - "recovery_proximity_placement_group_id": {"key": "recoveryProximityPlacementGroupId", "type": "str"}, - "auto_protection_of_data_disk": {"key": "autoProtectionOfDataDisk", "type": "str"}, - "recovery_virtual_machine_scale_set_id": {"key": "recoveryVirtualMachineScaleSetId", "type": "str"}, - "recovery_capacity_reservation_group_id": {"key": "recoveryCapacityReservationGroupId", "type": "str"}, - "churn_option_selected": {"key": "churnOptionSelected", "type": "str"}, - } - - def __init__( # pylint: disable=too-many-locals - self, - *, - fabric_object_id: Optional[str] = None, - initial_primary_extended_location: Optional["_models.ExtendedLocation"] = None, - initial_recovery_extended_location: Optional["_models.ExtendedLocation"] = None, - multi_vm_group_id: Optional[str] = None, - multi_vm_group_name: Optional[str] = None, - multi_vm_group_create_option: Optional[Union[str, "_models.MultiVmGroupCreateOption"]] = None, - management_id: Optional[str] = None, - protection_cluster_id: Optional[str] = None, - is_cluster_infra_ready: Optional[bool] = None, - protected_disks: Optional[List["_models.A2AProtectedDiskDetails"]] = None, - unprotected_disks: Optional[List["_models.A2AUnprotectedDiskDetails"]] = None, - protected_managed_disks: Optional[List["_models.A2AProtectedManagedDiskDetails"]] = None, - recovery_boot_diag_storage_account_id: Optional[str] = None, - primary_fabric_location: Optional[str] = None, - recovery_fabric_location: Optional[str] = None, - os_type: Optional[str] = None, - recovery_azure_vm_size: Optional[str] = None, - recovery_azure_vm_name: Optional[str] = None, - recovery_azure_resource_group_id: Optional[str] = None, - recovery_cloud_service: Optional[str] = None, - recovery_availability_set: Optional[str] = None, - selected_recovery_azure_network_id: Optional[str] = None, - selected_tfo_azure_network_id: Optional[str] = None, - vm_nics: Optional[List["_models.VMNicDetails"]] = None, - vm_synced_config_details: Optional["_models.AzureToAzureVmSyncedConfigDetails"] = None, - monitoring_percentage_completion: Optional[int] = None, - monitoring_job_type: Optional[str] = None, - last_heartbeat: Optional[datetime.datetime] = None, - agent_version: Optional[str] = None, - agent_expiry_date: Optional[datetime.datetime] = None, - is_replication_agent_update_required: Optional[bool] = None, - is_replication_agent_certificate_update_required: Optional[bool] = None, - recovery_fabric_object_id: Optional[str] = None, - vm_protection_state: Optional[str] = None, - vm_protection_state_description: Optional[str] = None, - lifecycle_id: Optional[str] = None, - test_failover_recovery_fabric_object_id: Optional[str] = None, - rpo_in_seconds: Optional[int] = None, - last_rpo_calculated_time: Optional[datetime.datetime] = None, - primary_availability_zone: Optional[str] = None, - recovery_availability_zone: Optional[str] = None, - primary_extended_location: Optional["_models.ExtendedLocation"] = None, - recovery_extended_location: Optional["_models.ExtendedLocation"] = None, - tfo_azure_vm_name: Optional[str] = None, - recovery_proximity_placement_group_id: Optional[str] = None, - auto_protection_of_data_disk: Optional[Union[str, "_models.AutoProtectionOfDataDisk"]] = None, - recovery_virtual_machine_scale_set_id: Optional[str] = None, - recovery_capacity_reservation_group_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword fabric_object_id: The fabric specific object Id of the virtual machine. - :paramtype fabric_object_id: str - :keyword initial_primary_extended_location: The initial primary extended location. - :paramtype initial_primary_extended_location: - ~azure.mgmt.recoveryservicessiterecovery.models.ExtendedLocation - :keyword initial_recovery_extended_location: The initial recovery extended location. - :paramtype initial_recovery_extended_location: - ~azure.mgmt.recoveryservicessiterecovery.models.ExtendedLocation - :keyword multi_vm_group_id: The multi vm group Id. - :paramtype multi_vm_group_id: str - :keyword multi_vm_group_name: The multi vm group name. - :paramtype multi_vm_group_name: str - :keyword multi_vm_group_create_option: Whether Multi VM group is auto created or specified by - user. Known values are: "AutoCreated" and "UserSpecified". - :paramtype multi_vm_group_create_option: str or - ~azure.mgmt.recoveryservicessiterecovery.models.MultiVmGroupCreateOption - :keyword management_id: The management Id. - :paramtype management_id: str - :keyword protection_cluster_id: The replication protection cluster Id. - :paramtype protection_cluster_id: str - :keyword is_cluster_infra_ready: A value indicating if the cluster infra is ready or not. - :paramtype is_cluster_infra_ready: bool - :keyword protected_disks: The list of protected disks. - :paramtype protected_disks: - list[~azure.mgmt.recoveryservicessiterecovery.models.A2AProtectedDiskDetails] - :keyword unprotected_disks: The list of unprotected disks. - :paramtype unprotected_disks: - list[~azure.mgmt.recoveryservicessiterecovery.models.A2AUnprotectedDiskDetails] - :keyword protected_managed_disks: The list of protected managed disks. - :paramtype protected_managed_disks: - list[~azure.mgmt.recoveryservicessiterecovery.models.A2AProtectedManagedDiskDetails] - :keyword recovery_boot_diag_storage_account_id: The recovery boot diagnostic storage account - Arm Id. - :paramtype recovery_boot_diag_storage_account_id: str - :keyword primary_fabric_location: Primary fabric location. - :paramtype primary_fabric_location: str - :keyword recovery_fabric_location: The recovery fabric location. - :paramtype recovery_fabric_location: str - :keyword os_type: The type of operating system. - :paramtype os_type: str - :keyword recovery_azure_vm_size: The size of recovery virtual machine. - :paramtype recovery_azure_vm_size: str - :keyword recovery_azure_vm_name: The name of recovery virtual machine. - :paramtype recovery_azure_vm_name: str - :keyword recovery_azure_resource_group_id: The recovery resource group. - :paramtype recovery_azure_resource_group_id: str - :keyword recovery_cloud_service: The recovery cloud service. - :paramtype recovery_cloud_service: str - :keyword recovery_availability_set: The recovery availability set. - :paramtype recovery_availability_set: str - :keyword selected_recovery_azure_network_id: The recovery virtual network. - :paramtype selected_recovery_azure_network_id: str - :keyword selected_tfo_azure_network_id: The test failover virtual network. - :paramtype selected_tfo_azure_network_id: str - :keyword vm_nics: The virtual machine nic details. - :paramtype vm_nics: list[~azure.mgmt.recoveryservicessiterecovery.models.VMNicDetails] - :keyword vm_synced_config_details: The synced configuration details. - :paramtype vm_synced_config_details: - ~azure.mgmt.recoveryservicessiterecovery.models.AzureToAzureVmSyncedConfigDetails - :keyword monitoring_percentage_completion: The percentage of the monitoring job. The type of - the monitoring job is defined by MonitoringJobType property. - :paramtype monitoring_percentage_completion: int - :keyword monitoring_job_type: The type of the monitoring job. The progress is contained in - MonitoringPercentageCompletion property. - :paramtype monitoring_job_type: str - :keyword last_heartbeat: The last heartbeat received from the source server. - :paramtype last_heartbeat: ~datetime.datetime - :keyword agent_version: The agent version. - :paramtype agent_version: str - :keyword agent_expiry_date: Agent expiry date. - :paramtype agent_expiry_date: ~datetime.datetime - :keyword is_replication_agent_update_required: A value indicating whether replication agent - update is required. - :paramtype is_replication_agent_update_required: bool - :keyword is_replication_agent_certificate_update_required: A value indicating whether agent - certificate update is required. - :paramtype is_replication_agent_certificate_update_required: bool - :keyword recovery_fabric_object_id: The recovery fabric object Id. - :paramtype recovery_fabric_object_id: str - :keyword vm_protection_state: The protection state for the vm. - :paramtype vm_protection_state: str - :keyword vm_protection_state_description: The protection state description for the vm. - :paramtype vm_protection_state_description: str - :keyword lifecycle_id: An id associated with the PE that survives actions like switch - protection which change the backing PE/CPE objects internally.The lifecycle id gets carried - forward to have a link/continuity in being able to have an Id that denotes the "same" protected - item even though other internal Ids/ARM Id might be changing. - :paramtype lifecycle_id: str - :keyword test_failover_recovery_fabric_object_id: The test failover fabric object Id. - :paramtype test_failover_recovery_fabric_object_id: str - :keyword rpo_in_seconds: The last RPO value in seconds. - :paramtype rpo_in_seconds: int - :keyword last_rpo_calculated_time: The time (in UTC) when the last RPO value was calculated by - Protection Service. - :paramtype last_rpo_calculated_time: ~datetime.datetime - :keyword primary_availability_zone: The primary availability zone. - :paramtype primary_availability_zone: str - :keyword recovery_availability_zone: The recovery availability zone. - :paramtype recovery_availability_zone: str - :keyword primary_extended_location: The primary Extended Location. - :paramtype primary_extended_location: - ~azure.mgmt.recoveryservicessiterecovery.models.ExtendedLocation - :keyword recovery_extended_location: The recovery Extended Location. - :paramtype recovery_extended_location: - ~azure.mgmt.recoveryservicessiterecovery.models.ExtendedLocation - :keyword tfo_azure_vm_name: The test failover vm name. - :paramtype tfo_azure_vm_name: str - :keyword recovery_proximity_placement_group_id: The recovery proximity placement group Id. - :paramtype recovery_proximity_placement_group_id: str - :keyword auto_protection_of_data_disk: A value indicating whether the auto protection is - enabled. Known values are: "Disabled" and "Enabled". - :paramtype auto_protection_of_data_disk: str or - ~azure.mgmt.recoveryservicessiterecovery.models.AutoProtectionOfDataDisk - :keyword recovery_virtual_machine_scale_set_id: The recovery virtual machine scale set id. - :paramtype recovery_virtual_machine_scale_set_id: str - :keyword recovery_capacity_reservation_group_id: The recovery capacity reservation group Id. - :paramtype recovery_capacity_reservation_group_id: str - """ - super().__init__(**kwargs) - self.instance_type: str = "A2A" - self.fabric_object_id = fabric_object_id - self.initial_primary_zone: Optional[str] = None - self.initial_primary_fabric_location: Optional[str] = None - self.initial_recovery_zone: Optional[str] = None - self.initial_primary_extended_location = initial_primary_extended_location - self.initial_recovery_extended_location = initial_recovery_extended_location - self.initial_recovery_fabric_location: Optional[str] = None - self.multi_vm_group_id = multi_vm_group_id - self.multi_vm_group_name = multi_vm_group_name - self.multi_vm_group_create_option = multi_vm_group_create_option - self.management_id = management_id - self.protection_cluster_id = protection_cluster_id - self.is_cluster_infra_ready = is_cluster_infra_ready - self.protected_disks = protected_disks - self.unprotected_disks = unprotected_disks - self.protected_managed_disks = protected_managed_disks - self.recovery_boot_diag_storage_account_id = recovery_boot_diag_storage_account_id - self.primary_fabric_location = primary_fabric_location - self.recovery_fabric_location = recovery_fabric_location - self.os_type = os_type - self.recovery_azure_vm_size = recovery_azure_vm_size - self.recovery_azure_vm_name = recovery_azure_vm_name - self.recovery_azure_resource_group_id = recovery_azure_resource_group_id - self.recovery_cloud_service = recovery_cloud_service - self.recovery_availability_set = recovery_availability_set - self.selected_recovery_azure_network_id = selected_recovery_azure_network_id - self.selected_tfo_azure_network_id = selected_tfo_azure_network_id - self.vm_nics = vm_nics - self.vm_synced_config_details = vm_synced_config_details - self.monitoring_percentage_completion = monitoring_percentage_completion - self.monitoring_job_type = monitoring_job_type - self.last_heartbeat = last_heartbeat - self.agent_version = agent_version - self.agent_expiry_date = agent_expiry_date - self.is_replication_agent_update_required = is_replication_agent_update_required - self.agent_certificate_expiry_date: Optional[datetime.datetime] = None - self.is_replication_agent_certificate_update_required = is_replication_agent_certificate_update_required - self.recovery_fabric_object_id = recovery_fabric_object_id - self.vm_protection_state = vm_protection_state - self.vm_protection_state_description = vm_protection_state_description - self.lifecycle_id = lifecycle_id - self.test_failover_recovery_fabric_object_id = test_failover_recovery_fabric_object_id - self.rpo_in_seconds = rpo_in_seconds - self.last_rpo_calculated_time = last_rpo_calculated_time - self.primary_availability_zone = primary_availability_zone - self.recovery_availability_zone = recovery_availability_zone - self.primary_extended_location = primary_extended_location - self.recovery_extended_location = recovery_extended_location - self.vm_encryption_type: Optional[Union[str, "_models.VmEncryptionType"]] = None - self.tfo_azure_vm_name = tfo_azure_vm_name - self.recovery_azure_generation: Optional[str] = None - self.recovery_proximity_placement_group_id = recovery_proximity_placement_group_id - self.auto_protection_of_data_disk = auto_protection_of_data_disk - self.recovery_virtual_machine_scale_set_id = recovery_virtual_machine_scale_set_id - self.recovery_capacity_reservation_group_id = recovery_capacity_reservation_group_id - self.churn_option_selected: Optional[Union[str, "_models.ChurnOptionSelected"]] = None - - -class ReplicationProtectionIntentProviderSpecificSettings(_serialization.Model): # pylint: disable=name-too-long - """Replication provider specific settings. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - A2AReplicationIntentDetails - - All required parameters must be populated in order to send to server. - - :ivar instance_type: Gets the Instance type. Required. - :vartype instance_type: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - } - - _subtype_map = {"instance_type": {"A2A": "A2AReplicationIntentDetails"}} - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.instance_type: Optional[str] = None - - -class A2AReplicationIntentDetails(ReplicationProtectionIntentProviderSpecificSettings): - """A2A provider specific settings. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: Gets the Instance type. Required. - :vartype instance_type: str - :ivar fabric_object_id: The fabric specific object Id of the virtual machine. - :vartype fabric_object_id: str - :ivar primary_location: The primary location for the virtual machine. - :vartype primary_location: str - :ivar recovery_location: The recovery location for the virtual machine. - :vartype recovery_location: str - :ivar recovery_subscription_id: The recovery subscription Id of the virtual machine. - :vartype recovery_subscription_id: str - :ivar vm_disks: The list of vm disk details. - :vartype vm_disks: - list[~azure.mgmt.recoveryservicessiterecovery.models.A2AProtectionIntentDiskInputDetails] - :ivar vm_managed_disks: The list of vm managed disk details. - :vartype vm_managed_disks: - list[~azure.mgmt.recoveryservicessiterecovery.models.A2AProtectionIntentManagedDiskInputDetails] - :ivar recovery_resource_group_id: The recovery resource group id. - :vartype recovery_resource_group_id: str - :ivar protection_profile: The protection profile custom details. - :vartype protection_profile: - ~azure.mgmt.recoveryservicessiterecovery.models.ProtectionProfileCustomDetails - :ivar primary_staging_storage_account: The primary staging storage account details. - :vartype primary_staging_storage_account: - ~azure.mgmt.recoveryservicessiterecovery.models.StorageAccountCustomDetails - :ivar recovery_availability_set: The recovery availability set details. - :vartype recovery_availability_set: - ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryAvailabilitySetCustomDetails - :ivar recovery_virtual_network: The recovery virtual network details. - :vartype recovery_virtual_network: - ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryVirtualNetworkCustomDetails - :ivar recovery_proximity_placement_group: The recovery proximity placement group custom - details. - :vartype recovery_proximity_placement_group: - ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryProximityPlacementGroupCustomDetails - :ivar auto_protection_of_data_disk: A value indicating whether the auto protection is enabled. - Known values are: "Disabled" and "Enabled". - :vartype auto_protection_of_data_disk: str or - ~azure.mgmt.recoveryservicessiterecovery.models.AutoProtectionOfDataDisk - :ivar multi_vm_group_name: The multi vm group name. - :vartype multi_vm_group_name: str - :ivar multi_vm_group_id: The multi vm group id. - :vartype multi_vm_group_id: str - :ivar recovery_boot_diag_storage_account: The boot diagnostic storage account. - :vartype recovery_boot_diag_storage_account: - ~azure.mgmt.recoveryservicessiterecovery.models.StorageAccountCustomDetails - :ivar disk_encryption_info: The recovery disk encryption information (for two pass flows). - :vartype disk_encryption_info: - ~azure.mgmt.recoveryservicessiterecovery.models.DiskEncryptionInfo - :ivar recovery_availability_zone: The recovery availability zone. - :vartype recovery_availability_zone: str - :ivar recovery_availability_type: The recovery availability type of the virtual machine. - Required. - :vartype recovery_availability_type: str - :ivar agent_auto_update_status: A value indicating whether the auto update is enabled. Known - values are: "Disabled" and "Enabled". - :vartype agent_auto_update_status: str or - ~azure.mgmt.recoveryservicessiterecovery.models.AgentAutoUpdateStatus - :ivar automation_account_arm_id: The automation account arm id. - :vartype automation_account_arm_id: str - :ivar automation_account_authentication_type: A value indicating the type authentication to use - for automation Account. Known values are: "RunAsAccount" and "SystemAssignedIdentity". - :vartype automation_account_authentication_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.AutomationAccountAuthenticationType - """ - - _validation = { - "instance_type": {"required": True}, - "recovery_availability_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "fabric_object_id": {"key": "fabricObjectId", "type": "str"}, - "primary_location": {"key": "primaryLocation", "type": "str"}, - "recovery_location": {"key": "recoveryLocation", "type": "str"}, - "recovery_subscription_id": {"key": "recoverySubscriptionId", "type": "str"}, - "vm_disks": {"key": "vmDisks", "type": "[A2AProtectionIntentDiskInputDetails]"}, - "vm_managed_disks": {"key": "vmManagedDisks", "type": "[A2AProtectionIntentManagedDiskInputDetails]"}, - "recovery_resource_group_id": {"key": "recoveryResourceGroupId", "type": "str"}, - "protection_profile": {"key": "protectionProfile", "type": "ProtectionProfileCustomDetails"}, - "primary_staging_storage_account": { - "key": "primaryStagingStorageAccount", - "type": "StorageAccountCustomDetails", - }, - "recovery_availability_set": {"key": "recoveryAvailabilitySet", "type": "RecoveryAvailabilitySetCustomDetails"}, - "recovery_virtual_network": {"key": "recoveryVirtualNetwork", "type": "RecoveryVirtualNetworkCustomDetails"}, - "recovery_proximity_placement_group": { - "key": "recoveryProximityPlacementGroup", - "type": "RecoveryProximityPlacementGroupCustomDetails", - }, - "auto_protection_of_data_disk": {"key": "autoProtectionOfDataDisk", "type": "str"}, - "multi_vm_group_name": {"key": "multiVmGroupName", "type": "str"}, - "multi_vm_group_id": {"key": "multiVmGroupId", "type": "str"}, - "recovery_boot_diag_storage_account": { - "key": "recoveryBootDiagStorageAccount", - "type": "StorageAccountCustomDetails", - }, - "disk_encryption_info": {"key": "diskEncryptionInfo", "type": "DiskEncryptionInfo"}, - "recovery_availability_zone": {"key": "recoveryAvailabilityZone", "type": "str"}, - "recovery_availability_type": {"key": "recoveryAvailabilityType", "type": "str"}, - "agent_auto_update_status": {"key": "agentAutoUpdateStatus", "type": "str"}, - "automation_account_arm_id": {"key": "automationAccountArmId", "type": "str"}, - "automation_account_authentication_type": {"key": "automationAccountAuthenticationType", "type": "str"}, - } - - def __init__( - self, - *, - recovery_availability_type: str, - fabric_object_id: Optional[str] = None, - primary_location: Optional[str] = None, - recovery_location: Optional[str] = None, - recovery_subscription_id: Optional[str] = None, - vm_disks: Optional[List["_models.A2AProtectionIntentDiskInputDetails"]] = None, - vm_managed_disks: Optional[List["_models.A2AProtectionIntentManagedDiskInputDetails"]] = None, - recovery_resource_group_id: Optional[str] = None, - protection_profile: Optional["_models.ProtectionProfileCustomDetails"] = None, - primary_staging_storage_account: Optional["_models.StorageAccountCustomDetails"] = None, - recovery_availability_set: Optional["_models.RecoveryAvailabilitySetCustomDetails"] = None, - recovery_virtual_network: Optional["_models.RecoveryVirtualNetworkCustomDetails"] = None, - recovery_proximity_placement_group: Optional["_models.RecoveryProximityPlacementGroupCustomDetails"] = None, - auto_protection_of_data_disk: Optional[Union[str, "_models.AutoProtectionOfDataDisk"]] = None, - multi_vm_group_name: Optional[str] = None, - multi_vm_group_id: Optional[str] = None, - recovery_boot_diag_storage_account: Optional["_models.StorageAccountCustomDetails"] = None, - disk_encryption_info: Optional["_models.DiskEncryptionInfo"] = None, - recovery_availability_zone: Optional[str] = None, - agent_auto_update_status: Optional[Union[str, "_models.AgentAutoUpdateStatus"]] = None, - automation_account_arm_id: Optional[str] = None, - automation_account_authentication_type: Optional[ - Union[str, "_models.AutomationAccountAuthenticationType"] - ] = None, - **kwargs: Any - ) -> None: - """ - :keyword fabric_object_id: The fabric specific object Id of the virtual machine. - :paramtype fabric_object_id: str - :keyword primary_location: The primary location for the virtual machine. - :paramtype primary_location: str - :keyword recovery_location: The recovery location for the virtual machine. - :paramtype recovery_location: str - :keyword recovery_subscription_id: The recovery subscription Id of the virtual machine. - :paramtype recovery_subscription_id: str - :keyword vm_disks: The list of vm disk details. - :paramtype vm_disks: - list[~azure.mgmt.recoveryservicessiterecovery.models.A2AProtectionIntentDiskInputDetails] - :keyword vm_managed_disks: The list of vm managed disk details. - :paramtype vm_managed_disks: - list[~azure.mgmt.recoveryservicessiterecovery.models.A2AProtectionIntentManagedDiskInputDetails] - :keyword recovery_resource_group_id: The recovery resource group id. - :paramtype recovery_resource_group_id: str - :keyword protection_profile: The protection profile custom details. - :paramtype protection_profile: - ~azure.mgmt.recoveryservicessiterecovery.models.ProtectionProfileCustomDetails - :keyword primary_staging_storage_account: The primary staging storage account details. - :paramtype primary_staging_storage_account: - ~azure.mgmt.recoveryservicessiterecovery.models.StorageAccountCustomDetails - :keyword recovery_availability_set: The recovery availability set details. - :paramtype recovery_availability_set: - ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryAvailabilitySetCustomDetails - :keyword recovery_virtual_network: The recovery virtual network details. - :paramtype recovery_virtual_network: - ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryVirtualNetworkCustomDetails - :keyword recovery_proximity_placement_group: The recovery proximity placement group custom - details. - :paramtype recovery_proximity_placement_group: - ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryProximityPlacementGroupCustomDetails - :keyword auto_protection_of_data_disk: A value indicating whether the auto protection is - enabled. Known values are: "Disabled" and "Enabled". - :paramtype auto_protection_of_data_disk: str or - ~azure.mgmt.recoveryservicessiterecovery.models.AutoProtectionOfDataDisk - :keyword multi_vm_group_name: The multi vm group name. - :paramtype multi_vm_group_name: str - :keyword multi_vm_group_id: The multi vm group id. - :paramtype multi_vm_group_id: str - :keyword recovery_boot_diag_storage_account: The boot diagnostic storage account. - :paramtype recovery_boot_diag_storage_account: - ~azure.mgmt.recoveryservicessiterecovery.models.StorageAccountCustomDetails - :keyword disk_encryption_info: The recovery disk encryption information (for two pass flows). - :paramtype disk_encryption_info: - ~azure.mgmt.recoveryservicessiterecovery.models.DiskEncryptionInfo - :keyword recovery_availability_zone: The recovery availability zone. - :paramtype recovery_availability_zone: str - :keyword recovery_availability_type: The recovery availability type of the virtual machine. - Required. - :paramtype recovery_availability_type: str - :keyword agent_auto_update_status: A value indicating whether the auto update is enabled. Known - values are: "Disabled" and "Enabled". - :paramtype agent_auto_update_status: str or - ~azure.mgmt.recoveryservicessiterecovery.models.AgentAutoUpdateStatus - :keyword automation_account_arm_id: The automation account arm id. - :paramtype automation_account_arm_id: str - :keyword automation_account_authentication_type: A value indicating the type authentication to - use for automation Account. Known values are: "RunAsAccount" and "SystemAssignedIdentity". - :paramtype automation_account_authentication_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.AutomationAccountAuthenticationType - """ - super().__init__(**kwargs) - self.instance_type: str = "A2A" - self.fabric_object_id = fabric_object_id - self.primary_location = primary_location - self.recovery_location = recovery_location - self.recovery_subscription_id = recovery_subscription_id - self.vm_disks = vm_disks - self.vm_managed_disks = vm_managed_disks - self.recovery_resource_group_id = recovery_resource_group_id - self.protection_profile = protection_profile - self.primary_staging_storage_account = primary_staging_storage_account - self.recovery_availability_set = recovery_availability_set - self.recovery_virtual_network = recovery_virtual_network - self.recovery_proximity_placement_group = recovery_proximity_placement_group - self.auto_protection_of_data_disk = auto_protection_of_data_disk - self.multi_vm_group_name = multi_vm_group_name - self.multi_vm_group_id = multi_vm_group_id - self.recovery_boot_diag_storage_account = recovery_boot_diag_storage_account - self.disk_encryption_info = disk_encryption_info - self.recovery_availability_zone = recovery_availability_zone - self.recovery_availability_type = recovery_availability_type - self.agent_auto_update_status = agent_auto_update_status - self.automation_account_arm_id = automation_account_arm_id - self.automation_account_authentication_type = automation_account_authentication_type - - -class ReplicationClusterProviderSpecificSettings(_serialization.Model): # pylint: disable=name-too-long - """Replication cluster provider specific settings. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - A2AReplicationProtectionClusterDetails - - All required parameters must be populated in order to send to server. - - :ivar instance_type: Gets the Instance type. Required. - :vartype instance_type: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - } - - _subtype_map = {"instance_type": {"A2A": "A2AReplicationProtectionClusterDetails"}} - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.instance_type: Optional[str] = None - - -class A2AReplicationProtectionClusterDetails(ReplicationClusterProviderSpecificSettings): - """A2A provider specific settings. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: Gets the Instance type. Required. - :vartype instance_type: str - :ivar multi_vm_group_id: The multi vm group Id. - :vartype multi_vm_group_id: str - :ivar multi_vm_group_name: The multi vm group name. - :vartype multi_vm_group_name: str - :ivar multi_vm_group_create_option: Whether Multi VM group is auto created or specified by - user. Known values are: "AutoCreated" and "UserSpecified". - :vartype multi_vm_group_create_option: str or - ~azure.mgmt.recoveryservicessiterecovery.models.MultiVmGroupCreateOption - :ivar primary_fabric_location: Primary fabric location. - :vartype primary_fabric_location: str - :ivar recovery_fabric_location: The recovery fabric location. - :vartype recovery_fabric_location: str - :ivar failover_recovery_point_id: The recovery point Id to which the cluster was failed over. - :vartype failover_recovery_point_id: str - :ivar cluster_management_id: The cluster management Id. - :vartype cluster_management_id: str - :ivar rpo_in_seconds: The last RPO value in seconds. - :vartype rpo_in_seconds: int - :ivar last_rpo_calculated_time: The time (in UTC) when the last RPO value was calculated by - Protection Service. - :vartype last_rpo_calculated_time: ~datetime.datetime - :ivar initial_primary_zone: The initial primary availability zone. - :vartype initial_primary_zone: str - :ivar initial_primary_fabric_location: The initial primary fabric location. - :vartype initial_primary_fabric_location: str - :ivar initial_recovery_zone: The initial recovery availability zone. - :vartype initial_recovery_zone: str - :ivar initial_recovery_fabric_location: The initial recovery fabric location. - :vartype initial_recovery_fabric_location: str - :ivar initial_primary_extended_location: The initial primary extended location. - :vartype initial_primary_extended_location: - ~azure.mgmt.recoveryservicessiterecovery.models.ExtendedLocation - :ivar initial_recovery_extended_location: The initial recovery extended location. - :vartype initial_recovery_extended_location: - ~azure.mgmt.recoveryservicessiterecovery.models.ExtendedLocation - :ivar primary_availability_zone: The primary availability zone. - :vartype primary_availability_zone: str - :ivar recovery_availability_zone: The recovery availability zone. - :vartype recovery_availability_zone: str - :ivar primary_extended_location: The primary Extended Location. - :vartype primary_extended_location: - ~azure.mgmt.recoveryservicessiterecovery.models.ExtendedLocation - :ivar recovery_extended_location: The recovery Extended Location. - :vartype recovery_extended_location: - ~azure.mgmt.recoveryservicessiterecovery.models.ExtendedLocation - :ivar lifecycle_id: An id that survives actions like switch protection which change the backing - PE/CPE objects internally.The lifecycle id gets carried forward to have a link/continuity in - being able to have an Id that denotes the "same" protected cluster even though other internal - Ids/ARM Id might be changing. - :vartype lifecycle_id: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "multi_vm_group_id": {"key": "multiVmGroupId", "type": "str"}, - "multi_vm_group_name": {"key": "multiVmGroupName", "type": "str"}, - "multi_vm_group_create_option": {"key": "multiVmGroupCreateOption", "type": "str"}, - "primary_fabric_location": {"key": "primaryFabricLocation", "type": "str"}, - "recovery_fabric_location": {"key": "recoveryFabricLocation", "type": "str"}, - "failover_recovery_point_id": {"key": "failoverRecoveryPointId", "type": "str"}, - "cluster_management_id": {"key": "clusterManagementId", "type": "str"}, - "rpo_in_seconds": {"key": "rpoInSeconds", "type": "int"}, - "last_rpo_calculated_time": {"key": "lastRpoCalculatedTime", "type": "iso-8601"}, - "initial_primary_zone": {"key": "initialPrimaryZone", "type": "str"}, - "initial_primary_fabric_location": {"key": "initialPrimaryFabricLocation", "type": "str"}, - "initial_recovery_zone": {"key": "initialRecoveryZone", "type": "str"}, - "initial_recovery_fabric_location": {"key": "initialRecoveryFabricLocation", "type": "str"}, - "initial_primary_extended_location": {"key": "initialPrimaryExtendedLocation", "type": "ExtendedLocation"}, - "initial_recovery_extended_location": {"key": "initialRecoveryExtendedLocation", "type": "ExtendedLocation"}, - "primary_availability_zone": {"key": "primaryAvailabilityZone", "type": "str"}, - "recovery_availability_zone": {"key": "recoveryAvailabilityZone", "type": "str"}, - "primary_extended_location": {"key": "primaryExtendedLocation", "type": "ExtendedLocation"}, - "recovery_extended_location": {"key": "recoveryExtendedLocation", "type": "ExtendedLocation"}, - "lifecycle_id": {"key": "lifecycleId", "type": "str"}, - } - - def __init__( - self, - *, - multi_vm_group_id: Optional[str] = None, - multi_vm_group_name: Optional[str] = None, - multi_vm_group_create_option: Optional[Union[str, "_models.MultiVmGroupCreateOption"]] = None, - primary_fabric_location: Optional[str] = None, - recovery_fabric_location: Optional[str] = None, - failover_recovery_point_id: Optional[str] = None, - cluster_management_id: Optional[str] = None, - rpo_in_seconds: Optional[int] = None, - last_rpo_calculated_time: Optional[datetime.datetime] = None, - initial_primary_zone: Optional[str] = None, - initial_primary_fabric_location: Optional[str] = None, - initial_recovery_zone: Optional[str] = None, - initial_recovery_fabric_location: Optional[str] = None, - initial_primary_extended_location: Optional["_models.ExtendedLocation"] = None, - initial_recovery_extended_location: Optional["_models.ExtendedLocation"] = None, - primary_availability_zone: Optional[str] = None, - recovery_availability_zone: Optional[str] = None, - primary_extended_location: Optional["_models.ExtendedLocation"] = None, - recovery_extended_location: Optional["_models.ExtendedLocation"] = None, - lifecycle_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword multi_vm_group_id: The multi vm group Id. - :paramtype multi_vm_group_id: str - :keyword multi_vm_group_name: The multi vm group name. - :paramtype multi_vm_group_name: str - :keyword multi_vm_group_create_option: Whether Multi VM group is auto created or specified by - user. Known values are: "AutoCreated" and "UserSpecified". - :paramtype multi_vm_group_create_option: str or - ~azure.mgmt.recoveryservicessiterecovery.models.MultiVmGroupCreateOption - :keyword primary_fabric_location: Primary fabric location. - :paramtype primary_fabric_location: str - :keyword recovery_fabric_location: The recovery fabric location. - :paramtype recovery_fabric_location: str - :keyword failover_recovery_point_id: The recovery point Id to which the cluster was failed - over. - :paramtype failover_recovery_point_id: str - :keyword cluster_management_id: The cluster management Id. - :paramtype cluster_management_id: str - :keyword rpo_in_seconds: The last RPO value in seconds. - :paramtype rpo_in_seconds: int - :keyword last_rpo_calculated_time: The time (in UTC) when the last RPO value was calculated by - Protection Service. - :paramtype last_rpo_calculated_time: ~datetime.datetime - :keyword initial_primary_zone: The initial primary availability zone. - :paramtype initial_primary_zone: str - :keyword initial_primary_fabric_location: The initial primary fabric location. - :paramtype initial_primary_fabric_location: str - :keyword initial_recovery_zone: The initial recovery availability zone. - :paramtype initial_recovery_zone: str - :keyword initial_recovery_fabric_location: The initial recovery fabric location. - :paramtype initial_recovery_fabric_location: str - :keyword initial_primary_extended_location: The initial primary extended location. - :paramtype initial_primary_extended_location: - ~azure.mgmt.recoveryservicessiterecovery.models.ExtendedLocation - :keyword initial_recovery_extended_location: The initial recovery extended location. - :paramtype initial_recovery_extended_location: - ~azure.mgmt.recoveryservicessiterecovery.models.ExtendedLocation - :keyword primary_availability_zone: The primary availability zone. - :paramtype primary_availability_zone: str - :keyword recovery_availability_zone: The recovery availability zone. - :paramtype recovery_availability_zone: str - :keyword primary_extended_location: The primary Extended Location. - :paramtype primary_extended_location: - ~azure.mgmt.recoveryservicessiterecovery.models.ExtendedLocation - :keyword recovery_extended_location: The recovery Extended Location. - :paramtype recovery_extended_location: - ~azure.mgmt.recoveryservicessiterecovery.models.ExtendedLocation - :keyword lifecycle_id: An id that survives actions like switch protection which change the - backing PE/CPE objects internally.The lifecycle id gets carried forward to have a - link/continuity in being able to have an Id that denotes the "same" protected cluster even - though other internal Ids/ARM Id might be changing. - :paramtype lifecycle_id: str - """ - super().__init__(**kwargs) - self.instance_type: str = "A2A" - self.multi_vm_group_id = multi_vm_group_id - self.multi_vm_group_name = multi_vm_group_name - self.multi_vm_group_create_option = multi_vm_group_create_option - self.primary_fabric_location = primary_fabric_location - self.recovery_fabric_location = recovery_fabric_location - self.failover_recovery_point_id = failover_recovery_point_id - self.cluster_management_id = cluster_management_id - self.rpo_in_seconds = rpo_in_seconds - self.last_rpo_calculated_time = last_rpo_calculated_time - self.initial_primary_zone = initial_primary_zone - self.initial_primary_fabric_location = initial_primary_fabric_location - self.initial_recovery_zone = initial_recovery_zone - self.initial_recovery_fabric_location = initial_recovery_fabric_location - self.initial_primary_extended_location = initial_primary_extended_location - self.initial_recovery_extended_location = initial_recovery_extended_location - self.primary_availability_zone = primary_availability_zone - self.recovery_availability_zone = recovery_availability_zone - self.primary_extended_location = primary_extended_location - self.recovery_extended_location = recovery_extended_location - self.lifecycle_id = lifecycle_id - - -class ReverseReplicationProviderSpecificInput(_serialization.Model): - """Provider specific reverse replication input. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - A2AReprotectInput, HyperVReplicaAzureReprotectInput, InMageReprotectInput, - InMageAzureV2ReprotectInput, InMageRcmReprotectInput, InMageRcmFailbackReprotectInput - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - } - - _subtype_map = { - "instance_type": { - "A2A": "A2AReprotectInput", - "HyperVReplicaAzure": "HyperVReplicaAzureReprotectInput", - "InMage": "InMageReprotectInput", - "InMageAzureV2": "InMageAzureV2ReprotectInput", - "InMageRcm": "InMageRcmReprotectInput", - "InMageRcmFailback": "InMageRcmFailbackReprotectInput", - } - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.instance_type: Optional[str] = None - - -class A2AReprotectInput(ReverseReplicationProviderSpecificInput): - """Azure specific reprotect input. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - :ivar recovery_container_id: The recovery container Id. - :vartype recovery_container_id: str - :ivar vm_disks: The list of vm disk details. - :vartype vm_disks: list[~azure.mgmt.recoveryservicessiterecovery.models.A2AVmDiskInputDetails] - :ivar recovery_resource_group_id: The recovery resource group Id. Valid for V2 scenarios. - :vartype recovery_resource_group_id: str - :ivar recovery_cloud_service_id: The recovery cloud service Id. Valid for V1 scenarios. - :vartype recovery_cloud_service_id: str - :ivar recovery_availability_set_id: The recovery availability set. - :vartype recovery_availability_set_id: str - :ivar policy_id: The Policy Id. - :vartype policy_id: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "recovery_container_id": {"key": "recoveryContainerId", "type": "str"}, - "vm_disks": {"key": "vmDisks", "type": "[A2AVmDiskInputDetails]"}, - "recovery_resource_group_id": {"key": "recoveryResourceGroupId", "type": "str"}, - "recovery_cloud_service_id": {"key": "recoveryCloudServiceId", "type": "str"}, - "recovery_availability_set_id": {"key": "recoveryAvailabilitySetId", "type": "str"}, - "policy_id": {"key": "policyId", "type": "str"}, - } - - def __init__( - self, - *, - recovery_container_id: Optional[str] = None, - vm_disks: Optional[List["_models.A2AVmDiskInputDetails"]] = None, - recovery_resource_group_id: Optional[str] = None, - recovery_cloud_service_id: Optional[str] = None, - recovery_availability_set_id: Optional[str] = None, - policy_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword recovery_container_id: The recovery container Id. - :paramtype recovery_container_id: str - :keyword vm_disks: The list of vm disk details. - :paramtype vm_disks: - list[~azure.mgmt.recoveryservicessiterecovery.models.A2AVmDiskInputDetails] - :keyword recovery_resource_group_id: The recovery resource group Id. Valid for V2 scenarios. - :paramtype recovery_resource_group_id: str - :keyword recovery_cloud_service_id: The recovery cloud service Id. Valid for V1 scenarios. - :paramtype recovery_cloud_service_id: str - :keyword recovery_availability_set_id: The recovery availability set. - :paramtype recovery_availability_set_id: str - :keyword policy_id: The Policy Id. - :paramtype policy_id: str - """ - super().__init__(**kwargs) - self.instance_type: str = "A2A" - self.recovery_container_id = recovery_container_id - self.vm_disks = vm_disks - self.recovery_resource_group_id = recovery_resource_group_id - self.recovery_cloud_service_id = recovery_cloud_service_id - self.recovery_availability_set_id = recovery_availability_set_id - self.policy_id = policy_id - - -class A2ASharedDiskIRErrorDetails(_serialization.Model): - """Extended location of the resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar error_code: The error code. - :vartype error_code: str - :ivar error_code_enum: The error code enum. - :vartype error_code_enum: str - :ivar error_message: The error message. - :vartype error_message: str - :ivar possible_causes: The possible causes. - :vartype possible_causes: str - :ivar recommended_action: The recommended action. - :vartype recommended_action: str - """ - - _validation = { - "error_code": {"readonly": True}, - "error_code_enum": {"readonly": True}, - "error_message": {"readonly": True}, - "possible_causes": {"readonly": True}, - "recommended_action": {"readonly": True}, - } - - _attribute_map = { - "error_code": {"key": "errorCode", "type": "str"}, - "error_code_enum": {"key": "errorCodeEnum", "type": "str"}, - "error_message": {"key": "errorMessage", "type": "str"}, - "possible_causes": {"key": "possibleCauses", "type": "str"}, - "recommended_action": {"key": "recommendedAction", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.error_code: Optional[str] = None - self.error_code_enum: Optional[str] = None - self.error_message: Optional[str] = None - self.possible_causes: Optional[str] = None - self.recommended_action: Optional[str] = None - - -class SharedDiskReplicationProviderSpecificSettings(_serialization.Model): # pylint: disable=name-too-long - """Replication provider specific settings. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - A2ASharedDiskReplicationDetails - - All required parameters must be populated in order to send to server. - - :ivar instance_type: Gets the Instance type. Required. - :vartype instance_type: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - } - - _subtype_map = {"instance_type": {"A2A": "A2ASharedDiskReplicationDetails"}} - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.instance_type: Optional[str] = None - - -class A2ASharedDiskReplicationDetails(SharedDiskReplicationProviderSpecificSettings): - """A2A provider specific settings. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: Gets the Instance type. Required. - :vartype instance_type: str - :ivar management_id: The management Id. - :vartype management_id: str - :ivar unprotected_disks: The list of unprotected disks. - :vartype unprotected_disks: - list[~azure.mgmt.recoveryservicessiterecovery.models.A2AUnprotectedDiskDetails] - :ivar protected_managed_disks: The list of protected managed disks. - :vartype protected_managed_disks: - list[~azure.mgmt.recoveryservicessiterecovery.models.A2AProtectedManagedDiskDetails] - :ivar primary_fabric_location: Primary fabric location. - :vartype primary_fabric_location: str - :ivar recovery_fabric_location: The recovery fabric location. - :vartype recovery_fabric_location: str - :ivar failover_recovery_point_id: The recovery point id to which the Virtual node was failed - over. - :vartype failover_recovery_point_id: str - :ivar monitoring_percentage_completion: The percentage of the monitoring job. The type of the - monitoring job is defined by MonitoringJobType property. - :vartype monitoring_percentage_completion: int - :ivar monitoring_job_type: The type of the monitoring job. The progress is contained in - MonitoringPercentageCompletion property. - :vartype monitoring_job_type: str - :ivar rpo_in_seconds: The last RPO value in seconds. - :vartype rpo_in_seconds: int - :ivar last_rpo_calculated_time: The time (in UTC) when the last RPO value was calculated by - Protection Service. - :vartype last_rpo_calculated_time: ~datetime.datetime - :ivar shared_disk_ir_errors: The IR Errors. - :vartype shared_disk_ir_errors: - list[~azure.mgmt.recoveryservicessiterecovery.models.A2ASharedDiskIRErrorDetails] - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "management_id": {"key": "managementId", "type": "str"}, - "unprotected_disks": {"key": "unprotectedDisks", "type": "[A2AUnprotectedDiskDetails]"}, - "protected_managed_disks": {"key": "protectedManagedDisks", "type": "[A2AProtectedManagedDiskDetails]"}, - "primary_fabric_location": {"key": "primaryFabricLocation", "type": "str"}, - "recovery_fabric_location": {"key": "recoveryFabricLocation", "type": "str"}, - "failover_recovery_point_id": {"key": "failoverRecoveryPointId", "type": "str"}, - "monitoring_percentage_completion": {"key": "monitoringPercentageCompletion", "type": "int"}, - "monitoring_job_type": {"key": "monitoringJobType", "type": "str"}, - "rpo_in_seconds": {"key": "rpoInSeconds", "type": "int"}, - "last_rpo_calculated_time": {"key": "lastRpoCalculatedTime", "type": "iso-8601"}, - "shared_disk_ir_errors": {"key": "sharedDiskIRErrors", "type": "[A2ASharedDiskIRErrorDetails]"}, - } - - def __init__( - self, - *, - management_id: Optional[str] = None, - unprotected_disks: Optional[List["_models.A2AUnprotectedDiskDetails"]] = None, - protected_managed_disks: Optional[List["_models.A2AProtectedManagedDiskDetails"]] = None, - primary_fabric_location: Optional[str] = None, - recovery_fabric_location: Optional[str] = None, - failover_recovery_point_id: Optional[str] = None, - monitoring_percentage_completion: Optional[int] = None, - monitoring_job_type: Optional[str] = None, - rpo_in_seconds: Optional[int] = None, - last_rpo_calculated_time: Optional[datetime.datetime] = None, - shared_disk_ir_errors: Optional[List["_models.A2ASharedDiskIRErrorDetails"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword management_id: The management Id. - :paramtype management_id: str - :keyword unprotected_disks: The list of unprotected disks. - :paramtype unprotected_disks: - list[~azure.mgmt.recoveryservicessiterecovery.models.A2AUnprotectedDiskDetails] - :keyword protected_managed_disks: The list of protected managed disks. - :paramtype protected_managed_disks: - list[~azure.mgmt.recoveryservicessiterecovery.models.A2AProtectedManagedDiskDetails] - :keyword primary_fabric_location: Primary fabric location. - :paramtype primary_fabric_location: str - :keyword recovery_fabric_location: The recovery fabric location. - :paramtype recovery_fabric_location: str - :keyword failover_recovery_point_id: The recovery point id to which the Virtual node was failed - over. - :paramtype failover_recovery_point_id: str - :keyword monitoring_percentage_completion: The percentage of the monitoring job. The type of - the monitoring job is defined by MonitoringJobType property. - :paramtype monitoring_percentage_completion: int - :keyword monitoring_job_type: The type of the monitoring job. The progress is contained in - MonitoringPercentageCompletion property. - :paramtype monitoring_job_type: str - :keyword rpo_in_seconds: The last RPO value in seconds. - :paramtype rpo_in_seconds: int - :keyword last_rpo_calculated_time: The time (in UTC) when the last RPO value was calculated by - Protection Service. - :paramtype last_rpo_calculated_time: ~datetime.datetime - :keyword shared_disk_ir_errors: The IR Errors. - :paramtype shared_disk_ir_errors: - list[~azure.mgmt.recoveryservicessiterecovery.models.A2ASharedDiskIRErrorDetails] - """ - super().__init__(**kwargs) - self.instance_type: str = "A2A" - self.management_id = management_id - self.unprotected_disks = unprotected_disks - self.protected_managed_disks = protected_managed_disks - self.primary_fabric_location = primary_fabric_location - self.recovery_fabric_location = recovery_fabric_location - self.failover_recovery_point_id = failover_recovery_point_id - self.monitoring_percentage_completion = monitoring_percentage_completion - self.monitoring_job_type = monitoring_job_type - self.rpo_in_seconds = rpo_in_seconds - self.last_rpo_calculated_time = last_rpo_calculated_time - self.shared_disk_ir_errors = shared_disk_ir_errors - - -class SwitchClusterProtectionProviderSpecificInput(_serialization.Model): # pylint: disable=name-too-long - """Provider specific switch cluster protection input. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - A2ASwitchClusterProtectionInput - - All required parameters must be populated in order to send to server. - - :ivar instance_type: Gets the Instance type. Required. - :vartype instance_type: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - } - - _subtype_map = {"instance_type": {"A2A": "A2ASwitchClusterProtectionInput"}} - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.instance_type: Optional[str] = None - - -class A2ASwitchClusterProtectionInput(SwitchClusterProtectionProviderSpecificInput): - """A2A specific switch cluster protection input. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: Gets the Instance type. Required. - :vartype instance_type: str - :ivar recovery_container_id: The recovery container Id. - :vartype recovery_container_id: str - :ivar policy_id: The Policy Id. - :vartype policy_id: str - :ivar protected_items_detail: - :vartype protected_items_detail: - list[~azure.mgmt.recoveryservicessiterecovery.models.A2AProtectedItemDetail] - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "recovery_container_id": {"key": "recoveryContainerId", "type": "str"}, - "policy_id": {"key": "policyId", "type": "str"}, - "protected_items_detail": {"key": "protectedItemsDetail", "type": "[A2AProtectedItemDetail]"}, - } - - def __init__( - self, - *, - recovery_container_id: Optional[str] = None, - policy_id: Optional[str] = None, - protected_items_detail: Optional[List["_models.A2AProtectedItemDetail"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword recovery_container_id: The recovery container Id. - :paramtype recovery_container_id: str - :keyword policy_id: The Policy Id. - :paramtype policy_id: str - :keyword protected_items_detail: - :paramtype protected_items_detail: - list[~azure.mgmt.recoveryservicessiterecovery.models.A2AProtectedItemDetail] - """ - super().__init__(**kwargs) - self.instance_type: str = "A2A" - self.recovery_container_id = recovery_container_id - self.policy_id = policy_id - self.protected_items_detail = protected_items_detail - - -class SwitchProtectionProviderSpecificInput(_serialization.Model): - """Provider specific switch protection input. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - A2ASwitchProtectionInput - - All required parameters must be populated in order to send to server. - - :ivar instance_type: Gets the Instance type. Required. - :vartype instance_type: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - } - - _subtype_map = {"instance_type": {"A2A": "A2ASwitchProtectionInput"}} - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.instance_type: Optional[str] = None - - -class A2ASwitchProtectionInput(SwitchProtectionProviderSpecificInput): - """A2A specific switch protection input. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: Gets the Instance type. Required. - :vartype instance_type: str - :ivar recovery_container_id: The recovery container Id. - :vartype recovery_container_id: str - :ivar vm_disks: The list of vm disk details. - :vartype vm_disks: list[~azure.mgmt.recoveryservicessiterecovery.models.A2AVmDiskInputDetails] - :ivar vm_managed_disks: The list of vm managed disk details. - :vartype vm_managed_disks: - list[~azure.mgmt.recoveryservicessiterecovery.models.A2AVmManagedDiskInputDetails] - :ivar recovery_resource_group_id: The recovery resource group Id. Valid for V2 scenarios. - :vartype recovery_resource_group_id: str - :ivar recovery_cloud_service_id: The recovery cloud service Id. Valid for V1 scenarios. - :vartype recovery_cloud_service_id: str - :ivar recovery_availability_set_id: The recovery availability set. - :vartype recovery_availability_set_id: str - :ivar policy_id: The Policy Id. - :vartype policy_id: str - :ivar recovery_boot_diag_storage_account_id: The boot diagnostic storage account. - :vartype recovery_boot_diag_storage_account_id: str - :ivar recovery_availability_zone: The recovery availability zone. - :vartype recovery_availability_zone: str - :ivar recovery_proximity_placement_group_id: The recovery proximity placement group Id. - :vartype recovery_proximity_placement_group_id: str - :ivar recovery_virtual_machine_scale_set_id: The virtual machine scale set id. - :vartype recovery_virtual_machine_scale_set_id: str - :ivar recovery_capacity_reservation_group_id: The recovery capacity reservation group Id. - :vartype recovery_capacity_reservation_group_id: str - :ivar disk_encryption_info: The recovery disk encryption information. - :vartype disk_encryption_info: - ~azure.mgmt.recoveryservicessiterecovery.models.DiskEncryptionInfo - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "recovery_container_id": {"key": "recoveryContainerId", "type": "str"}, - "vm_disks": {"key": "vmDisks", "type": "[A2AVmDiskInputDetails]"}, - "vm_managed_disks": {"key": "vmManagedDisks", "type": "[A2AVmManagedDiskInputDetails]"}, - "recovery_resource_group_id": {"key": "recoveryResourceGroupId", "type": "str"}, - "recovery_cloud_service_id": {"key": "recoveryCloudServiceId", "type": "str"}, - "recovery_availability_set_id": {"key": "recoveryAvailabilitySetId", "type": "str"}, - "policy_id": {"key": "policyId", "type": "str"}, - "recovery_boot_diag_storage_account_id": {"key": "recoveryBootDiagStorageAccountId", "type": "str"}, - "recovery_availability_zone": {"key": "recoveryAvailabilityZone", "type": "str"}, - "recovery_proximity_placement_group_id": {"key": "recoveryProximityPlacementGroupId", "type": "str"}, - "recovery_virtual_machine_scale_set_id": {"key": "recoveryVirtualMachineScaleSetId", "type": "str"}, - "recovery_capacity_reservation_group_id": {"key": "recoveryCapacityReservationGroupId", "type": "str"}, - "disk_encryption_info": {"key": "diskEncryptionInfo", "type": "DiskEncryptionInfo"}, - } - - def __init__( - self, - *, - recovery_container_id: Optional[str] = None, - vm_disks: Optional[List["_models.A2AVmDiskInputDetails"]] = None, - vm_managed_disks: Optional[List["_models.A2AVmManagedDiskInputDetails"]] = None, - recovery_resource_group_id: Optional[str] = None, - recovery_cloud_service_id: Optional[str] = None, - recovery_availability_set_id: Optional[str] = None, - policy_id: Optional[str] = None, - recovery_boot_diag_storage_account_id: Optional[str] = None, - recovery_availability_zone: Optional[str] = None, - recovery_proximity_placement_group_id: Optional[str] = None, - recovery_virtual_machine_scale_set_id: Optional[str] = None, - recovery_capacity_reservation_group_id: Optional[str] = None, - disk_encryption_info: Optional["_models.DiskEncryptionInfo"] = None, - **kwargs: Any - ) -> None: - """ - :keyword recovery_container_id: The recovery container Id. - :paramtype recovery_container_id: str - :keyword vm_disks: The list of vm disk details. - :paramtype vm_disks: - list[~azure.mgmt.recoveryservicessiterecovery.models.A2AVmDiskInputDetails] - :keyword vm_managed_disks: The list of vm managed disk details. - :paramtype vm_managed_disks: - list[~azure.mgmt.recoveryservicessiterecovery.models.A2AVmManagedDiskInputDetails] - :keyword recovery_resource_group_id: The recovery resource group Id. Valid for V2 scenarios. - :paramtype recovery_resource_group_id: str - :keyword recovery_cloud_service_id: The recovery cloud service Id. Valid for V1 scenarios. - :paramtype recovery_cloud_service_id: str - :keyword recovery_availability_set_id: The recovery availability set. - :paramtype recovery_availability_set_id: str - :keyword policy_id: The Policy Id. - :paramtype policy_id: str - :keyword recovery_boot_diag_storage_account_id: The boot diagnostic storage account. - :paramtype recovery_boot_diag_storage_account_id: str - :keyword recovery_availability_zone: The recovery availability zone. - :paramtype recovery_availability_zone: str - :keyword recovery_proximity_placement_group_id: The recovery proximity placement group Id. - :paramtype recovery_proximity_placement_group_id: str - :keyword recovery_virtual_machine_scale_set_id: The virtual machine scale set id. - :paramtype recovery_virtual_machine_scale_set_id: str - :keyword recovery_capacity_reservation_group_id: The recovery capacity reservation group Id. - :paramtype recovery_capacity_reservation_group_id: str - :keyword disk_encryption_info: The recovery disk encryption information. - :paramtype disk_encryption_info: - ~azure.mgmt.recoveryservicessiterecovery.models.DiskEncryptionInfo - """ - super().__init__(**kwargs) - self.instance_type: str = "A2A" - self.recovery_container_id = recovery_container_id - self.vm_disks = vm_disks - self.vm_managed_disks = vm_managed_disks - self.recovery_resource_group_id = recovery_resource_group_id - self.recovery_cloud_service_id = recovery_cloud_service_id - self.recovery_availability_set_id = recovery_availability_set_id - self.policy_id = policy_id - self.recovery_boot_diag_storage_account_id = recovery_boot_diag_storage_account_id - self.recovery_availability_zone = recovery_availability_zone - self.recovery_proximity_placement_group_id = recovery_proximity_placement_group_id - self.recovery_virtual_machine_scale_set_id = recovery_virtual_machine_scale_set_id - self.recovery_capacity_reservation_group_id = recovery_capacity_reservation_group_id - self.disk_encryption_info = disk_encryption_info - - -class TestFailoverProviderSpecificInput(_serialization.Model): - """Provider specific test failover input. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - A2ATestFailoverInput, HyperVReplicaAzureTestFailoverInput, InMageTestFailoverInput, - InMageAzureV2TestFailoverInput, InMageRcmTestFailoverInput - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - } - - _subtype_map = { - "instance_type": { - "A2A": "A2ATestFailoverInput", - "HyperVReplicaAzure": "HyperVReplicaAzureTestFailoverInput", - "InMage": "InMageTestFailoverInput", - "InMageAzureV2": "InMageAzureV2TestFailoverInput", - "InMageRcm": "InMageRcmTestFailoverInput", - } - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.instance_type: Optional[str] = None - - -class A2ATestFailoverInput(TestFailoverProviderSpecificInput): - """A2A provider specific input for test failover. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - :ivar recovery_point_id: The recovery point id to be passed to test failover to a particular - recovery point. In case of latest recovery point, null should be passed. - :vartype recovery_point_id: str - :ivar cloud_service_creation_option: A value indicating whether to use recovery cloud service - for TFO or not. - :vartype cloud_service_creation_option: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "recovery_point_id": {"key": "recoveryPointId", "type": "str"}, - "cloud_service_creation_option": {"key": "cloudServiceCreationOption", "type": "str"}, - } - - def __init__( - self, - *, - recovery_point_id: Optional[str] = None, - cloud_service_creation_option: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword recovery_point_id: The recovery point id to be passed to test failover to a particular - recovery point. In case of latest recovery point, null should be passed. - :paramtype recovery_point_id: str - :keyword cloud_service_creation_option: A value indicating whether to use recovery cloud - service for TFO or not. - :paramtype cloud_service_creation_option: str - """ - super().__init__(**kwargs) - self.instance_type: str = "A2A" - self.recovery_point_id = recovery_point_id - self.cloud_service_creation_option = cloud_service_creation_option - - -class UnplannedFailoverProviderSpecificInput(_serialization.Model): - """Provider specific unplanned failover input. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - A2AUnplannedFailoverInput, HyperVReplicaAzureUnplannedFailoverInput, - InMageUnplannedFailoverInput, InMageAzureV2UnplannedFailoverInput, - InMageRcmUnplannedFailoverInput - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - } - - _subtype_map = { - "instance_type": { - "A2A": "A2AUnplannedFailoverInput", - "HyperVReplicaAzure": "HyperVReplicaAzureUnplannedFailoverInput", - "InMage": "InMageUnplannedFailoverInput", - "InMageAzureV2": "InMageAzureV2UnplannedFailoverInput", - "InMageRcm": "InMageRcmUnplannedFailoverInput", - } - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.instance_type: Optional[str] = None - - -class A2AUnplannedFailoverInput(UnplannedFailoverProviderSpecificInput): - """A2A provider specific input for unplanned failover. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - :ivar recovery_point_id: The recovery point id to be passed to failover to a particular - recovery point. In case of latest recovery point, null should be passed. - :vartype recovery_point_id: str - :ivar cloud_service_creation_option: A value indicating whether to use recovery cloud service - for failover or not. - :vartype cloud_service_creation_option: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "recovery_point_id": {"key": "recoveryPointId", "type": "str"}, - "cloud_service_creation_option": {"key": "cloudServiceCreationOption", "type": "str"}, - } - - def __init__( - self, - *, - recovery_point_id: Optional[str] = None, - cloud_service_creation_option: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword recovery_point_id: The recovery point id to be passed to failover to a particular - recovery point. In case of latest recovery point, null should be passed. - :paramtype recovery_point_id: str - :keyword cloud_service_creation_option: A value indicating whether to use recovery cloud - service for failover or not. - :paramtype cloud_service_creation_option: str - """ - super().__init__(**kwargs) - self.instance_type: str = "A2A" - self.recovery_point_id = recovery_point_id - self.cloud_service_creation_option = cloud_service_creation_option - - -class A2AUnprotectedDiskDetails(_serialization.Model): - """A2A unprotected disk details. - - :ivar disk_lun_id: The source lun Id for the data disk. - :vartype disk_lun_id: int - :ivar disk_auto_protection_status: A value indicating whether the disk auto protection is - enabled. Known values are: "Disabled" and "Enabled". - :vartype disk_auto_protection_status: str or - ~azure.mgmt.recoveryservicessiterecovery.models.AutoProtectionOfDataDisk - """ - - _attribute_map = { - "disk_lun_id": {"key": "diskLunId", "type": "int"}, - "disk_auto_protection_status": {"key": "diskAutoProtectionStatus", "type": "str"}, - } - - def __init__( - self, - *, - disk_lun_id: Optional[int] = None, - disk_auto_protection_status: Optional[Union[str, "_models.AutoProtectionOfDataDisk"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword disk_lun_id: The source lun Id for the data disk. - :paramtype disk_lun_id: int - :keyword disk_auto_protection_status: A value indicating whether the disk auto protection is - enabled. Known values are: "Disabled" and "Enabled". - :paramtype disk_auto_protection_status: str or - ~azure.mgmt.recoveryservicessiterecovery.models.AutoProtectionOfDataDisk - """ - super().__init__(**kwargs) - self.disk_lun_id = disk_lun_id - self.disk_auto_protection_status = disk_auto_protection_status - - -class ReplicationProviderSpecificUpdateContainerMappingInput(_serialization.Model): # pylint: disable=name-too-long - """Provider specific input for update pairing operations. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - A2AUpdateContainerMappingInput, InMageRcmUpdateContainerMappingInput - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - } - - _subtype_map = { - "instance_type": {"A2A": "A2AUpdateContainerMappingInput", "InMageRcm": "InMageRcmUpdateContainerMappingInput"} - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.instance_type: Optional[str] = None - - -class A2AUpdateContainerMappingInput(ReplicationProviderSpecificUpdateContainerMappingInput): - """A2A update protection container mapping. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - :ivar agent_auto_update_status: A value indicating whether the auto update is enabled. Known - values are: "Disabled" and "Enabled". - :vartype agent_auto_update_status: str or - ~azure.mgmt.recoveryservicessiterecovery.models.AgentAutoUpdateStatus - :ivar automation_account_arm_id: The automation account arm id. - :vartype automation_account_arm_id: str - :ivar automation_account_authentication_type: A value indicating the type authentication to use - for automation Account. Known values are: "RunAsAccount" and "SystemAssignedIdentity". - :vartype automation_account_authentication_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.AutomationAccountAuthenticationType - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "agent_auto_update_status": {"key": "agentAutoUpdateStatus", "type": "str"}, - "automation_account_arm_id": {"key": "automationAccountArmId", "type": "str"}, - "automation_account_authentication_type": {"key": "automationAccountAuthenticationType", "type": "str"}, - } - - def __init__( - self, - *, - agent_auto_update_status: Optional[Union[str, "_models.AgentAutoUpdateStatus"]] = None, - automation_account_arm_id: Optional[str] = None, - automation_account_authentication_type: Optional[ - Union[str, "_models.AutomationAccountAuthenticationType"] - ] = None, - **kwargs: Any - ) -> None: - """ - :keyword agent_auto_update_status: A value indicating whether the auto update is enabled. Known - values are: "Disabled" and "Enabled". - :paramtype agent_auto_update_status: str or - ~azure.mgmt.recoveryservicessiterecovery.models.AgentAutoUpdateStatus - :keyword automation_account_arm_id: The automation account arm id. - :paramtype automation_account_arm_id: str - :keyword automation_account_authentication_type: A value indicating the type authentication to - use for automation Account. Known values are: "RunAsAccount" and "SystemAssignedIdentity". - :paramtype automation_account_authentication_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.AutomationAccountAuthenticationType - """ - super().__init__(**kwargs) - self.instance_type: str = "A2A" - self.agent_auto_update_status = agent_auto_update_status - self.automation_account_arm_id = automation_account_arm_id - self.automation_account_authentication_type = automation_account_authentication_type - - -class UpdateReplicationProtectedItemProviderInput(_serialization.Model): # pylint: disable=name-too-long - """Update replication protected item provider specific input. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - A2AUpdateReplicationProtectedItemInput, HyperVReplicaAzureUpdateReplicationProtectedItemInput, - InMageAzureV2UpdateReplicationProtectedItemInput, InMageRcmUpdateReplicationProtectedItemInput - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - } - - _subtype_map = { - "instance_type": { - "A2A": "A2AUpdateReplicationProtectedItemInput", - "HyperVReplicaAzure": "HyperVReplicaAzureUpdateReplicationProtectedItemInput", - "InMageAzureV2": "InMageAzureV2UpdateReplicationProtectedItemInput", - "InMageRcm": "InMageRcmUpdateReplicationProtectedItemInput", - } - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.instance_type: Optional[str] = None - - -class A2AUpdateReplicationProtectedItemInput(UpdateReplicationProtectedItemProviderInput): - """InMage Azure V2 input to update replication protected item. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - :ivar recovery_cloud_service_id: The target cloud service ARM Id (for V1). - :vartype recovery_cloud_service_id: str - :ivar recovery_resource_group_id: The target resource group ARM Id (for V2). - :vartype recovery_resource_group_id: str - :ivar managed_disk_update_details: Managed disk update details. - :vartype managed_disk_update_details: - list[~azure.mgmt.recoveryservicessiterecovery.models.A2AVmManagedDiskUpdateDetails] - :ivar recovery_boot_diag_storage_account_id: The boot diagnostic storage account. - :vartype recovery_boot_diag_storage_account_id: str - :ivar disk_encryption_info: The recovery os disk encryption information. - :vartype disk_encryption_info: - ~azure.mgmt.recoveryservicessiterecovery.models.DiskEncryptionInfo - :ivar tfo_azure_vm_name: The user given name for Test Failover VM. - :vartype tfo_azure_vm_name: str - :ivar recovery_proximity_placement_group_id: The recovery proximity placement group Id. - :vartype recovery_proximity_placement_group_id: str - :ivar recovery_virtual_machine_scale_set_id: The recovery virtual machine scale set Id. - :vartype recovery_virtual_machine_scale_set_id: str - :ivar recovery_capacity_reservation_group_id: The recovery capacity reservation group Id. - :vartype recovery_capacity_reservation_group_id: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "recovery_cloud_service_id": {"key": "recoveryCloudServiceId", "type": "str"}, - "recovery_resource_group_id": {"key": "recoveryResourceGroupId", "type": "str"}, - "managed_disk_update_details": {"key": "managedDiskUpdateDetails", "type": "[A2AVmManagedDiskUpdateDetails]"}, - "recovery_boot_diag_storage_account_id": {"key": "recoveryBootDiagStorageAccountId", "type": "str"}, - "disk_encryption_info": {"key": "diskEncryptionInfo", "type": "DiskEncryptionInfo"}, - "tfo_azure_vm_name": {"key": "tfoAzureVMName", "type": "str"}, - "recovery_proximity_placement_group_id": {"key": "recoveryProximityPlacementGroupId", "type": "str"}, - "recovery_virtual_machine_scale_set_id": {"key": "recoveryVirtualMachineScaleSetId", "type": "str"}, - "recovery_capacity_reservation_group_id": {"key": "recoveryCapacityReservationGroupId", "type": "str"}, - } - - def __init__( - self, - *, - recovery_cloud_service_id: Optional[str] = None, - recovery_resource_group_id: Optional[str] = None, - managed_disk_update_details: Optional[List["_models.A2AVmManagedDiskUpdateDetails"]] = None, - recovery_boot_diag_storage_account_id: Optional[str] = None, - disk_encryption_info: Optional["_models.DiskEncryptionInfo"] = None, - tfo_azure_vm_name: Optional[str] = None, - recovery_proximity_placement_group_id: Optional[str] = None, - recovery_virtual_machine_scale_set_id: Optional[str] = None, - recovery_capacity_reservation_group_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword recovery_cloud_service_id: The target cloud service ARM Id (for V1). - :paramtype recovery_cloud_service_id: str - :keyword recovery_resource_group_id: The target resource group ARM Id (for V2). - :paramtype recovery_resource_group_id: str - :keyword managed_disk_update_details: Managed disk update details. - :paramtype managed_disk_update_details: - list[~azure.mgmt.recoveryservicessiterecovery.models.A2AVmManagedDiskUpdateDetails] - :keyword recovery_boot_diag_storage_account_id: The boot diagnostic storage account. - :paramtype recovery_boot_diag_storage_account_id: str - :keyword disk_encryption_info: The recovery os disk encryption information. - :paramtype disk_encryption_info: - ~azure.mgmt.recoveryservicessiterecovery.models.DiskEncryptionInfo - :keyword tfo_azure_vm_name: The user given name for Test Failover VM. - :paramtype tfo_azure_vm_name: str - :keyword recovery_proximity_placement_group_id: The recovery proximity placement group Id. - :paramtype recovery_proximity_placement_group_id: str - :keyword recovery_virtual_machine_scale_set_id: The recovery virtual machine scale set Id. - :paramtype recovery_virtual_machine_scale_set_id: str - :keyword recovery_capacity_reservation_group_id: The recovery capacity reservation group Id. - :paramtype recovery_capacity_reservation_group_id: str - """ - super().__init__(**kwargs) - self.instance_type: str = "A2A" - self.recovery_cloud_service_id = recovery_cloud_service_id - self.recovery_resource_group_id = recovery_resource_group_id - self.managed_disk_update_details = managed_disk_update_details - self.recovery_boot_diag_storage_account_id = recovery_boot_diag_storage_account_id - self.disk_encryption_info = disk_encryption_info - self.tfo_azure_vm_name = tfo_azure_vm_name - self.recovery_proximity_placement_group_id = recovery_proximity_placement_group_id - self.recovery_virtual_machine_scale_set_id = recovery_virtual_machine_scale_set_id - self.recovery_capacity_reservation_group_id = recovery_capacity_reservation_group_id - - -class A2AVmDiskInputDetails(_serialization.Model): - """A2A disk input details. - - All required parameters must be populated in order to send to server. - - :ivar disk_uri: The disk Uri. Required. - :vartype disk_uri: str - :ivar recovery_azure_storage_account_id: The recovery VHD storage account Id. Required. - :vartype recovery_azure_storage_account_id: str - :ivar primary_staging_azure_storage_account_id: The primary staging storage account Id. - Required. - :vartype primary_staging_azure_storage_account_id: str - """ - - _validation = { - "disk_uri": {"required": True}, - "recovery_azure_storage_account_id": {"required": True}, - "primary_staging_azure_storage_account_id": {"required": True}, - } - - _attribute_map = { - "disk_uri": {"key": "diskUri", "type": "str"}, - "recovery_azure_storage_account_id": {"key": "recoveryAzureStorageAccountId", "type": "str"}, - "primary_staging_azure_storage_account_id": {"key": "primaryStagingAzureStorageAccountId", "type": "str"}, - } - - def __init__( - self, - *, - disk_uri: str, - recovery_azure_storage_account_id: str, - primary_staging_azure_storage_account_id: str, - **kwargs: Any - ) -> None: - """ - :keyword disk_uri: The disk Uri. Required. - :paramtype disk_uri: str - :keyword recovery_azure_storage_account_id: The recovery VHD storage account Id. Required. - :paramtype recovery_azure_storage_account_id: str - :keyword primary_staging_azure_storage_account_id: The primary staging storage account Id. - Required. - :paramtype primary_staging_azure_storage_account_id: str - """ - super().__init__(**kwargs) - self.disk_uri = disk_uri - self.recovery_azure_storage_account_id = recovery_azure_storage_account_id - self.primary_staging_azure_storage_account_id = primary_staging_azure_storage_account_id - - -class A2AVmManagedDiskInputDetails(_serialization.Model): - """A2A managed disk input details. - - All required parameters must be populated in order to send to server. - - :ivar disk_id: The disk Id. Required. - :vartype disk_id: str - :ivar primary_staging_azure_storage_account_id: The primary staging storage account Arm Id. - Required. - :vartype primary_staging_azure_storage_account_id: str - :ivar recovery_resource_group_id: The target resource group Arm Id. Required. - :vartype recovery_resource_group_id: str - :ivar recovery_replica_disk_account_type: The replica disk type. Its an optional value and will - be same as source disk type if not user provided. - :vartype recovery_replica_disk_account_type: str - :ivar recovery_target_disk_account_type: The target disk type after failover. Its an optional - value and will be same as source disk type if not user provided. - :vartype recovery_target_disk_account_type: str - :ivar recovery_disk_encryption_set_id: The recovery disk encryption set Id. - :vartype recovery_disk_encryption_set_id: str - :ivar disk_encryption_info: The recovery disk encryption information (for one / single pass - flows). - :vartype disk_encryption_info: - ~azure.mgmt.recoveryservicessiterecovery.models.DiskEncryptionInfo - """ - - _validation = { - "disk_id": {"required": True}, - "primary_staging_azure_storage_account_id": {"required": True}, - "recovery_resource_group_id": {"required": True}, - } - - _attribute_map = { - "disk_id": {"key": "diskId", "type": "str"}, - "primary_staging_azure_storage_account_id": {"key": "primaryStagingAzureStorageAccountId", "type": "str"}, - "recovery_resource_group_id": {"key": "recoveryResourceGroupId", "type": "str"}, - "recovery_replica_disk_account_type": {"key": "recoveryReplicaDiskAccountType", "type": "str"}, - "recovery_target_disk_account_type": {"key": "recoveryTargetDiskAccountType", "type": "str"}, - "recovery_disk_encryption_set_id": {"key": "recoveryDiskEncryptionSetId", "type": "str"}, - "disk_encryption_info": {"key": "diskEncryptionInfo", "type": "DiskEncryptionInfo"}, - } - - def __init__( - self, - *, - disk_id: str, - primary_staging_azure_storage_account_id: str, - recovery_resource_group_id: str, - recovery_replica_disk_account_type: Optional[str] = None, - recovery_target_disk_account_type: Optional[str] = None, - recovery_disk_encryption_set_id: Optional[str] = None, - disk_encryption_info: Optional["_models.DiskEncryptionInfo"] = None, - **kwargs: Any - ) -> None: - """ - :keyword disk_id: The disk Id. Required. - :paramtype disk_id: str - :keyword primary_staging_azure_storage_account_id: The primary staging storage account Arm Id. - Required. - :paramtype primary_staging_azure_storage_account_id: str - :keyword recovery_resource_group_id: The target resource group Arm Id. Required. - :paramtype recovery_resource_group_id: str - :keyword recovery_replica_disk_account_type: The replica disk type. Its an optional value and - will be same as source disk type if not user provided. - :paramtype recovery_replica_disk_account_type: str - :keyword recovery_target_disk_account_type: The target disk type after failover. Its an - optional value and will be same as source disk type if not user provided. - :paramtype recovery_target_disk_account_type: str - :keyword recovery_disk_encryption_set_id: The recovery disk encryption set Id. - :paramtype recovery_disk_encryption_set_id: str - :keyword disk_encryption_info: The recovery disk encryption information (for one / single pass - flows). - :paramtype disk_encryption_info: - ~azure.mgmt.recoveryservicessiterecovery.models.DiskEncryptionInfo - """ - super().__init__(**kwargs) - self.disk_id = disk_id - self.primary_staging_azure_storage_account_id = primary_staging_azure_storage_account_id - self.recovery_resource_group_id = recovery_resource_group_id - self.recovery_replica_disk_account_type = recovery_replica_disk_account_type - self.recovery_target_disk_account_type = recovery_target_disk_account_type - self.recovery_disk_encryption_set_id = recovery_disk_encryption_set_id - self.disk_encryption_info = disk_encryption_info - - -class A2AVmManagedDiskUpdateDetails(_serialization.Model): - """A2A Vm managed disk update details. - - :ivar disk_id: The disk Id. - :vartype disk_id: str - :ivar recovery_target_disk_account_type: The target disk type before failover. - :vartype recovery_target_disk_account_type: str - :ivar recovery_replica_disk_account_type: The replica disk type before failover. - :vartype recovery_replica_disk_account_type: str - :ivar disk_encryption_info: The recovery os disk encryption information. - :vartype disk_encryption_info: - ~azure.mgmt.recoveryservicessiterecovery.models.DiskEncryptionInfo - :ivar failover_disk_name: The target disk name for unplanned failover operation. - :vartype failover_disk_name: str - :ivar tfo_disk_name: The target disk name for test failover operation. - :vartype tfo_disk_name: str - """ - - _attribute_map = { - "disk_id": {"key": "diskId", "type": "str"}, - "recovery_target_disk_account_type": {"key": "recoveryTargetDiskAccountType", "type": "str"}, - "recovery_replica_disk_account_type": {"key": "recoveryReplicaDiskAccountType", "type": "str"}, - "disk_encryption_info": {"key": "diskEncryptionInfo", "type": "DiskEncryptionInfo"}, - "failover_disk_name": {"key": "failoverDiskName", "type": "str"}, - "tfo_disk_name": {"key": "tfoDiskName", "type": "str"}, - } - - def __init__( - self, - *, - disk_id: Optional[str] = None, - recovery_target_disk_account_type: Optional[str] = None, - recovery_replica_disk_account_type: Optional[str] = None, - disk_encryption_info: Optional["_models.DiskEncryptionInfo"] = None, - failover_disk_name: Optional[str] = None, - tfo_disk_name: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword disk_id: The disk Id. - :paramtype disk_id: str - :keyword recovery_target_disk_account_type: The target disk type before failover. - :paramtype recovery_target_disk_account_type: str - :keyword recovery_replica_disk_account_type: The replica disk type before failover. - :paramtype recovery_replica_disk_account_type: str - :keyword disk_encryption_info: The recovery os disk encryption information. - :paramtype disk_encryption_info: - ~azure.mgmt.recoveryservicessiterecovery.models.DiskEncryptionInfo - :keyword failover_disk_name: The target disk name for unplanned failover operation. - :paramtype failover_disk_name: str - :keyword tfo_disk_name: The target disk name for test failover operation. - :paramtype tfo_disk_name: str - """ - super().__init__(**kwargs) - self.disk_id = disk_id - self.recovery_target_disk_account_type = recovery_target_disk_account_type - self.recovery_replica_disk_account_type = recovery_replica_disk_account_type - self.disk_encryption_info = disk_encryption_info - self.failover_disk_name = failover_disk_name - self.tfo_disk_name = tfo_disk_name - - -class A2AZoneDetails(_serialization.Model): - """Zone details data. - - :ivar source: Source zone info. - :vartype source: str - :ivar target: The target zone info. - :vartype target: str - """ - - _attribute_map = { - "source": {"key": "source", "type": "str"}, - "target": {"key": "target", "type": "str"}, - } - - def __init__(self, *, source: Optional[str] = None, target: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword source: Source zone info. - :paramtype source: str - :keyword target: The target zone info. - :paramtype target: str - """ - super().__init__(**kwargs) - self.source = source - self.target = target - - -class AddDisksInput(_serialization.Model): - """Input for add disk(s) operation. - - :ivar properties: Add disks input properties. - :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.AddDisksInputProperties - """ - - _attribute_map = { - "properties": {"key": "properties", "type": "AddDisksInputProperties"}, - } - - def __init__(self, *, properties: Optional["_models.AddDisksInputProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Add disks input properties. - :paramtype properties: ~azure.mgmt.recoveryservicessiterecovery.models.AddDisksInputProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class AddDisksInputProperties(_serialization.Model): - """Add Disks input properties. - - All required parameters must be populated in order to send to server. - - :ivar provider_specific_details: The ReplicationProviderInput. For HyperVReplicaAzure provider, - it will be AzureEnableProtectionInput object. For San provider, it will be - SanEnableProtectionInput object. For HyperVReplicaAzure provider, it can be null. Required. - :vartype provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.AddDisksProviderSpecificInput - """ - - _validation = { - "provider_specific_details": {"required": True}, - } - - _attribute_map = { - "provider_specific_details": {"key": "providerSpecificDetails", "type": "AddDisksProviderSpecificInput"}, - } - - def __init__(self, *, provider_specific_details: "_models.AddDisksProviderSpecificInput", **kwargs: Any) -> None: - """ - :keyword provider_specific_details: The ReplicationProviderInput. For HyperVReplicaAzure - provider, it will be AzureEnableProtectionInput object. For San provider, it will be - SanEnableProtectionInput object. For HyperVReplicaAzure provider, it can be null. Required. - :paramtype provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.AddDisksProviderSpecificInput - """ - super().__init__(**kwargs) - self.provider_specific_details = provider_specific_details - - -class AddRecoveryServicesProviderInput(_serialization.Model): - """Input required to add a provider. - - All required parameters must be populated in order to send to server. - - :ivar properties: The properties of an add provider request. Required. - :vartype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.AddRecoveryServicesProviderInputProperties - """ - - _validation = { - "properties": {"required": True}, - } - - _attribute_map = { - "properties": {"key": "properties", "type": "AddRecoveryServicesProviderInputProperties"}, - } - - def __init__(self, *, properties: "_models.AddRecoveryServicesProviderInputProperties", **kwargs: Any) -> None: - """ - :keyword properties: The properties of an add provider request. Required. - :paramtype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.AddRecoveryServicesProviderInputProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class AddRecoveryServicesProviderInputProperties(_serialization.Model): # pylint: disable=name-too-long - """The properties of an add provider request. - - All required parameters must be populated in order to send to server. - - :ivar machine_name: The name of the machine where the provider is getting added. Required. - :vartype machine_name: str - :ivar machine_id: The Id of the machine where the provider is getting added. - :vartype machine_id: str - :ivar bios_id: The Bios Id of the machine. - :vartype bios_id: str - :ivar authentication_identity_input: The identity provider input for DRA authentication. - Required. - :vartype authentication_identity_input: - ~azure.mgmt.recoveryservicessiterecovery.models.IdentityProviderInput - :ivar resource_access_identity_input: The identity provider input for resource access. - Required. - :vartype resource_access_identity_input: - ~azure.mgmt.recoveryservicessiterecovery.models.IdentityProviderInput - :ivar data_plane_authentication_identity_input: The identity provider input for data plane - authentication. - :vartype data_plane_authentication_identity_input: - ~azure.mgmt.recoveryservicessiterecovery.models.IdentityProviderInput - """ - - _validation = { - "machine_name": {"required": True}, - "authentication_identity_input": {"required": True}, - "resource_access_identity_input": {"required": True}, - } - - _attribute_map = { - "machine_name": {"key": "machineName", "type": "str"}, - "machine_id": {"key": "machineId", "type": "str"}, - "bios_id": {"key": "biosId", "type": "str"}, - "authentication_identity_input": {"key": "authenticationIdentityInput", "type": "IdentityProviderInput"}, - "resource_access_identity_input": {"key": "resourceAccessIdentityInput", "type": "IdentityProviderInput"}, - "data_plane_authentication_identity_input": { - "key": "dataPlaneAuthenticationIdentityInput", - "type": "IdentityProviderInput", - }, - } - - def __init__( - self, - *, - machine_name: str, - authentication_identity_input: "_models.IdentityProviderInput", - resource_access_identity_input: "_models.IdentityProviderInput", - machine_id: Optional[str] = None, - bios_id: Optional[str] = None, - data_plane_authentication_identity_input: Optional["_models.IdentityProviderInput"] = None, - **kwargs: Any - ) -> None: - """ - :keyword machine_name: The name of the machine where the provider is getting added. Required. - :paramtype machine_name: str - :keyword machine_id: The Id of the machine where the provider is getting added. - :paramtype machine_id: str - :keyword bios_id: The Bios Id of the machine. - :paramtype bios_id: str - :keyword authentication_identity_input: The identity provider input for DRA authentication. - Required. - :paramtype authentication_identity_input: - ~azure.mgmt.recoveryservicessiterecovery.models.IdentityProviderInput - :keyword resource_access_identity_input: The identity provider input for resource access. - Required. - :paramtype resource_access_identity_input: - ~azure.mgmt.recoveryservicessiterecovery.models.IdentityProviderInput - :keyword data_plane_authentication_identity_input: The identity provider input for data plane - authentication. - :paramtype data_plane_authentication_identity_input: - ~azure.mgmt.recoveryservicessiterecovery.models.IdentityProviderInput - """ - super().__init__(**kwargs) - self.machine_name = machine_name - self.machine_id = machine_id - self.bios_id = bios_id - self.authentication_identity_input = authentication_identity_input - self.resource_access_identity_input = resource_access_identity_input - self.data_plane_authentication_identity_input = data_plane_authentication_identity_input - - -class AddVCenterRequest(_serialization.Model): - """Input required to add vCenter. - - :ivar properties: The properties of an add vCenter request. - :vartype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.AddVCenterRequestProperties - """ - - _attribute_map = { - "properties": {"key": "properties", "type": "AddVCenterRequestProperties"}, - } - - def __init__(self, *, properties: Optional["_models.AddVCenterRequestProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: The properties of an add vCenter request. - :paramtype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.AddVCenterRequestProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class AddVCenterRequestProperties(_serialization.Model): - """The properties of an add vCenter request. - - :ivar friendly_name: The friendly name of the vCenter. - :vartype friendly_name: str - :ivar ip_address: The IP address of the vCenter to be discovered. - :vartype ip_address: str - :ivar process_server_id: The process server Id from where the discovery is orchestrated. - :vartype process_server_id: str - :ivar port: The port number for discovery. - :vartype port: str - :ivar run_as_account_id: The account Id which has privileges to discover the vCenter. - :vartype run_as_account_id: str - """ - - _attribute_map = { - "friendly_name": {"key": "friendlyName", "type": "str"}, - "ip_address": {"key": "ipAddress", "type": "str"}, - "process_server_id": {"key": "processServerId", "type": "str"}, - "port": {"key": "port", "type": "str"}, - "run_as_account_id": {"key": "runAsAccountId", "type": "str"}, - } - - def __init__( - self, - *, - friendly_name: Optional[str] = None, - ip_address: Optional[str] = None, - process_server_id: Optional[str] = None, - port: Optional[str] = None, - run_as_account_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword friendly_name: The friendly name of the vCenter. - :paramtype friendly_name: str - :keyword ip_address: The IP address of the vCenter to be discovered. - :paramtype ip_address: str - :keyword process_server_id: The process server Id from where the discovery is orchestrated. - :paramtype process_server_id: str - :keyword port: The port number for discovery. - :paramtype port: str - :keyword run_as_account_id: The account Id which has privileges to discover the vCenter. - :paramtype run_as_account_id: str - """ - super().__init__(**kwargs) - self.friendly_name = friendly_name - self.ip_address = ip_address - self.process_server_id = process_server_id - self.port = port - self.run_as_account_id = run_as_account_id - - -class AgentDetails(_serialization.Model): - """Agent details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar agent_id: The Id of the agent running on the server. - :vartype agent_id: str - :ivar machine_id: The Id of the machine to which the agent is registered. - :vartype machine_id: str - :ivar bios_id: The machine BIOS Id. - :vartype bios_id: str - :ivar fqdn: The machine FQDN. - :vartype fqdn: str - :ivar disks: The disks. - :vartype disks: list[~azure.mgmt.recoveryservicessiterecovery.models.AgentDiskDetails] - """ - - _validation = { - "agent_id": {"readonly": True}, - "machine_id": {"readonly": True}, - "bios_id": {"readonly": True}, - "fqdn": {"readonly": True}, - "disks": {"readonly": True}, - } - - _attribute_map = { - "agent_id": {"key": "agentId", "type": "str"}, - "machine_id": {"key": "machineId", "type": "str"}, - "bios_id": {"key": "biosId", "type": "str"}, - "fqdn": {"key": "fqdn", "type": "str"}, - "disks": {"key": "disks", "type": "[AgentDiskDetails]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.agent_id: Optional[str] = None - self.machine_id: Optional[str] = None - self.bios_id: Optional[str] = None - self.fqdn: Optional[str] = None - self.disks: Optional[List["_models.AgentDiskDetails"]] = None - - -class AgentDiskDetails(_serialization.Model): - """Agent disk details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar disk_id: The disk Id. - :vartype disk_id: str - :ivar disk_name: The disk name. - :vartype disk_name: str - :ivar is_os_disk: A value indicating whether the disk is the OS disk. - :vartype is_os_disk: str - :ivar capacity_in_bytes: The disk capacity in bytes. - :vartype capacity_in_bytes: int - :ivar lun_id: The lun of disk. - :vartype lun_id: int - """ - - _validation = { - "disk_id": {"readonly": True}, - "disk_name": {"readonly": True}, - "is_os_disk": {"readonly": True}, - "capacity_in_bytes": {"readonly": True}, - "lun_id": {"readonly": True}, - } - - _attribute_map = { - "disk_id": {"key": "diskId", "type": "str"}, - "disk_name": {"key": "diskName", "type": "str"}, - "is_os_disk": {"key": "isOSDisk", "type": "str"}, - "capacity_in_bytes": {"key": "capacityInBytes", "type": "int"}, - "lun_id": {"key": "lunId", "type": "int"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.disk_id: Optional[str] = None - self.disk_name: Optional[str] = None - self.is_os_disk: Optional[str] = None - self.capacity_in_bytes: Optional[int] = None - self.lun_id: Optional[int] = None - - -class Resource(_serialization.Model): - """Azure resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :ivar type: Resource Type. - :vartype type: str - :ivar location: Resource Location. - :vartype location: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - } - - def __init__(self, *, location: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword location: Resource Location. - :paramtype location: str - """ - super().__init__(**kwargs) - self.id: Optional[str] = None - self.name: Optional[str] = None - self.type: Optional[str] = None - self.location = location - - -class Alert(Resource): - """Implements the Alert class. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :ivar type: Resource Type. - :vartype type: str - :ivar location: Resource Location. - :vartype location: str - :ivar properties: Alert related data. - :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.AlertProperties - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "properties": {"key": "properties", "type": "AlertProperties"}, - } - - def __init__( - self, *, location: Optional[str] = None, properties: Optional["_models.AlertProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword location: Resource Location. - :paramtype location: str - :keyword properties: Alert related data. - :paramtype properties: ~azure.mgmt.recoveryservicessiterecovery.models.AlertProperties - """ - super().__init__(location=location, **kwargs) - self.properties = properties - - -class AlertCollection(_serialization.Model): - """Collection of alerts. - - :ivar value: The list of alerts. - :vartype value: list[~azure.mgmt.recoveryservicessiterecovery.models.Alert] - :ivar next_link: The value of next link. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[Alert]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.Alert"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The list of alerts. - :paramtype value: list[~azure.mgmt.recoveryservicessiterecovery.models.Alert] - :keyword next_link: The value of next link. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class AlertProperties(_serialization.Model): - """The properties of an alert. - - :ivar send_to_owners: A value indicating whether to send email to subscription administrator. - :vartype send_to_owners: str - :ivar custom_email_addresses: The custom email address for sending emails. - :vartype custom_email_addresses: list[str] - :ivar locale: The locale for the email notification. - :vartype locale: str - """ - - _attribute_map = { - "send_to_owners": {"key": "sendToOwners", "type": "str"}, - "custom_email_addresses": {"key": "customEmailAddresses", "type": "[str]"}, - "locale": {"key": "locale", "type": "str"}, - } - - def __init__( - self, - *, - send_to_owners: Optional[str] = None, - custom_email_addresses: Optional[List[str]] = None, - locale: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword send_to_owners: A value indicating whether to send email to subscription - administrator. - :paramtype send_to_owners: str - :keyword custom_email_addresses: The custom email address for sending emails. - :paramtype custom_email_addresses: list[str] - :keyword locale: The locale for the email notification. - :paramtype locale: str - """ - super().__init__(**kwargs) - self.send_to_owners = send_to_owners - self.custom_email_addresses = custom_email_addresses - self.locale = locale - - -class ApplianceCollection(_serialization.Model): - """Collection of appliance details. - - :ivar value: The appliance details. - :vartype value: list[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationAppliance] - :ivar next_link: The value of next link. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[ReplicationAppliance]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.ReplicationAppliance"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The appliance details. - :paramtype value: list[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationAppliance] - :keyword next_link: The value of next link. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ApplianceMonitoringDetails(_serialization.Model): - """Appliance details of the migration item. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar cpu_details: The appliance CPU details. - :vartype cpu_details: ~azure.mgmt.recoveryservicessiterecovery.models.ApplianceResourceDetails - :ivar ram_details: The appliance RAM details. - :vartype ram_details: ~azure.mgmt.recoveryservicessiterecovery.models.ApplianceResourceDetails - :ivar datastore_snapshot: The appliance datastore snapshot details. - :vartype datastore_snapshot: - list[~azure.mgmt.recoveryservicessiterecovery.models.DataStoreUtilizationDetails] - :ivar disks_replication_details: The disk replication details. - :vartype disks_replication_details: - ~azure.mgmt.recoveryservicessiterecovery.models.ApplianceResourceDetails - :ivar esxi_nfc_buffer: The ESXi NFC buffer details. - :vartype esxi_nfc_buffer: - ~azure.mgmt.recoveryservicessiterecovery.models.ApplianceResourceDetails - :ivar network_bandwidth: The appliance network bandwidth details. - :vartype network_bandwidth: - ~azure.mgmt.recoveryservicessiterecovery.models.ApplianceResourceDetails - """ - - _validation = { - "cpu_details": {"readonly": True}, - "ram_details": {"readonly": True}, - "datastore_snapshot": {"readonly": True}, - "disks_replication_details": {"readonly": True}, - "esxi_nfc_buffer": {"readonly": True}, - "network_bandwidth": {"readonly": True}, - } - - _attribute_map = { - "cpu_details": {"key": "cpuDetails", "type": "ApplianceResourceDetails"}, - "ram_details": {"key": "ramDetails", "type": "ApplianceResourceDetails"}, - "datastore_snapshot": {"key": "datastoreSnapshot", "type": "[DataStoreUtilizationDetails]"}, - "disks_replication_details": {"key": "disksReplicationDetails", "type": "ApplianceResourceDetails"}, - "esxi_nfc_buffer": {"key": "esxiNfcBuffer", "type": "ApplianceResourceDetails"}, - "network_bandwidth": {"key": "networkBandwidth", "type": "ApplianceResourceDetails"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cpu_details: Optional["_models.ApplianceResourceDetails"] = None - self.ram_details: Optional["_models.ApplianceResourceDetails"] = None - self.datastore_snapshot: Optional[List["_models.DataStoreUtilizationDetails"]] = None - self.disks_replication_details: Optional["_models.ApplianceResourceDetails"] = None - self.esxi_nfc_buffer: Optional["_models.ApplianceResourceDetails"] = None - self.network_bandwidth: Optional["_models.ApplianceResourceDetails"] = None - - -class ApplianceQueryParameter(_serialization.Model): - """Query parameter to get appliance. - - :ivar provider_type: The providerType to be used for fetching appliance details. - :vartype provider_type: str - """ - - _attribute_map = { - "provider_type": {"key": "providerType", "type": "str"}, - } - - def __init__(self, *, provider_type: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword provider_type: The providerType to be used for fetching appliance details. - :paramtype provider_type: str - """ - super().__init__(**kwargs) - self.provider_type = provider_type - - -class ApplianceResourceDetails(_serialization.Model): - """Details of the appliance resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar capacity: A value indicating the total capacity of appliance resource. - :vartype capacity: int - :ivar process_utilization: A value indicating the utilization percentage by gateway agent on - appliance. - :vartype process_utilization: float - :ivar total_utilization: A value indicating the total utilization percentage for all processes - on the appliance. - :vartype total_utilization: float - :ivar status: A value indicating the status of appliance resource. - :vartype status: str - """ - - _validation = { - "capacity": {"readonly": True}, - "process_utilization": {"readonly": True}, - "total_utilization": {"readonly": True}, - "status": {"readonly": True}, - } - - _attribute_map = { - "capacity": {"key": "capacity", "type": "int"}, - "process_utilization": {"key": "processUtilization", "type": "float"}, - "total_utilization": {"key": "totalUtilization", "type": "float"}, - "status": {"key": "status", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.capacity: Optional[int] = None - self.process_utilization: Optional[float] = None - self.total_utilization: Optional[float] = None - self.status: Optional[str] = None - - -class ApplianceSpecificDetails(_serialization.Model): - """Appliance specific details. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - InMageRcmApplianceSpecificDetails - - All required parameters must be populated in order to send to server. - - :ivar instance_type: Gets the class type. Overridden in derived classes. Required. - :vartype instance_type: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - } - - _subtype_map = {"instance_type": {"InMageRcm": "InMageRcmApplianceSpecificDetails"}} - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.instance_type: Optional[str] = None - - -class ApplyClusterRecoveryPointInput(_serialization.Model): - """Input definition for apply cluster recovery point. - - All required parameters must be populated in order to send to server. - - :ivar properties: The properties to apply cluster recovery point input. Required. - :vartype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.ApplyClusterRecoveryPointInputProperties - """ - - _validation = { - "properties": {"required": True}, - } - - _attribute_map = { - "properties": {"key": "properties", "type": "ApplyClusterRecoveryPointInputProperties"}, - } - - def __init__(self, *, properties: "_models.ApplyClusterRecoveryPointInputProperties", **kwargs: Any) -> None: - """ - :keyword properties: The properties to apply cluster recovery point input. Required. - :paramtype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.ApplyClusterRecoveryPointInputProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ApplyClusterRecoveryPointInputProperties(_serialization.Model): - """Input definition for apply cluster recovery point properties. - - All required parameters must be populated in order to send to server. - - :ivar cluster_recovery_point_id: The cluster recovery point id to be passed to failover to a - particular recovery point. - :vartype cluster_recovery_point_id: str - :ivar individual_node_recovery_points: The list of individual node recovery points. - :vartype individual_node_recovery_points: list[str] - :ivar provider_specific_details: The provider specific input for applying cluster recovery - point. Required. - :vartype provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.ApplyClusterRecoveryPointProviderSpecificInput - """ - - _validation = { - "provider_specific_details": {"required": True}, - } - - _attribute_map = { - "cluster_recovery_point_id": {"key": "clusterRecoveryPointId", "type": "str"}, - "individual_node_recovery_points": {"key": "individualNodeRecoveryPoints", "type": "[str]"}, - "provider_specific_details": { - "key": "providerSpecificDetails", - "type": "ApplyClusterRecoveryPointProviderSpecificInput", - }, - } - - def __init__( - self, - *, - provider_specific_details: "_models.ApplyClusterRecoveryPointProviderSpecificInput", - cluster_recovery_point_id: Optional[str] = None, - individual_node_recovery_points: Optional[List[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword cluster_recovery_point_id: The cluster recovery point id to be passed to failover to a - particular recovery point. - :paramtype cluster_recovery_point_id: str - :keyword individual_node_recovery_points: The list of individual node recovery points. - :paramtype individual_node_recovery_points: list[str] - :keyword provider_specific_details: The provider specific input for applying cluster recovery - point. Required. - :paramtype provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.ApplyClusterRecoveryPointProviderSpecificInput - """ - super().__init__(**kwargs) - self.cluster_recovery_point_id = cluster_recovery_point_id - self.individual_node_recovery_points = individual_node_recovery_points - self.provider_specific_details = provider_specific_details - - -class ApplyRecoveryPointInput(_serialization.Model): - """Input to apply recovery point. - - All required parameters must be populated in order to send to server. - - :ivar properties: The input properties to apply recovery point. Required. - :vartype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.ApplyRecoveryPointInputProperties - """ - - _validation = { - "properties": {"required": True}, - } - - _attribute_map = { - "properties": {"key": "properties", "type": "ApplyRecoveryPointInputProperties"}, - } - - def __init__(self, *, properties: "_models.ApplyRecoveryPointInputProperties", **kwargs: Any) -> None: - """ - :keyword properties: The input properties to apply recovery point. Required. - :paramtype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.ApplyRecoveryPointInputProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ApplyRecoveryPointInputProperties(_serialization.Model): - """Input properties to apply recovery point. - - All required parameters must be populated in order to send to server. - - :ivar recovery_point_id: The recovery point Id. - :vartype recovery_point_id: str - :ivar provider_specific_details: Provider specific input for applying recovery point. Required. - :vartype provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.ApplyRecoveryPointProviderSpecificInput - """ - - _validation = { - "provider_specific_details": {"required": True}, - } - - _attribute_map = { - "recovery_point_id": {"key": "recoveryPointId", "type": "str"}, - "provider_specific_details": { - "key": "providerSpecificDetails", - "type": "ApplyRecoveryPointProviderSpecificInput", - }, - } - - def __init__( - self, - *, - provider_specific_details: "_models.ApplyRecoveryPointProviderSpecificInput", - recovery_point_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword recovery_point_id: The recovery point Id. - :paramtype recovery_point_id: str - :keyword provider_specific_details: Provider specific input for applying recovery point. - Required. - :paramtype provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.ApplyRecoveryPointProviderSpecificInput - """ - super().__init__(**kwargs) - self.recovery_point_id = recovery_point_id - self.provider_specific_details = provider_specific_details - - -class JobDetails(_serialization.Model): - """Job details based on specific job type. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - AsrJobDetails, ClusterFailoverJobDetails, ClusterSwitchProtectionJobDetails, - ClusterTestFailoverJobDetails, ExportJobDetails, FailoverJobDetails, - SwitchProtectionJobDetails, TestFailoverJobDetails - - All required parameters must be populated in order to send to server. - - :ivar instance_type: Gets the type of job details (see JobDetailsTypes enum for possible - values). Required. - :vartype instance_type: str - :ivar affected_object_details: The affected object properties like source server, source cloud, - target server, target cloud etc. based on the workflow object details. - :vartype affected_object_details: dict[str, str] - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "affected_object_details": {"key": "affectedObjectDetails", "type": "{str}"}, - } - - _subtype_map = { - "instance_type": { - "AsrJobDetails": "AsrJobDetails", - "ClusterFailoverJobDetails": "ClusterFailoverJobDetails", - "ClusterSwitchProtectionJobDetails": "ClusterSwitchProtectionJobDetails", - "ClusterTestFailoverJobDetails": "ClusterTestFailoverJobDetails", - "ExportJobDetails": "ExportJobDetails", - "FailoverJobDetails": "FailoverJobDetails", - "SwitchProtectionJobDetails": "SwitchProtectionJobDetails", - "TestFailoverJobDetails": "TestFailoverJobDetails", - } - } - - def __init__(self, *, affected_object_details: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: - """ - :keyword affected_object_details: The affected object properties like source server, source - cloud, target server, target cloud etc. based on the workflow object details. - :paramtype affected_object_details: dict[str, str] - """ - super().__init__(**kwargs) - self.instance_type: Optional[str] = None - self.affected_object_details = affected_object_details - - -class AsrJobDetails(JobDetails): - """This class represents job details based on specific job type. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: Gets the type of job details (see JobDetailsTypes enum for possible - values). Required. - :vartype instance_type: str - :ivar affected_object_details: The affected object properties like source server, source cloud, - target server, target cloud etc. based on the workflow object details. - :vartype affected_object_details: dict[str, str] - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "affected_object_details": {"key": "affectedObjectDetails", "type": "{str}"}, - } - - def __init__(self, *, affected_object_details: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: - """ - :keyword affected_object_details: The affected object properties like source server, source - cloud, target server, target cloud etc. based on the workflow object details. - :paramtype affected_object_details: dict[str, str] - """ - super().__init__(affected_object_details=affected_object_details, **kwargs) - self.instance_type: str = "AsrJobDetails" - - -class ASRTask(_serialization.Model): - """Task of the Job. - - :ivar task_id: The Id. - :vartype task_id: str - :ivar name: The unique Task name. - :vartype name: str - :ivar start_time: The start time. - :vartype start_time: ~datetime.datetime - :ivar end_time: The end time. - :vartype end_time: ~datetime.datetime - :ivar allowed_actions: The state/actions applicable on this task. - :vartype allowed_actions: list[str] - :ivar friendly_name: The name. - :vartype friendly_name: str - :ivar state: The State. It is one of these values - NotStarted, InProgress, Succeeded, Failed, - Cancelled, Suspended or Other. - :vartype state: str - :ivar state_description: The description of the task state. For example - For Succeeded state, - description can be Completed, PartiallySucceeded, CompletedWithInformation or Skipped. - :vartype state_description: str - :ivar task_type: The type of task. Details in CustomDetails property depend on this type. - :vartype task_type: str - :ivar custom_details: The custom task details based on the task type. - :vartype custom_details: ~azure.mgmt.recoveryservicessiterecovery.models.TaskTypeDetails - :ivar group_task_custom_details: The custom task details based on the task type, if the task - type is GroupTaskDetails or one of the types derived from it. - :vartype group_task_custom_details: - ~azure.mgmt.recoveryservicessiterecovery.models.GroupTaskDetails - :ivar errors: The task error details. - :vartype errors: list[~azure.mgmt.recoveryservicessiterecovery.models.JobErrorDetails] - """ - - _attribute_map = { - "task_id": {"key": "taskId", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "start_time": {"key": "startTime", "type": "iso-8601"}, - "end_time": {"key": "endTime", "type": "iso-8601"}, - "allowed_actions": {"key": "allowedActions", "type": "[str]"}, - "friendly_name": {"key": "friendlyName", "type": "str"}, - "state": {"key": "state", "type": "str"}, - "state_description": {"key": "stateDescription", "type": "str"}, - "task_type": {"key": "taskType", "type": "str"}, - "custom_details": {"key": "customDetails", "type": "TaskTypeDetails"}, - "group_task_custom_details": {"key": "groupTaskCustomDetails", "type": "GroupTaskDetails"}, - "errors": {"key": "errors", "type": "[JobErrorDetails]"}, - } - - def __init__( - self, - *, - task_id: Optional[str] = None, - name: Optional[str] = None, - start_time: Optional[datetime.datetime] = None, - end_time: Optional[datetime.datetime] = None, - allowed_actions: Optional[List[str]] = None, - friendly_name: Optional[str] = None, - state: Optional[str] = None, - state_description: Optional[str] = None, - task_type: Optional[str] = None, - custom_details: Optional["_models.TaskTypeDetails"] = None, - group_task_custom_details: Optional["_models.GroupTaskDetails"] = None, - errors: Optional[List["_models.JobErrorDetails"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword task_id: The Id. - :paramtype task_id: str - :keyword name: The unique Task name. - :paramtype name: str - :keyword start_time: The start time. - :paramtype start_time: ~datetime.datetime - :keyword end_time: The end time. - :paramtype end_time: ~datetime.datetime - :keyword allowed_actions: The state/actions applicable on this task. - :paramtype allowed_actions: list[str] - :keyword friendly_name: The name. - :paramtype friendly_name: str - :keyword state: The State. It is one of these values - NotStarted, InProgress, Succeeded, - Failed, Cancelled, Suspended or Other. - :paramtype state: str - :keyword state_description: The description of the task state. For example - For Succeeded - state, description can be Completed, PartiallySucceeded, CompletedWithInformation or Skipped. - :paramtype state_description: str - :keyword task_type: The type of task. Details in CustomDetails property depend on this type. - :paramtype task_type: str - :keyword custom_details: The custom task details based on the task type. - :paramtype custom_details: ~azure.mgmt.recoveryservicessiterecovery.models.TaskTypeDetails - :keyword group_task_custom_details: The custom task details based on the task type, if the task - type is GroupTaskDetails or one of the types derived from it. - :paramtype group_task_custom_details: - ~azure.mgmt.recoveryservicessiterecovery.models.GroupTaskDetails - :keyword errors: The task error details. - :paramtype errors: list[~azure.mgmt.recoveryservicessiterecovery.models.JobErrorDetails] - """ - super().__init__(**kwargs) - self.task_id = task_id - self.name = name - self.start_time = start_time - self.end_time = end_time - self.allowed_actions = allowed_actions - self.friendly_name = friendly_name - self.state = state - self.state_description = state_description - self.task_type = task_type - self.custom_details = custom_details - self.group_task_custom_details = group_task_custom_details - self.errors = errors - - -class TaskTypeDetails(_serialization.Model): - """Task details based on specific task type. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - AutomationRunbookTaskDetails, ConsistencyCheckTaskDetails, JobTaskDetails, - ManualActionTaskDetails, ScriptActionTaskDetails, VmNicUpdatesTaskDetails - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The type of task details. Required. - :vartype instance_type: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - } - - _subtype_map = { - "instance_type": { - "AutomationRunbookTaskDetails": "AutomationRunbookTaskDetails", - "ConsistencyCheckTaskDetails": "ConsistencyCheckTaskDetails", - "JobTaskDetails": "JobTaskDetails", - "ManualActionTaskDetails": "ManualActionTaskDetails", - "ScriptActionTaskDetails": "ScriptActionTaskDetails", - "VmNicUpdatesTaskDetails": "VmNicUpdatesTaskDetails", - } - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.instance_type: Optional[str] = None - - -class AutomationRunbookTaskDetails(TaskTypeDetails): - """This class represents the task details for an automation runbook. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The type of task details. Required. - :vartype instance_type: str - :ivar name: The recovery plan task name. - :vartype name: str - :ivar cloud_service_name: The cloud service of the automation runbook account. - :vartype cloud_service_name: str - :ivar subscription_id: The subscription Id of the automation runbook account. - :vartype subscription_id: str - :ivar account_name: The automation account name of the runbook. - :vartype account_name: str - :ivar runbook_id: The runbook Id. - :vartype runbook_id: str - :ivar runbook_name: The runbook name. - :vartype runbook_name: str - :ivar job_id: The job Id of the runbook execution. - :vartype job_id: str - :ivar job_output: The execution output of the runbook. - :vartype job_output: str - :ivar is_primary_side_script: A value indicating whether it is a primary side script or not. - :vartype is_primary_side_script: bool - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "cloud_service_name": {"key": "cloudServiceName", "type": "str"}, - "subscription_id": {"key": "subscriptionId", "type": "str"}, - "account_name": {"key": "accountName", "type": "str"}, - "runbook_id": {"key": "runbookId", "type": "str"}, - "runbook_name": {"key": "runbookName", "type": "str"}, - "job_id": {"key": "jobId", "type": "str"}, - "job_output": {"key": "jobOutput", "type": "str"}, - "is_primary_side_script": {"key": "isPrimarySideScript", "type": "bool"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - cloud_service_name: Optional[str] = None, - subscription_id: Optional[str] = None, - account_name: Optional[str] = None, - runbook_id: Optional[str] = None, - runbook_name: Optional[str] = None, - job_id: Optional[str] = None, - job_output: Optional[str] = None, - is_primary_side_script: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: The recovery plan task name. - :paramtype name: str - :keyword cloud_service_name: The cloud service of the automation runbook account. - :paramtype cloud_service_name: str - :keyword subscription_id: The subscription Id of the automation runbook account. - :paramtype subscription_id: str - :keyword account_name: The automation account name of the runbook. - :paramtype account_name: str - :keyword runbook_id: The runbook Id. - :paramtype runbook_id: str - :keyword runbook_name: The runbook name. - :paramtype runbook_name: str - :keyword job_id: The job Id of the runbook execution. - :paramtype job_id: str - :keyword job_output: The execution output of the runbook. - :paramtype job_output: str - :keyword is_primary_side_script: A value indicating whether it is a primary side script or not. - :paramtype is_primary_side_script: bool - """ - super().__init__(**kwargs) - self.instance_type: str = "AutomationRunbookTaskDetails" - self.name = name - self.cloud_service_name = cloud_service_name - self.subscription_id = subscription_id - self.account_name = account_name - self.runbook_id = runbook_id - self.runbook_name = runbook_name - self.job_id = job_id - self.job_output = job_output - self.is_primary_side_script = is_primary_side_script - - -class FabricSpecificCreationInput(_serialization.Model): - """Fabric provider specific settings. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - AzureFabricCreationInput, InMageRcmFabricCreationInput, VMwareV2FabricCreationInput - - All required parameters must be populated in order to send to server. - - :ivar instance_type: Gets the class type. Required. - :vartype instance_type: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - } - - _subtype_map = { - "instance_type": { - "Azure": "AzureFabricCreationInput", - "InMageRcm": "InMageRcmFabricCreationInput", - "VMwareV2": "VMwareV2FabricCreationInput", - } - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.instance_type: Optional[str] = None - - -class AzureFabricCreationInput(FabricSpecificCreationInput): - """Fabric provider specific settings. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: Gets the class type. Required. - :vartype instance_type: str - :ivar location: The Location. - :vartype location: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "location": {"key": "location", "type": "str"}, - } - - def __init__(self, *, location: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword location: The Location. - :paramtype location: str - """ - super().__init__(**kwargs) - self.instance_type: str = "Azure" - self.location = location - - -class FabricSpecificDetails(_serialization.Model): - """Fabric specific details. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - AzureFabricSpecificDetails, HyperVSiteDetails, InMageRcmFabricSpecificDetails, VmmDetails, - VMwareDetails, VMwareV2FabricSpecificDetails - - All required parameters must be populated in order to send to server. - - :ivar instance_type: Gets the class type. Overridden in derived classes. Required. - :vartype instance_type: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - } - - _subtype_map = { - "instance_type": { - "Azure": "AzureFabricSpecificDetails", - "HyperVSite": "HyperVSiteDetails", - "InMageRcm": "InMageRcmFabricSpecificDetails", - "VMM": "VmmDetails", - "VMware": "VMwareDetails", - "VMwareV2": "VMwareV2FabricSpecificDetails", - } - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.instance_type: Optional[str] = None - - -class AzureFabricSpecificDetails(FabricSpecificDetails): - """Azure Fabric Specific Details. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: Gets the class type. Overridden in derived classes. Required. - :vartype instance_type: str - :ivar location: The Location for the Azure fabric. - :vartype location: str - :ivar container_ids: The container Ids for the Azure fabric. - :vartype container_ids: list[str] - :ivar zones: The zones. - :vartype zones: list[~azure.mgmt.recoveryservicessiterecovery.models.A2AZoneDetails] - :ivar extended_locations: The ExtendedLocations. - :vartype extended_locations: - list[~azure.mgmt.recoveryservicessiterecovery.models.A2AExtendedLocationDetails] - :ivar location_details: The location details. - :vartype location_details: - list[~azure.mgmt.recoveryservicessiterecovery.models.A2AFabricSpecificLocationDetails] - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "container_ids": {"key": "containerIds", "type": "[str]"}, - "zones": {"key": "zones", "type": "[A2AZoneDetails]"}, - "extended_locations": {"key": "extendedLocations", "type": "[A2AExtendedLocationDetails]"}, - "location_details": {"key": "locationDetails", "type": "[A2AFabricSpecificLocationDetails]"}, - } - - def __init__( - self, - *, - location: Optional[str] = None, - container_ids: Optional[List[str]] = None, - zones: Optional[List["_models.A2AZoneDetails"]] = None, - extended_locations: Optional[List["_models.A2AExtendedLocationDetails"]] = None, - location_details: Optional[List["_models.A2AFabricSpecificLocationDetails"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword location: The Location for the Azure fabric. - :paramtype location: str - :keyword container_ids: The container Ids for the Azure fabric. - :paramtype container_ids: list[str] - :keyword zones: The zones. - :paramtype zones: list[~azure.mgmt.recoveryservicessiterecovery.models.A2AZoneDetails] - :keyword extended_locations: The ExtendedLocations. - :paramtype extended_locations: - list[~azure.mgmt.recoveryservicessiterecovery.models.A2AExtendedLocationDetails] - :keyword location_details: The location details. - :paramtype location_details: - list[~azure.mgmt.recoveryservicessiterecovery.models.A2AFabricSpecificLocationDetails] - """ - super().__init__(**kwargs) - self.instance_type: str = "Azure" - self.location = location - self.container_ids = container_ids - self.zones = zones - self.extended_locations = extended_locations - self.location_details = location_details - - -class FabricSpecificCreateNetworkMappingInput(_serialization.Model): - """Input details specific to fabrics during Network Mapping. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - AzureToAzureCreateNetworkMappingInput, VmmToAzureCreateNetworkMappingInput, - VmmToVmmCreateNetworkMappingInput - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The instance type. Required. - :vartype instance_type: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - } - - _subtype_map = { - "instance_type": { - "AzureToAzure": "AzureToAzureCreateNetworkMappingInput", - "VmmToAzure": "VmmToAzureCreateNetworkMappingInput", - "VmmToVmm": "VmmToVmmCreateNetworkMappingInput", - } - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.instance_type: Optional[str] = None - - -class AzureToAzureCreateNetworkMappingInput(FabricSpecificCreateNetworkMappingInput): - """Create network mappings input properties/behavior specific to Azure to Azure Network mapping. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The instance type. Required. - :vartype instance_type: str - :ivar primary_network_id: The primary azure vnet Id. Required. - :vartype primary_network_id: str - """ - - _validation = { - "instance_type": {"required": True}, - "primary_network_id": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "primary_network_id": {"key": "primaryNetworkId", "type": "str"}, - } - - def __init__(self, *, primary_network_id: str, **kwargs: Any) -> None: - """ - :keyword primary_network_id: The primary azure vnet Id. Required. - :paramtype primary_network_id: str - """ - super().__init__(**kwargs) - self.instance_type: str = "AzureToAzure" - self.primary_network_id = primary_network_id - - -class NetworkMappingFabricSpecificSettings(_serialization.Model): - """Network Mapping fabric specific settings. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - AzureToAzureNetworkMappingSettings, VmmToAzureNetworkMappingSettings, - VmmToVmmNetworkMappingSettings - - All required parameters must be populated in order to send to server. - - :ivar instance_type: Gets the Instance type. Required. - :vartype instance_type: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - } - - _subtype_map = { - "instance_type": { - "AzureToAzure": "AzureToAzureNetworkMappingSettings", - "VmmToAzure": "VmmToAzureNetworkMappingSettings", - "VmmToVmm": "VmmToVmmNetworkMappingSettings", - } - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.instance_type: Optional[str] = None - - -class AzureToAzureNetworkMappingSettings(NetworkMappingFabricSpecificSettings): - """A2A Network Mapping fabric specific settings. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: Gets the Instance type. Required. - :vartype instance_type: str - :ivar primary_fabric_location: The primary fabric location. - :vartype primary_fabric_location: str - :ivar recovery_fabric_location: The recovery fabric location. - :vartype recovery_fabric_location: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "primary_fabric_location": {"key": "primaryFabricLocation", "type": "str"}, - "recovery_fabric_location": {"key": "recoveryFabricLocation", "type": "str"}, - } - - def __init__( - self, - *, - primary_fabric_location: Optional[str] = None, - recovery_fabric_location: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword primary_fabric_location: The primary fabric location. - :paramtype primary_fabric_location: str - :keyword recovery_fabric_location: The recovery fabric location. - :paramtype recovery_fabric_location: str - """ - super().__init__(**kwargs) - self.instance_type: str = "AzureToAzure" - self.primary_fabric_location = primary_fabric_location - self.recovery_fabric_location = recovery_fabric_location - - -class FabricSpecificUpdateNetworkMappingInput(_serialization.Model): - """Input details specific to fabrics during Network Mapping. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - AzureToAzureUpdateNetworkMappingInput, VmmToAzureUpdateNetworkMappingInput, - VmmToVmmUpdateNetworkMappingInput - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The instance type. Required. - :vartype instance_type: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - } - - _subtype_map = { - "instance_type": { - "AzureToAzure": "AzureToAzureUpdateNetworkMappingInput", - "VmmToAzure": "VmmToAzureUpdateNetworkMappingInput", - "VmmToVmm": "VmmToVmmUpdateNetworkMappingInput", - } - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.instance_type: Optional[str] = None - - -class AzureToAzureUpdateNetworkMappingInput(FabricSpecificUpdateNetworkMappingInput): - """Updates network mappings input. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The instance type. Required. - :vartype instance_type: str - :ivar primary_network_id: The primary azure vnet Id. - :vartype primary_network_id: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "primary_network_id": {"key": "primaryNetworkId", "type": "str"}, - } - - def __init__(self, *, primary_network_id: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword primary_network_id: The primary azure vnet Id. - :paramtype primary_network_id: str - """ - super().__init__(**kwargs) - self.instance_type: str = "AzureToAzure" - self.primary_network_id = primary_network_id - - -class AzureToAzureVmSyncedConfigDetails(_serialization.Model): - """Azure to Azure VM synced configuration details. - - :ivar tags: The Azure VM tags. - :vartype tags: dict[str, str] - :ivar input_endpoints: The Azure VM input endpoints. - :vartype input_endpoints: list[~azure.mgmt.recoveryservicessiterecovery.models.InputEndpoint] - """ - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - "input_endpoints": {"key": "inputEndpoints", "type": "[InputEndpoint]"}, - } - - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - input_endpoints: Optional[List["_models.InputEndpoint"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: The Azure VM tags. - :paramtype tags: dict[str, str] - :keyword input_endpoints: The Azure VM input endpoints. - :paramtype input_endpoints: list[~azure.mgmt.recoveryservicessiterecovery.models.InputEndpoint] - """ - super().__init__(**kwargs) - self.tags = tags - self.input_endpoints = input_endpoints - - -class AzureVmDiskDetails(_serialization.Model): - """Disk details for E2A provider. - - :ivar vhd_type: VHD type. - :vartype vhd_type: str - :ivar vhd_id: The VHD id. - :vartype vhd_id: str - :ivar disk_id: The disk resource id. - :vartype disk_id: str - :ivar vhd_name: VHD name. - :vartype vhd_name: str - :ivar max_size_mb: Max side in MB. - :vartype max_size_mb: str - :ivar target_disk_location: Blob uri of the Azure disk. - :vartype target_disk_location: str - :ivar target_disk_name: The target Azure disk name. - :vartype target_disk_name: str - :ivar lun_id: Ordinal\\LunId of the disk for the Azure VM. - :vartype lun_id: str - :ivar disk_encryption_set_id: The DiskEncryptionSet ARM ID. - :vartype disk_encryption_set_id: str - :ivar custom_target_disk_name: The custom target Azure disk name. - :vartype custom_target_disk_name: str - """ - - _attribute_map = { - "vhd_type": {"key": "vhdType", "type": "str"}, - "vhd_id": {"key": "vhdId", "type": "str"}, - "disk_id": {"key": "diskId", "type": "str"}, - "vhd_name": {"key": "vhdName", "type": "str"}, - "max_size_mb": {"key": "maxSizeMB", "type": "str"}, - "target_disk_location": {"key": "targetDiskLocation", "type": "str"}, - "target_disk_name": {"key": "targetDiskName", "type": "str"}, - "lun_id": {"key": "lunId", "type": "str"}, - "disk_encryption_set_id": {"key": "diskEncryptionSetId", "type": "str"}, - "custom_target_disk_name": {"key": "customTargetDiskName", "type": "str"}, - } - - def __init__( - self, - *, - vhd_type: Optional[str] = None, - vhd_id: Optional[str] = None, - disk_id: Optional[str] = None, - vhd_name: Optional[str] = None, - max_size_mb: Optional[str] = None, - target_disk_location: Optional[str] = None, - target_disk_name: Optional[str] = None, - lun_id: Optional[str] = None, - disk_encryption_set_id: Optional[str] = None, - custom_target_disk_name: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword vhd_type: VHD type. - :paramtype vhd_type: str - :keyword vhd_id: The VHD id. - :paramtype vhd_id: str - :keyword disk_id: The disk resource id. - :paramtype disk_id: str - :keyword vhd_name: VHD name. - :paramtype vhd_name: str - :keyword max_size_mb: Max side in MB. - :paramtype max_size_mb: str - :keyword target_disk_location: Blob uri of the Azure disk. - :paramtype target_disk_location: str - :keyword target_disk_name: The target Azure disk name. - :paramtype target_disk_name: str - :keyword lun_id: Ordinal\\LunId of the disk for the Azure VM. - :paramtype lun_id: str - :keyword disk_encryption_set_id: The DiskEncryptionSet ARM ID. - :paramtype disk_encryption_set_id: str - :keyword custom_target_disk_name: The custom target Azure disk name. - :paramtype custom_target_disk_name: str - """ - super().__init__(**kwargs) - self.vhd_type = vhd_type - self.vhd_id = vhd_id - self.disk_id = disk_id - self.vhd_name = vhd_name - self.max_size_mb = max_size_mb - self.target_disk_location = target_disk_location - self.target_disk_name = target_disk_name - self.lun_id = lun_id - self.disk_encryption_set_id = disk_encryption_set_id - self.custom_target_disk_name = custom_target_disk_name - - -class ClusterFailoverJobDetails(JobDetails): - """This class represents the details for a failover job of cluster. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: Gets the type of job details (see JobDetailsTypes enum for possible - values). Required. - :vartype instance_type: str - :ivar affected_object_details: The affected object properties like source server, source cloud, - target server, target cloud etc. based on the workflow object details. - :vartype affected_object_details: dict[str, str] - :ivar protected_item_details: The test VM details. - :vartype protected_item_details: - list[~azure.mgmt.recoveryservicessiterecovery.models.FailoverReplicationProtectedItemDetails] - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "affected_object_details": {"key": "affectedObjectDetails", "type": "{str}"}, - "protected_item_details": {"key": "protectedItemDetails", "type": "[FailoverReplicationProtectedItemDetails]"}, - } - - def __init__( - self, - *, - affected_object_details: Optional[Dict[str, str]] = None, - protected_item_details: Optional[List["_models.FailoverReplicationProtectedItemDetails"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword affected_object_details: The affected object properties like source server, source - cloud, target server, target cloud etc. based on the workflow object details. - :paramtype affected_object_details: dict[str, str] - :keyword protected_item_details: The test VM details. - :paramtype protected_item_details: - list[~azure.mgmt.recoveryservicessiterecovery.models.FailoverReplicationProtectedItemDetails] - """ - super().__init__(affected_object_details=affected_object_details, **kwargs) - self.instance_type: str = "ClusterFailoverJobDetails" - self.protected_item_details = protected_item_details - - -class ClusterRecoveryPoint(_serialization.Model): - """Recovery point. - - :ivar id: The recovery point Id. - :vartype id: str - :ivar name: The name of the recovery point. - :vartype name: str - :ivar type: The resource type. - :vartype type: str - :ivar properties: The recovery point properties. - :vartype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.ClusterRecoveryPointProperties - """ - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "properties": {"key": "properties", "type": "ClusterRecoveryPointProperties"}, - } - - def __init__( - self, - *, - id: Optional[str] = None, # pylint: disable=redefined-builtin - name: Optional[str] = None, - type: Optional[str] = None, - properties: Optional["_models.ClusterRecoveryPointProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: The recovery point Id. - :paramtype id: str - :keyword name: The name of the recovery point. - :paramtype name: str - :keyword type: The resource type. - :paramtype type: str - :keyword properties: The recovery point properties. - :paramtype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.ClusterRecoveryPointProperties - """ - super().__init__(**kwargs) - self.id = id - self.name = name - self.type = type - self.properties = properties - - -class ClusterRecoveryPointCollection(_serialization.Model): - """Collection of cluster recovery point details. - - :ivar value: The cluster recovery point details. - :vartype value: list[~azure.mgmt.recoveryservicessiterecovery.models.ClusterRecoveryPoint] - :ivar next_link: The value of next link. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[ClusterRecoveryPoint]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.ClusterRecoveryPoint"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The cluster recovery point details. - :paramtype value: list[~azure.mgmt.recoveryservicessiterecovery.models.ClusterRecoveryPoint] - :keyword next_link: The value of next link. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ClusterRecoveryPointProperties(_serialization.Model): - """Cluster recovery point properties. - - :ivar recovery_point_time: The recovery point time. - :vartype recovery_point_time: ~datetime.datetime - :ivar recovery_point_type: The recovery point type. Known values are: "NotSpecified", - "ApplicationConsistent", and "CrashConsistent". - :vartype recovery_point_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.ClusterRecoveryPointType - :ivar provider_specific_details: The provider specific details for the recovery point. - :vartype provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.ClusterProviderSpecificRecoveryPointDetails - """ - - _attribute_map = { - "recovery_point_time": {"key": "recoveryPointTime", "type": "iso-8601"}, - "recovery_point_type": {"key": "recoveryPointType", "type": "str"}, - "provider_specific_details": { - "key": "providerSpecificDetails", - "type": "ClusterProviderSpecificRecoveryPointDetails", - }, - } - - def __init__( - self, - *, - recovery_point_time: Optional[datetime.datetime] = None, - recovery_point_type: Optional[Union[str, "_models.ClusterRecoveryPointType"]] = None, - provider_specific_details: Optional["_models.ClusterProviderSpecificRecoveryPointDetails"] = None, - **kwargs: Any - ) -> None: - """ - :keyword recovery_point_time: The recovery point time. - :paramtype recovery_point_time: ~datetime.datetime - :keyword recovery_point_type: The recovery point type. Known values are: "NotSpecified", - "ApplicationConsistent", and "CrashConsistent". - :paramtype recovery_point_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.ClusterRecoveryPointType - :keyword provider_specific_details: The provider specific details for the recovery point. - :paramtype provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.ClusterProviderSpecificRecoveryPointDetails - """ - super().__init__(**kwargs) - self.recovery_point_time = recovery_point_time - self.recovery_point_type = recovery_point_type - self.provider_specific_details = provider_specific_details - - -class ClusterSwitchProtectionJobDetails(JobDetails): - """This class represents details for switch cluster protection job. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: Gets the type of job details (see JobDetailsTypes enum for possible - values). Required. - :vartype instance_type: str - :ivar affected_object_details: The affected object properties like source server, source cloud, - target server, target cloud etc. based on the workflow object details. - :vartype affected_object_details: dict[str, str] - :ivar new_replication_protection_cluster_id: ARM Id of the new replication protection cluster. - :vartype new_replication_protection_cluster_id: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "affected_object_details": {"key": "affectedObjectDetails", "type": "{str}"}, - "new_replication_protection_cluster_id": {"key": "newReplicationProtectionClusterId", "type": "str"}, - } - - def __init__( - self, - *, - affected_object_details: Optional[Dict[str, str]] = None, - new_replication_protection_cluster_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword affected_object_details: The affected object properties like source server, source - cloud, target server, target cloud etc. based on the workflow object details. - :paramtype affected_object_details: dict[str, str] - :keyword new_replication_protection_cluster_id: ARM Id of the new replication protection - cluster. - :paramtype new_replication_protection_cluster_id: str - """ - super().__init__(affected_object_details=affected_object_details, **kwargs) - self.instance_type: str = "ClusterSwitchProtectionJobDetails" - self.new_replication_protection_cluster_id = new_replication_protection_cluster_id - - -class ClusterTestFailoverCleanupInput(_serialization.Model): - """Input definition for test failover cleanup for cluster. - - All required parameters must be populated in order to send to server. - - :ivar properties: Test failover cleanup input properties. Required. - :vartype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.ClusterTestFailoverCleanupInputProperties - """ - - _validation = { - "properties": {"required": True}, - } - - _attribute_map = { - "properties": {"key": "properties", "type": "ClusterTestFailoverCleanupInputProperties"}, - } - - def __init__(self, *, properties: "_models.ClusterTestFailoverCleanupInputProperties", **kwargs: Any) -> None: - """ - :keyword properties: Test failover cleanup input properties. Required. - :paramtype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.ClusterTestFailoverCleanupInputProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ClusterTestFailoverCleanupInputProperties(_serialization.Model): # pylint: disable=name-too-long - """Input definition for test failover cleanup input properties. - - :ivar comments: Test failover cleanup comments. - :vartype comments: str - """ - - _validation = { - "comments": {"max_length": 1024}, - } - - _attribute_map = { - "comments": {"key": "comments", "type": "str"}, - } - - def __init__(self, *, comments: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword comments: Test failover cleanup comments. - :paramtype comments: str - """ - super().__init__(**kwargs) - self.comments = comments - - -class ClusterTestFailoverInput(_serialization.Model): - """Input definition for test cluster failover. - - All required parameters must be populated in order to send to server. - - :ivar properties: Test failover input properties. Required. - :vartype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.ClusterTestFailoverInputProperties - """ - - _validation = { - "properties": {"required": True}, - } - - _attribute_map = { - "properties": {"key": "properties", "type": "ClusterTestFailoverInputProperties"}, - } - - def __init__(self, *, properties: "_models.ClusterTestFailoverInputProperties", **kwargs: Any) -> None: - """ - :keyword properties: Test failover input properties. Required. - :paramtype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.ClusterTestFailoverInputProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ClusterTestFailoverInputProperties(_serialization.Model): - """Input definition for test failover input properties. - - :ivar failover_direction: Failover direction. Known values are: "PrimaryToRecovery" and - "RecoveryToPrimary". - :vartype failover_direction: str or - ~azure.mgmt.recoveryservicessiterecovery.models.FailoverDirection - :ivar network_type: Network type to be used for test failover. - :vartype network_type: str - :ivar network_id: The id of the network to be used for test failover. - :vartype network_id: str - :ivar provider_specific_details: Provider specific settings. - :vartype provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.ClusterTestFailoverProviderSpecificInput - """ - - _attribute_map = { - "failover_direction": {"key": "failoverDirection", "type": "str"}, - "network_type": {"key": "networkType", "type": "str"}, - "network_id": {"key": "networkId", "type": "str"}, - "provider_specific_details": { - "key": "providerSpecificDetails", - "type": "ClusterTestFailoverProviderSpecificInput", - }, - } - - def __init__( - self, - *, - failover_direction: Optional[Union[str, "_models.FailoverDirection"]] = None, - network_type: Optional[str] = None, - network_id: Optional[str] = None, - provider_specific_details: Optional["_models.ClusterTestFailoverProviderSpecificInput"] = None, - **kwargs: Any - ) -> None: - """ - :keyword failover_direction: Failover direction. Known values are: "PrimaryToRecovery" and - "RecoveryToPrimary". - :paramtype failover_direction: str or - ~azure.mgmt.recoveryservicessiterecovery.models.FailoverDirection - :keyword network_type: Network type to be used for test failover. - :paramtype network_type: str - :keyword network_id: The id of the network to be used for test failover. - :paramtype network_id: str - :keyword provider_specific_details: Provider specific settings. - :paramtype provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.ClusterTestFailoverProviderSpecificInput - """ - super().__init__(**kwargs) - self.failover_direction = failover_direction - self.network_type = network_type - self.network_id = network_id - self.provider_specific_details = provider_specific_details - - -class ClusterTestFailoverJobDetails(JobDetails): - """This class represents the details for a test failover job of cluster. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: Gets the type of job details (see JobDetailsTypes enum for possible - values). Required. - :vartype instance_type: str - :ivar affected_object_details: The affected object properties like source server, source cloud, - target server, target cloud etc. based on the workflow object details. - :vartype affected_object_details: dict[str, str] - :ivar test_failover_status: The test failover status. - :vartype test_failover_status: str - :ivar comments: The test failover comments. - :vartype comments: str - :ivar network_name: The test network name. - :vartype network_name: str - :ivar network_friendly_name: The test network friendly name. - :vartype network_friendly_name: str - :ivar network_type: The test network type (see TestFailoverInput enum for possible values). - :vartype network_type: str - :ivar protected_item_details: The test VM details. - :vartype protected_item_details: - list[~azure.mgmt.recoveryservicessiterecovery.models.FailoverReplicationProtectedItemDetails] - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "affected_object_details": {"key": "affectedObjectDetails", "type": "{str}"}, - "test_failover_status": {"key": "testFailoverStatus", "type": "str"}, - "comments": {"key": "comments", "type": "str"}, - "network_name": {"key": "networkName", "type": "str"}, - "network_friendly_name": {"key": "networkFriendlyName", "type": "str"}, - "network_type": {"key": "networkType", "type": "str"}, - "protected_item_details": {"key": "protectedItemDetails", "type": "[FailoverReplicationProtectedItemDetails]"}, - } - - def __init__( - self, - *, - affected_object_details: Optional[Dict[str, str]] = None, - test_failover_status: Optional[str] = None, - comments: Optional[str] = None, - network_name: Optional[str] = None, - network_friendly_name: Optional[str] = None, - network_type: Optional[str] = None, - protected_item_details: Optional[List["_models.FailoverReplicationProtectedItemDetails"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword affected_object_details: The affected object properties like source server, source - cloud, target server, target cloud etc. based on the workflow object details. - :paramtype affected_object_details: dict[str, str] - :keyword test_failover_status: The test failover status. - :paramtype test_failover_status: str - :keyword comments: The test failover comments. - :paramtype comments: str - :keyword network_name: The test network name. - :paramtype network_name: str - :keyword network_friendly_name: The test network friendly name. - :paramtype network_friendly_name: str - :keyword network_type: The test network type (see TestFailoverInput enum for possible values). - :paramtype network_type: str - :keyword protected_item_details: The test VM details. - :paramtype protected_item_details: - list[~azure.mgmt.recoveryservicessiterecovery.models.FailoverReplicationProtectedItemDetails] - """ - super().__init__(affected_object_details=affected_object_details, **kwargs) - self.instance_type: str = "ClusterTestFailoverJobDetails" - self.test_failover_status = test_failover_status - self.comments = comments - self.network_name = network_name - self.network_friendly_name = network_friendly_name - self.network_type = network_type - self.protected_item_details = protected_item_details - - -class ClusterUnplannedFailoverInput(_serialization.Model): - """Input definition for unplanned cluster failover. - - All required parameters must be populated in order to send to server. - - :ivar properties: Unplanned failover input properties. Required. - :vartype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.ClusterUnplannedFailoverInputProperties - """ - - _validation = { - "properties": {"required": True}, - } - - _attribute_map = { - "properties": {"key": "properties", "type": "ClusterUnplannedFailoverInputProperties"}, - } - - def __init__(self, *, properties: "_models.ClusterUnplannedFailoverInputProperties", **kwargs: Any) -> None: - """ - :keyword properties: Unplanned failover input properties. Required. - :paramtype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.ClusterUnplannedFailoverInputProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ClusterUnplannedFailoverInputProperties(_serialization.Model): - """Input definition for unplanned failover input properties. - - :ivar failover_direction: Failover direction. - :vartype failover_direction: str - :ivar source_site_operations: Source site operations status. - :vartype source_site_operations: str - :ivar provider_specific_details: Provider specific settings. - :vartype provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.ClusterUnplannedFailoverProviderSpecificInput - """ - - _attribute_map = { - "failover_direction": {"key": "failoverDirection", "type": "str"}, - "source_site_operations": {"key": "sourceSiteOperations", "type": "str"}, - "provider_specific_details": { - "key": "providerSpecificDetails", - "type": "ClusterUnplannedFailoverProviderSpecificInput", - }, - } - - def __init__( - self, - *, - failover_direction: Optional[str] = None, - source_site_operations: Optional[str] = None, - provider_specific_details: Optional["_models.ClusterUnplannedFailoverProviderSpecificInput"] = None, - **kwargs: Any - ) -> None: - """ - :keyword failover_direction: Failover direction. - :paramtype failover_direction: str - :keyword source_site_operations: Source site operations status. - :paramtype source_site_operations: str - :keyword provider_specific_details: Provider specific settings. - :paramtype provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.ClusterUnplannedFailoverProviderSpecificInput - """ - super().__init__(**kwargs) - self.failover_direction = failover_direction - self.source_site_operations = source_site_operations - self.provider_specific_details = provider_specific_details - - -class ComputeSizeErrorDetails(_serialization.Model): - """Represents the error used to indicate why the target compute size is not applicable. - - :ivar message: The error message. - :vartype message: str - :ivar severity: The severity of the error. - :vartype severity: str - """ - - _attribute_map = { - "message": {"key": "message", "type": "str"}, - "severity": {"key": "severity", "type": "str"}, - } - - def __init__(self, *, message: Optional[str] = None, severity: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword message: The error message. - :paramtype message: str - :keyword severity: The severity of the error. - :paramtype severity: str - """ - super().__init__(**kwargs) - self.message = message - self.severity = severity - - -class ConfigurationSettings(_serialization.Model): - """Replication provider specific settings. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - HyperVVirtualMachineDetails, ReplicationGroupDetails, VMwareVirtualMachineDetails - - All required parameters must be populated in order to send to server. - - :ivar instance_type: Gets the class type. Overridden in derived classes. Required. - :vartype instance_type: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - } - - _subtype_map = { - "instance_type": { - "HyperVVirtualMachine": "HyperVVirtualMachineDetails", - "ReplicationGroupDetails": "ReplicationGroupDetails", - "VMwareVirtualMachine": "VMwareVirtualMachineDetails", - } - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.instance_type: Optional[str] = None - - -class ConfigureAlertRequest(_serialization.Model): - """Request to configure alerts for the system. - - :ivar properties: The properties of a configure alert request. - :vartype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.ConfigureAlertRequestProperties - """ - - _attribute_map = { - "properties": {"key": "properties", "type": "ConfigureAlertRequestProperties"}, - } - - def __init__( - self, *, properties: Optional["_models.ConfigureAlertRequestProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: The properties of a configure alert request. - :paramtype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.ConfigureAlertRequestProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ConfigureAlertRequestProperties(_serialization.Model): - """Properties of a configure alert request. - - :ivar send_to_owners: A value indicating whether to send email to subscription administrator. - :vartype send_to_owners: str - :ivar custom_email_addresses: The custom email address for sending emails. - :vartype custom_email_addresses: list[str] - :ivar locale: The locale for the email notification. - :vartype locale: str - """ - - _attribute_map = { - "send_to_owners": {"key": "sendToOwners", "type": "str"}, - "custom_email_addresses": {"key": "customEmailAddresses", "type": "[str]"}, - "locale": {"key": "locale", "type": "str"}, - } - - def __init__( - self, - *, - send_to_owners: Optional[str] = None, - custom_email_addresses: Optional[List[str]] = None, - locale: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword send_to_owners: A value indicating whether to send email to subscription - administrator. - :paramtype send_to_owners: str - :keyword custom_email_addresses: The custom email address for sending emails. - :paramtype custom_email_addresses: list[str] - :keyword locale: The locale for the email notification. - :paramtype locale: str - """ - super().__init__(**kwargs) - self.send_to_owners = send_to_owners - self.custom_email_addresses = custom_email_addresses - self.locale = locale - - -class ConsistencyCheckTaskDetails(TaskTypeDetails): - """This class contains monitoring details of all the inconsistent Protected Entities in Vmm. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The type of task details. Required. - :vartype instance_type: str - :ivar vm_details: The list of inconsistent Vm details. - :vartype vm_details: - list[~azure.mgmt.recoveryservicessiterecovery.models.InconsistentVmDetails] - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "vm_details": {"key": "vmDetails", "type": "[InconsistentVmDetails]"}, - } - - def __init__(self, *, vm_details: Optional[List["_models.InconsistentVmDetails"]] = None, **kwargs: Any) -> None: - """ - :keyword vm_details: The list of inconsistent Vm details. - :paramtype vm_details: - list[~azure.mgmt.recoveryservicessiterecovery.models.InconsistentVmDetails] - """ - super().__init__(**kwargs) - self.instance_type: str = "ConsistencyCheckTaskDetails" - self.vm_details = vm_details - - -class CreateNetworkMappingInput(_serialization.Model): - """Create network mappings input. - - All required parameters must be populated in order to send to server. - - :ivar properties: Input properties for creating network mapping. Required. - :vartype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.CreateNetworkMappingInputProperties - """ - - _validation = { - "properties": {"required": True}, - } - - _attribute_map = { - "properties": {"key": "properties", "type": "CreateNetworkMappingInputProperties"}, - } - - def __init__(self, *, properties: "_models.CreateNetworkMappingInputProperties", **kwargs: Any) -> None: - """ - :keyword properties: Input properties for creating network mapping. Required. - :paramtype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.CreateNetworkMappingInputProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class CreateNetworkMappingInputProperties(_serialization.Model): - """Common input details for network mapping operation. - - All required parameters must be populated in order to send to server. - - :ivar recovery_fabric_name: Recovery fabric Name. - :vartype recovery_fabric_name: str - :ivar recovery_network_id: Recovery network Id. Required. - :vartype recovery_network_id: str - :ivar fabric_specific_details: Fabric specific input properties. - :vartype fabric_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.FabricSpecificCreateNetworkMappingInput - """ - - _validation = { - "recovery_network_id": {"required": True}, - } - - _attribute_map = { - "recovery_fabric_name": {"key": "recoveryFabricName", "type": "str"}, - "recovery_network_id": {"key": "recoveryNetworkId", "type": "str"}, - "fabric_specific_details": {"key": "fabricSpecificDetails", "type": "FabricSpecificCreateNetworkMappingInput"}, - } - - def __init__( - self, - *, - recovery_network_id: str, - recovery_fabric_name: Optional[str] = None, - fabric_specific_details: Optional["_models.FabricSpecificCreateNetworkMappingInput"] = None, - **kwargs: Any - ) -> None: - """ - :keyword recovery_fabric_name: Recovery fabric Name. - :paramtype recovery_fabric_name: str - :keyword recovery_network_id: Recovery network Id. Required. - :paramtype recovery_network_id: str - :keyword fabric_specific_details: Fabric specific input properties. - :paramtype fabric_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.FabricSpecificCreateNetworkMappingInput - """ - super().__init__(**kwargs) - self.recovery_fabric_name = recovery_fabric_name - self.recovery_network_id = recovery_network_id - self.fabric_specific_details = fabric_specific_details - - -class CreatePolicyInput(_serialization.Model): - """Protection Policy input. - - :ivar properties: Policy creation properties. - :vartype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.CreatePolicyInputProperties - """ - - _attribute_map = { - "properties": {"key": "properties", "type": "CreatePolicyInputProperties"}, - } - - def __init__(self, *, properties: Optional["_models.CreatePolicyInputProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Policy creation properties. - :paramtype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.CreatePolicyInputProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class CreatePolicyInputProperties(_serialization.Model): - """Policy creation properties. - - :ivar provider_specific_input: The ReplicationProviderSettings. - :vartype provider_specific_input: - ~azure.mgmt.recoveryservicessiterecovery.models.PolicyProviderSpecificInput - """ - - _attribute_map = { - "provider_specific_input": {"key": "providerSpecificInput", "type": "PolicyProviderSpecificInput"}, - } - - def __init__( - self, *, provider_specific_input: Optional["_models.PolicyProviderSpecificInput"] = None, **kwargs: Any - ) -> None: - """ - :keyword provider_specific_input: The ReplicationProviderSettings. - :paramtype provider_specific_input: - ~azure.mgmt.recoveryservicessiterecovery.models.PolicyProviderSpecificInput - """ - super().__init__(**kwargs) - self.provider_specific_input = provider_specific_input - - -class CreateProtectionContainerInput(_serialization.Model): - """Create protection container input. - - :ivar properties: Create protection container input properties. - :vartype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.CreateProtectionContainerInputProperties - """ - - _attribute_map = { - "properties": {"key": "properties", "type": "CreateProtectionContainerInputProperties"}, - } - - def __init__( - self, *, properties: Optional["_models.CreateProtectionContainerInputProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: Create protection container input properties. - :paramtype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.CreateProtectionContainerInputProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class CreateProtectionContainerInputProperties(_serialization.Model): - """Create protection container input properties. - - :ivar provider_specific_input: Provider specific inputs for container creation. - :vartype provider_specific_input: - list[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProviderSpecificContainerCreationInput] - """ - - _attribute_map = { - "provider_specific_input": { - "key": "providerSpecificInput", - "type": "[ReplicationProviderSpecificContainerCreationInput]", - }, - } - - def __init__( - self, - *, - provider_specific_input: Optional[List["_models.ReplicationProviderSpecificContainerCreationInput"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword provider_specific_input: Provider specific inputs for container creation. - :paramtype provider_specific_input: - list[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProviderSpecificContainerCreationInput] - """ - super().__init__(**kwargs) - self.provider_specific_input = provider_specific_input - - -class CreateProtectionContainerMappingInput(_serialization.Model): - """Configure pairing input. - - :ivar properties: Configure protection input properties. - :vartype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.CreateProtectionContainerMappingInputProperties - """ - - _attribute_map = { - "properties": {"key": "properties", "type": "CreateProtectionContainerMappingInputProperties"}, - } - - def __init__( - self, *, properties: Optional["_models.CreateProtectionContainerMappingInputProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: Configure protection input properties. - :paramtype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.CreateProtectionContainerMappingInputProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class CreateProtectionContainerMappingInputProperties(_serialization.Model): # pylint: disable=name-too-long - """Configure pairing input properties. - - :ivar target_protection_container_id: The target unique protection container name. - :vartype target_protection_container_id: str - :ivar policy_id: Applicable policy. - :vartype policy_id: str - :ivar provider_specific_input: Provider specific input for pairing. - :vartype provider_specific_input: - ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProviderSpecificContainerMappingInput - """ - - _attribute_map = { - "target_protection_container_id": {"key": "targetProtectionContainerId", "type": "str"}, - "policy_id": {"key": "policyId", "type": "str"}, - "provider_specific_input": { - "key": "providerSpecificInput", - "type": "ReplicationProviderSpecificContainerMappingInput", - }, - } - - def __init__( - self, - *, - target_protection_container_id: Optional[str] = None, - policy_id: Optional[str] = None, - provider_specific_input: Optional["_models.ReplicationProviderSpecificContainerMappingInput"] = None, - **kwargs: Any - ) -> None: - """ - :keyword target_protection_container_id: The target unique protection container name. - :paramtype target_protection_container_id: str - :keyword policy_id: Applicable policy. - :paramtype policy_id: str - :keyword provider_specific_input: Provider specific input for pairing. - :paramtype provider_specific_input: - ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProviderSpecificContainerMappingInput - """ - super().__init__(**kwargs) - self.target_protection_container_id = target_protection_container_id - self.policy_id = policy_id - self.provider_specific_input = provider_specific_input - - -class CreateProtectionIntentInput(_serialization.Model): - """Create protection intent input. - - :ivar properties: Create protection intent input properties. - :vartype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.CreateProtectionIntentProperties - """ - - _attribute_map = { - "properties": {"key": "properties", "type": "CreateProtectionIntentProperties"}, - } - - def __init__( - self, *, properties: Optional["_models.CreateProtectionIntentProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: Create protection intent input properties. - :paramtype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.CreateProtectionIntentProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class CreateProtectionIntentProperties(_serialization.Model): - """Create protection intent input properties. - - :ivar provider_specific_details: The ReplicationProviderInput. For A2A provider, it will be - A2ACreateProtectionIntentInput object. - :vartype provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.CreateProtectionIntentProviderSpecificDetails - """ - - _attribute_map = { - "provider_specific_details": { - "key": "providerSpecificDetails", - "type": "CreateProtectionIntentProviderSpecificDetails", - }, - } - - def __init__( - self, - *, - provider_specific_details: Optional["_models.CreateProtectionIntentProviderSpecificDetails"] = None, - **kwargs: Any - ) -> None: - """ - :keyword provider_specific_details: The ReplicationProviderInput. For A2A provider, it will be - A2ACreateProtectionIntentInput object. - :paramtype provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.CreateProtectionIntentProviderSpecificDetails - """ - super().__init__(**kwargs) - self.provider_specific_details = provider_specific_details - - -class CreateRecoveryPlanInput(_serialization.Model): - """Create recovery plan input class. - - All required parameters must be populated in order to send to server. - - :ivar properties: Recovery plan creation properties. Required. - :vartype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.CreateRecoveryPlanInputProperties - """ - - _validation = { - "properties": {"required": True}, - } - - _attribute_map = { - "properties": {"key": "properties", "type": "CreateRecoveryPlanInputProperties"}, - } - - def __init__(self, *, properties: "_models.CreateRecoveryPlanInputProperties", **kwargs: Any) -> None: - """ - :keyword properties: Recovery plan creation properties. Required. - :paramtype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.CreateRecoveryPlanInputProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class CreateRecoveryPlanInputProperties(_serialization.Model): - """Recovery plan creation properties. - - All required parameters must be populated in order to send to server. - - :ivar primary_fabric_id: The primary fabric Id. Required. - :vartype primary_fabric_id: str - :ivar recovery_fabric_id: The recovery fabric Id. Required. - :vartype recovery_fabric_id: str - :ivar failover_deployment_model: The failover deployment model. Known values are: - "NotApplicable", "Classic", and "ResourceManager". - :vartype failover_deployment_model: str or - ~azure.mgmt.recoveryservicessiterecovery.models.FailoverDeploymentModel - :ivar groups: The recovery plan groups. Required. - :vartype groups: list[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanGroup] - :ivar provider_specific_input: The provider specific input. - :vartype provider_specific_input: - list[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanProviderSpecificInput] - """ - - _validation = { - "primary_fabric_id": {"required": True}, - "recovery_fabric_id": {"required": True}, - "groups": {"required": True}, - } - - _attribute_map = { - "primary_fabric_id": {"key": "primaryFabricId", "type": "str"}, - "recovery_fabric_id": {"key": "recoveryFabricId", "type": "str"}, - "failover_deployment_model": {"key": "failoverDeploymentModel", "type": "str"}, - "groups": {"key": "groups", "type": "[RecoveryPlanGroup]"}, - "provider_specific_input": {"key": "providerSpecificInput", "type": "[RecoveryPlanProviderSpecificInput]"}, - } - - def __init__( - self, - *, - primary_fabric_id: str, - recovery_fabric_id: str, - groups: List["_models.RecoveryPlanGroup"], - failover_deployment_model: Optional[Union[str, "_models.FailoverDeploymentModel"]] = None, - provider_specific_input: Optional[List["_models.RecoveryPlanProviderSpecificInput"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword primary_fabric_id: The primary fabric Id. Required. - :paramtype primary_fabric_id: str - :keyword recovery_fabric_id: The recovery fabric Id. Required. - :paramtype recovery_fabric_id: str - :keyword failover_deployment_model: The failover deployment model. Known values are: - "NotApplicable", "Classic", and "ResourceManager". - :paramtype failover_deployment_model: str or - ~azure.mgmt.recoveryservicessiterecovery.models.FailoverDeploymentModel - :keyword groups: The recovery plan groups. Required. - :paramtype groups: list[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanGroup] - :keyword provider_specific_input: The provider specific input. - :paramtype provider_specific_input: - list[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanProviderSpecificInput] - """ - super().__init__(**kwargs) - self.primary_fabric_id = primary_fabric_id - self.recovery_fabric_id = recovery_fabric_id - self.failover_deployment_model = failover_deployment_model - self.groups = groups - self.provider_specific_input = provider_specific_input - - -class CriticalJobHistoryDetails(_serialization.Model): - """Critical past job details of the migration item. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar job_name: The job name. - :vartype job_name: str - :ivar job_id: The ARM Id of the job being executed. - :vartype job_id: str - :ivar start_time: The start time of the job. - :vartype start_time: ~datetime.datetime - :ivar job_status: The job state. - :vartype job_status: str - """ - - _validation = { - "job_name": {"readonly": True}, - "job_id": {"readonly": True}, - "start_time": {"readonly": True}, - "job_status": {"readonly": True}, - } - - _attribute_map = { - "job_name": {"key": "jobName", "type": "str"}, - "job_id": {"key": "jobId", "type": "str"}, - "start_time": {"key": "startTime", "type": "iso-8601"}, - "job_status": {"key": "jobStatus", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.job_name: Optional[str] = None - self.job_id: Optional[str] = None - self.start_time: Optional[datetime.datetime] = None - self.job_status: Optional[str] = None - - -class CurrentJobDetails(_serialization.Model): - """Current job details of the migration item. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar job_name: The job name. - :vartype job_name: str - :ivar job_id: The ARM Id of the job being executed. - :vartype job_id: str - :ivar start_time: The start time of the job. - :vartype start_time: ~datetime.datetime - """ - - _validation = { - "job_name": {"readonly": True}, - "job_id": {"readonly": True}, - "start_time": {"readonly": True}, - } - - _attribute_map = { - "job_name": {"key": "jobName", "type": "str"}, - "job_id": {"key": "jobId", "type": "str"}, - "start_time": {"key": "startTime", "type": "iso-8601"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.job_name: Optional[str] = None - self.job_id: Optional[str] = None - self.start_time: Optional[datetime.datetime] = None - - -class CurrentScenarioDetails(_serialization.Model): - """Current scenario details of the protected entity. - - :ivar scenario_name: Scenario name. - :vartype scenario_name: str - :ivar job_id: ARM Id of the job being executed. - :vartype job_id: str - :ivar start_time: Start time of the workflow. - :vartype start_time: ~datetime.datetime - """ - - _attribute_map = { - "scenario_name": {"key": "scenarioName", "type": "str"}, - "job_id": {"key": "jobId", "type": "str"}, - "start_time": {"key": "startTime", "type": "iso-8601"}, - } - - def __init__( - self, - *, - scenario_name: Optional[str] = None, - job_id: Optional[str] = None, - start_time: Optional[datetime.datetime] = None, - **kwargs: Any - ) -> None: - """ - :keyword scenario_name: Scenario name. - :paramtype scenario_name: str - :keyword job_id: ARM Id of the job being executed. - :paramtype job_id: str - :keyword start_time: Start time of the workflow. - :paramtype start_time: ~datetime.datetime - """ - super().__init__(**kwargs) - self.scenario_name = scenario_name - self.job_id = job_id - self.start_time = start_time - - -class DataStore(_serialization.Model): - """The datastore details of the MT. - - :ivar symbolic_name: The symbolic name of data store. - :vartype symbolic_name: str - :ivar uuid: The uuid of data store. - :vartype uuid: str - :ivar capacity: The capacity of data store in GBs. - :vartype capacity: str - :ivar free_space: The free space of data store in GBs. - :vartype free_space: str - :ivar type: The type of data store. - :vartype type: str - """ - - _attribute_map = { - "symbolic_name": {"key": "symbolicName", "type": "str"}, - "uuid": {"key": "uuid", "type": "str"}, - "capacity": {"key": "capacity", "type": "str"}, - "free_space": {"key": "freeSpace", "type": "str"}, - "type": {"key": "type", "type": "str"}, - } - - def __init__( - self, - *, - symbolic_name: Optional[str] = None, - uuid: Optional[str] = None, - capacity: Optional[str] = None, - free_space: Optional[str] = None, - type: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword symbolic_name: The symbolic name of data store. - :paramtype symbolic_name: str - :keyword uuid: The uuid of data store. - :paramtype uuid: str - :keyword capacity: The capacity of data store in GBs. - :paramtype capacity: str - :keyword free_space: The free space of data store in GBs. - :paramtype free_space: str - :keyword type: The type of data store. - :paramtype type: str - """ - super().__init__(**kwargs) - self.symbolic_name = symbolic_name - self.uuid = uuid - self.capacity = capacity - self.free_space = free_space - self.type = type - - -class DataStoreUtilizationDetails(_serialization.Model): - """Details of the appliance resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar total_snapshots_supported: The total count of snapshots supported by the datastore. - :vartype total_snapshots_supported: int - :ivar total_snapshots_created: The total snapshots created for server migration in the - datastore. - :vartype total_snapshots_created: int - :ivar data_store_name: The datastore name. - :vartype data_store_name: str - """ - - _validation = { - "total_snapshots_supported": {"readonly": True}, - "total_snapshots_created": {"readonly": True}, - "data_store_name": {"readonly": True}, - } - - _attribute_map = { - "total_snapshots_supported": {"key": "totalSnapshotsSupported", "type": "int"}, - "total_snapshots_created": {"key": "totalSnapshotsCreated", "type": "int"}, - "data_store_name": {"key": "dataStoreName", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.total_snapshots_supported: Optional[int] = None - self.total_snapshots_created: Optional[int] = None - self.data_store_name: Optional[str] = None - - -class DisableProtectionInput(_serialization.Model): - """Disable protection input. - - All required parameters must be populated in order to send to server. - - :ivar properties: Disable protection input properties. Required. - :vartype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.DisableProtectionInputProperties - """ - - _validation = { - "properties": {"required": True}, - } - - _attribute_map = { - "properties": {"key": "properties", "type": "DisableProtectionInputProperties"}, - } - - def __init__(self, *, properties: "_models.DisableProtectionInputProperties", **kwargs: Any) -> None: - """ - :keyword properties: Disable protection input properties. Required. - :paramtype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.DisableProtectionInputProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class DisableProtectionInputProperties(_serialization.Model): - """Disable protection input properties. - - :ivar disable_protection_reason: Disable protection reason. It can have values - NotSpecified/MigrationComplete. Known values are: "NotSpecified" and "MigrationComplete". - :vartype disable_protection_reason: str or - ~azure.mgmt.recoveryservicessiterecovery.models.DisableProtectionReason - :ivar replication_provider_input: Replication provider specific input. - :vartype replication_provider_input: - ~azure.mgmt.recoveryservicessiterecovery.models.DisableProtectionProviderSpecificInput - """ - - _attribute_map = { - "disable_protection_reason": {"key": "disableProtectionReason", "type": "str"}, - "replication_provider_input": { - "key": "replicationProviderInput", - "type": "DisableProtectionProviderSpecificInput", - }, - } - - def __init__( - self, - *, - disable_protection_reason: Optional[Union[str, "_models.DisableProtectionReason"]] = None, - replication_provider_input: Optional["_models.DisableProtectionProviderSpecificInput"] = None, - **kwargs: Any - ) -> None: - """ - :keyword disable_protection_reason: Disable protection reason. It can have values - NotSpecified/MigrationComplete. Known values are: "NotSpecified" and "MigrationComplete". - :paramtype disable_protection_reason: str or - ~azure.mgmt.recoveryservicessiterecovery.models.DisableProtectionReason - :keyword replication_provider_input: Replication provider specific input. - :paramtype replication_provider_input: - ~azure.mgmt.recoveryservicessiterecovery.models.DisableProtectionProviderSpecificInput - """ - super().__init__(**kwargs) - self.disable_protection_reason = disable_protection_reason - self.replication_provider_input = replication_provider_input - - -class DisableProtectionProviderSpecificInput(_serialization.Model): - """Disable protection provider specific input. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - InMageDisableProtectionProviderSpecificInput - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - } - - _subtype_map = {"instance_type": {"InMage": "InMageDisableProtectionProviderSpecificInput"}} - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.instance_type: Optional[str] = None - - -class DiscoverProtectableItemRequest(_serialization.Model): - """Request to add a physical machine as a protectable item in a container. - - :ivar properties: The properties of a discover protectable item request. - :vartype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.DiscoverProtectableItemRequestProperties - """ - - _attribute_map = { - "properties": {"key": "properties", "type": "DiscoverProtectableItemRequestProperties"}, - } - - def __init__( - self, *, properties: Optional["_models.DiscoverProtectableItemRequestProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: The properties of a discover protectable item request. - :paramtype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.DiscoverProtectableItemRequestProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class DiscoverProtectableItemRequestProperties(_serialization.Model): - """Discover protectable item properties. - - :ivar friendly_name: The friendly name of the physical machine. - :vartype friendly_name: str - :ivar ip_address: The IP address of the physical machine to be discovered. - :vartype ip_address: str - :ivar os_type: The OS type on the physical machine. - :vartype os_type: str - """ - - _attribute_map = { - "friendly_name": {"key": "friendlyName", "type": "str"}, - "ip_address": {"key": "ipAddress", "type": "str"}, - "os_type": {"key": "osType", "type": "str"}, - } - - def __init__( - self, - *, - friendly_name: Optional[str] = None, - ip_address: Optional[str] = None, - os_type: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword friendly_name: The friendly name of the physical machine. - :paramtype friendly_name: str - :keyword ip_address: The IP address of the physical machine to be discovered. - :paramtype ip_address: str - :keyword os_type: The OS type on the physical machine. - :paramtype os_type: str - """ - super().__init__(**kwargs) - self.friendly_name = friendly_name - self.ip_address = ip_address - self.os_type = os_type - - -class DiskDetails(_serialization.Model): - """Onprem disk details data. - - :ivar max_size_mb: The hard disk max size in MB. - :vartype max_size_mb: int - :ivar vhd_type: The type of the volume. - :vartype vhd_type: str - :ivar vhd_id: The VHD Id. - :vartype vhd_id: str - :ivar vhd_name: The VHD name. - :vartype vhd_name: str - """ - - _attribute_map = { - "max_size_mb": {"key": "maxSizeMB", "type": "int"}, - "vhd_type": {"key": "vhdType", "type": "str"}, - "vhd_id": {"key": "vhdId", "type": "str"}, - "vhd_name": {"key": "vhdName", "type": "str"}, - } - - def __init__( - self, - *, - max_size_mb: Optional[int] = None, - vhd_type: Optional[str] = None, - vhd_id: Optional[str] = None, - vhd_name: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword max_size_mb: The hard disk max size in MB. - :paramtype max_size_mb: int - :keyword vhd_type: The type of the volume. - :paramtype vhd_type: str - :keyword vhd_id: The VHD Id. - :paramtype vhd_id: str - :keyword vhd_name: The VHD name. - :paramtype vhd_name: str - """ - super().__init__(**kwargs) - self.max_size_mb = max_size_mb - self.vhd_type = vhd_type - self.vhd_id = vhd_id - self.vhd_name = vhd_name - - -class DiskEncryptionInfo(_serialization.Model): - """Recovery disk encryption info (BEK and KEK). - - :ivar disk_encryption_key_info: The recovery KeyVault reference for secret. - :vartype disk_encryption_key_info: - ~azure.mgmt.recoveryservicessiterecovery.models.DiskEncryptionKeyInfo - :ivar key_encryption_key_info: The recovery KeyVault reference for key. - :vartype key_encryption_key_info: - ~azure.mgmt.recoveryservicessiterecovery.models.KeyEncryptionKeyInfo - """ - - _attribute_map = { - "disk_encryption_key_info": {"key": "diskEncryptionKeyInfo", "type": "DiskEncryptionKeyInfo"}, - "key_encryption_key_info": {"key": "keyEncryptionKeyInfo", "type": "KeyEncryptionKeyInfo"}, - } - - def __init__( - self, - *, - disk_encryption_key_info: Optional["_models.DiskEncryptionKeyInfo"] = None, - key_encryption_key_info: Optional["_models.KeyEncryptionKeyInfo"] = None, - **kwargs: Any - ) -> None: - """ - :keyword disk_encryption_key_info: The recovery KeyVault reference for secret. - :paramtype disk_encryption_key_info: - ~azure.mgmt.recoveryservicessiterecovery.models.DiskEncryptionKeyInfo - :keyword key_encryption_key_info: The recovery KeyVault reference for key. - :paramtype key_encryption_key_info: - ~azure.mgmt.recoveryservicessiterecovery.models.KeyEncryptionKeyInfo - """ - super().__init__(**kwargs) - self.disk_encryption_key_info = disk_encryption_key_info - self.key_encryption_key_info = key_encryption_key_info - - -class DiskEncryptionKeyInfo(_serialization.Model): - """Disk Encryption Key Information (BitLocker Encryption Key (BEK) on Windows). - - :ivar secret_identifier: The secret url / identifier. - :vartype secret_identifier: str - :ivar key_vault_resource_arm_id: The KeyVault resource ARM id for secret. - :vartype key_vault_resource_arm_id: str - """ - - _attribute_map = { - "secret_identifier": {"key": "secretIdentifier", "type": "str"}, - "key_vault_resource_arm_id": {"key": "keyVaultResourceArmId", "type": "str"}, - } - - def __init__( - self, *, secret_identifier: Optional[str] = None, key_vault_resource_arm_id: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword secret_identifier: The secret url / identifier. - :paramtype secret_identifier: str - :keyword key_vault_resource_arm_id: The KeyVault resource ARM id for secret. - :paramtype key_vault_resource_arm_id: str - """ - super().__init__(**kwargs) - self.secret_identifier = secret_identifier - self.key_vault_resource_arm_id = key_vault_resource_arm_id - - -class DiskVolumeDetails(_serialization.Model): - """Volume details. - - :ivar label: The volume label. - :vartype label: str - :ivar name: The volume name. - :vartype name: str - """ - - _attribute_map = { - "label": {"key": "label", "type": "str"}, - "name": {"key": "name", "type": "str"}, - } - - def __init__(self, *, label: Optional[str] = None, name: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword label: The volume label. - :paramtype label: str - :keyword name: The volume name. - :paramtype name: str - """ - super().__init__(**kwargs) - self.label = label - self.name = name - - -class Display(_serialization.Model): - """Contains the localized display information for this particular operation / action. These value - will be used by several clients for (1) custom role definitions for RBAC; (2) complex query - filters for the event service; and (3) audit history / records for management operations. - - :ivar provider: The provider. The localized friendly form of the resource provider name - it is - expected to also include the publisher/company responsible. It should use Title Casing and - begin with "Microsoft" for 1st party services. e.g. "Microsoft Monitoring Insights" or - "Microsoft Compute.". - :vartype provider: str - :ivar resource: The resource. The localized friendly form of the resource related to this - action/operation - it should match the public documentation for the resource provider. It - should use Title Casing. This value should be unique for a particular URL type (e.g. nested - types should *not* reuse their parent's display.resource field). e.g. "Virtual Machines" or - "Scheduler Job Collections", or "Virtual Machine VM Sizes" or "Scheduler Jobs". - :vartype resource: str - :ivar operation: The operation. The localized friendly name for the operation, as it should be - shown to the user. It should be concise (to fit in drop downs) but clear (i.e. - self-documenting). It should use Title Casing. Prescriptive guidance: Read Create or Update - Delete 'ActionName'. - :vartype operation: str - :ivar description: The description. The localized friendly description for the operation, as it - should be shown to the user. It should be thorough, yet concise - it will be used in tool tips - and detailed views. Prescriptive guidance for namespaces: Read any 'display.provider' resource - Create or Update any 'display.provider' resource Delete any 'display.provider' resource Perform - any other action on any 'display.provider' resource Prescriptive guidance for namespaces: Read - any 'display.resource' Create or Update any 'display.resource' Delete any 'display.resource' - 'ActionName' any 'display.resources'. - :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: The provider. The localized friendly form of the resource provider name - it - is expected to also include the publisher/company responsible. It should use Title Casing and - begin with "Microsoft" for 1st party services. e.g. "Microsoft Monitoring Insights" or - "Microsoft Compute.". - :paramtype provider: str - :keyword resource: The resource. The localized friendly form of the resource related to this - action/operation - it should match the public documentation for the resource provider. It - should use Title Casing. This value should be unique for a particular URL type (e.g. nested - types should *not* reuse their parent's display.resource field). e.g. "Virtual Machines" or - "Scheduler Job Collections", or "Virtual Machine VM Sizes" or "Scheduler Jobs". - :paramtype resource: str - :keyword operation: The operation. The localized friendly name for the operation, as it should - be shown to the user. It should be concise (to fit in drop downs) but clear (i.e. - self-documenting). It should use Title Casing. Prescriptive guidance: Read Create or Update - Delete 'ActionName'. - :paramtype operation: str - :keyword description: The description. The localized friendly description for the operation, as - it should be shown to the user. It should be thorough, yet concise - it will be used in tool - tips and detailed views. Prescriptive guidance for namespaces: Read any 'display.provider' - resource Create or Update any 'display.provider' resource Delete any 'display.provider' - resource Perform any other action on any 'display.provider' resource Prescriptive guidance for - namespaces: Read any 'display.resource' Create or Update any 'display.resource' Delete any - 'display.resource' 'ActionName' any 'display.resources'. - :paramtype description: str - """ - super().__init__(**kwargs) - self.provider = provider - self.resource = resource - self.operation = operation - self.description = description - - -class DraDetails(_serialization.Model): - """DRA details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The DRA Id. - :vartype id: str - :ivar name: The DRA name. - :vartype name: str - :ivar bios_id: The DRA Bios Id. - :vartype bios_id: str - :ivar version: The version. - :vartype version: str - :ivar last_heartbeat_utc: The last heartbeat received from the DRA. - :vartype last_heartbeat_utc: ~datetime.datetime - :ivar health: The health. Known values are: "None", "Normal", "Warning", and "Critical". - :vartype health: str or ~azure.mgmt.recoveryservicessiterecovery.models.ProtectionHealth - :ivar health_errors: The health errors. - :vartype health_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] - :ivar forward_protected_item_count: The count of protected items which are protected in forward - direction. - :vartype forward_protected_item_count: int - :ivar reverse_protected_item_count: The count of protected items which are protected in reverse - direction. - :vartype reverse_protected_item_count: int - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "bios_id": {"readonly": True}, - "version": {"readonly": True}, - "last_heartbeat_utc": {"readonly": True}, - "health": {"readonly": True}, - "health_errors": {"readonly": True}, - "forward_protected_item_count": {"readonly": True}, - "reverse_protected_item_count": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "bios_id": {"key": "biosId", "type": "str"}, - "version": {"key": "version", "type": "str"}, - "last_heartbeat_utc": {"key": "lastHeartbeatUtc", "type": "iso-8601"}, - "health": {"key": "health", "type": "str"}, - "health_errors": {"key": "healthErrors", "type": "[HealthError]"}, - "forward_protected_item_count": {"key": "forwardProtectedItemCount", "type": "int"}, - "reverse_protected_item_count": {"key": "reverseProtectedItemCount", "type": "int"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.id: Optional[str] = None - self.name: Optional[str] = None - self.bios_id: Optional[str] = None - self.version: Optional[str] = None - self.last_heartbeat_utc: Optional[datetime.datetime] = None - self.health: Optional[Union[str, "_models.ProtectionHealth"]] = None - self.health_errors: Optional[List["_models.HealthError"]] = None - self.forward_protected_item_count: Optional[int] = None - self.reverse_protected_item_count: Optional[int] = None - - -class EnableMigrationInput(_serialization.Model): - """Enable migration input. - - All required parameters must be populated in order to send to server. - - :ivar properties: Enable migration input properties. Required. - :vartype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.EnableMigrationInputProperties - """ - - _validation = { - "properties": {"required": True}, - } - - _attribute_map = { - "properties": {"key": "properties", "type": "EnableMigrationInputProperties"}, - } - - def __init__(self, *, properties: "_models.EnableMigrationInputProperties", **kwargs: Any) -> None: - """ - :keyword properties: Enable migration input properties. Required. - :paramtype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.EnableMigrationInputProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class EnableMigrationInputProperties(_serialization.Model): - """Enable migration input properties. - - All required parameters must be populated in order to send to server. - - :ivar policy_id: The policy Id. Required. - :vartype policy_id: str - :ivar provider_specific_details: The provider specific details. Required. - :vartype provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.EnableMigrationProviderSpecificInput - """ - - _validation = { - "policy_id": {"required": True}, - "provider_specific_details": {"required": True}, - } - - _attribute_map = { - "policy_id": {"key": "policyId", "type": "str"}, - "provider_specific_details": {"key": "providerSpecificDetails", "type": "EnableMigrationProviderSpecificInput"}, - } - - def __init__( - self, - *, - policy_id: str, - provider_specific_details: "_models.EnableMigrationProviderSpecificInput", - **kwargs: Any - ) -> None: - """ - :keyword policy_id: The policy Id. Required. - :paramtype policy_id: str - :keyword provider_specific_details: The provider specific details. Required. - :paramtype provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.EnableMigrationProviderSpecificInput - """ - super().__init__(**kwargs) - self.policy_id = policy_id - self.provider_specific_details = provider_specific_details - - -class EnableMigrationProviderSpecificInput(_serialization.Model): - """Enable migration provider specific input. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - VMwareCbtEnableMigrationInput - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - } - - _subtype_map = {"instance_type": {"VMwareCbt": "VMwareCbtEnableMigrationInput"}} - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.instance_type: Optional[str] = None - - -class EnableProtectionInput(_serialization.Model): - """Enable protection input. - - :ivar properties: Enable protection input properties. - :vartype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.EnableProtectionInputProperties - """ - - _attribute_map = { - "properties": {"key": "properties", "type": "EnableProtectionInputProperties"}, - } - - def __init__( - self, *, properties: Optional["_models.EnableProtectionInputProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: Enable protection input properties. - :paramtype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.EnableProtectionInputProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class EnableProtectionInputProperties(_serialization.Model): - """Enable protection input properties. - - :ivar policy_id: The Policy Id. - :vartype policy_id: str - :ivar protectable_item_id: The protectable item Id. - :vartype protectable_item_id: str - :ivar provider_specific_details: The ReplicationProviderInput. For HyperVReplicaAzure provider, - it will be AzureEnableProtectionInput object. For San provider, it will be - SanEnableProtectionInput object. For HyperVReplicaAzure provider, it can be null. - :vartype provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.EnableProtectionProviderSpecificInput - """ - - _attribute_map = { - "policy_id": {"key": "policyId", "type": "str"}, - "protectable_item_id": {"key": "protectableItemId", "type": "str"}, - "provider_specific_details": { - "key": "providerSpecificDetails", - "type": "EnableProtectionProviderSpecificInput", - }, - } - - def __init__( - self, - *, - policy_id: Optional[str] = None, - protectable_item_id: Optional[str] = None, - provider_specific_details: Optional["_models.EnableProtectionProviderSpecificInput"] = None, - **kwargs: Any - ) -> None: - """ - :keyword policy_id: The Policy Id. - :paramtype policy_id: str - :keyword protectable_item_id: The protectable item Id. - :paramtype protectable_item_id: str - :keyword provider_specific_details: The ReplicationProviderInput. For HyperVReplicaAzure - provider, it will be AzureEnableProtectionInput object. For San provider, it will be - SanEnableProtectionInput object. For HyperVReplicaAzure provider, it can be null. - :paramtype provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.EnableProtectionProviderSpecificInput - """ - super().__init__(**kwargs) - self.policy_id = policy_id - self.protectable_item_id = protectable_item_id - self.provider_specific_details = provider_specific_details - - -class EncryptionDetails(_serialization.Model): - """Encryption details for the fabric. - - :ivar kek_state: The key encryption key state for the Vmm. - :vartype kek_state: str - :ivar kek_cert_thumbprint: The key encryption key certificate thumbprint. - :vartype kek_cert_thumbprint: str - :ivar kek_cert_expiry_date: The key encryption key certificate expiry date. - :vartype kek_cert_expiry_date: ~datetime.datetime - """ - - _attribute_map = { - "kek_state": {"key": "kekState", "type": "str"}, - "kek_cert_thumbprint": {"key": "kekCertThumbprint", "type": "str"}, - "kek_cert_expiry_date": {"key": "kekCertExpiryDate", "type": "iso-8601"}, - } - - def __init__( - self, - *, - kek_state: Optional[str] = None, - kek_cert_thumbprint: Optional[str] = None, - kek_cert_expiry_date: Optional[datetime.datetime] = None, - **kwargs: Any - ) -> None: - """ - :keyword kek_state: The key encryption key state for the Vmm. - :paramtype kek_state: str - :keyword kek_cert_thumbprint: The key encryption key certificate thumbprint. - :paramtype kek_cert_thumbprint: str - :keyword kek_cert_expiry_date: The key encryption key certificate expiry date. - :paramtype kek_cert_expiry_date: ~datetime.datetime - """ - super().__init__(**kwargs) - self.kek_state = kek_state - self.kek_cert_thumbprint = kek_cert_thumbprint - self.kek_cert_expiry_date = kek_cert_expiry_date - - -class ErrorAdditionalInfo(_serialization.Model): - """The resource management error additional info. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: The additional info type. - :vartype type: str - :ivar info: The additional info. - :vartype info: JSON - """ - - _validation = { - "type": {"readonly": True}, - "info": {"readonly": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "info": {"key": "info", "type": "object"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.type: Optional[str] = None - self.info: Optional[JSON] = None - - -class ErrorDetail(_serialization.Model): - """The error detail. - - Variables are only populated by the server, and will be ignored when sending a request. - - :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.recoveryservicessiterecovery.models.ErrorDetail] - :ivar additional_info: The error additional info. - :vartype additional_info: - list[~azure.mgmt.recoveryservicessiterecovery.models.ErrorAdditionalInfo] - """ - - _validation = { - "code": {"readonly": True}, - "message": {"readonly": True}, - "target": {"readonly": True}, - "details": {"readonly": True}, - "additional_info": {"readonly": True}, - } - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - "target": {"key": "target", "type": "str"}, - "details": {"key": "details", "type": "[ErrorDetail]"}, - "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.code: Optional[str] = None - self.message: Optional[str] = None - self.target: Optional[str] = None - self.details: Optional[List["_models.ErrorDetail"]] = None - self.additional_info: Optional[List["_models.ErrorAdditionalInfo"]] = None - - -class ErrorResponse(_serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed - operations. (This also follows the OData error response format.). - - :ivar error: The error object. - :vartype error: ~azure.mgmt.recoveryservicessiterecovery.models.ErrorDetail - """ - - _attribute_map = { - "error": {"key": "error", "type": "ErrorDetail"}, - } - - def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: Any) -> None: - """ - :keyword error: The error object. - :paramtype error: ~azure.mgmt.recoveryservicessiterecovery.models.ErrorDetail - """ - super().__init__(**kwargs) - self.error = error - - -class Event(Resource): - """Implements the Event class. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :ivar type: Resource Type. - :vartype type: str - :ivar location: Resource Location. - :vartype location: str - :ivar properties: Event related data. - :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.EventProperties - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "properties": {"key": "properties", "type": "EventProperties"}, - } - - def __init__( - self, *, location: Optional[str] = None, properties: Optional["_models.EventProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword location: Resource Location. - :paramtype location: str - :keyword properties: Event related data. - :paramtype properties: ~azure.mgmt.recoveryservicessiterecovery.models.EventProperties - """ - super().__init__(location=location, **kwargs) - self.properties = properties - - -class EventCollection(_serialization.Model): - """Collection of fabric details. - - :ivar value: The list of events. - :vartype value: list[~azure.mgmt.recoveryservicessiterecovery.models.Event] - :ivar next_link: The value of next link. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[Event]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.Event"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The list of events. - :paramtype value: list[~azure.mgmt.recoveryservicessiterecovery.models.Event] - :keyword next_link: The value of next link. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class EventProperties(_serialization.Model): - """The properties of a monitoring event. - - :ivar event_code: The Id of the monitoring event. - :vartype event_code: str - :ivar description: The event name. - :vartype description: str - :ivar event_type: The type of the event. for example: VM Health, Server Health, Job Failure - etc. - :vartype event_type: str - :ivar affected_object_friendly_name: The friendly name of the source of the event on which it - is raised (for example, VM, VMM etc). - :vartype affected_object_friendly_name: str - :ivar affected_object_correlation_id: The affected object correlationId for the event. - :vartype affected_object_correlation_id: str - :ivar severity: The severity of the event. - :vartype severity: str - :ivar time_of_occurrence: The time of occurrence of the event. - :vartype time_of_occurrence: ~datetime.datetime - :ivar fabric_id: The ARM ID of the fabric. - :vartype fabric_id: str - :ivar provider_specific_details: The provider specific settings. - :vartype provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.EventProviderSpecificDetails - :ivar event_specific_details: The event specific settings. - :vartype event_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.EventSpecificDetails - :ivar health_errors: The list of errors / warnings capturing details associated with the - issue(s). - :vartype health_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] - """ - - _attribute_map = { - "event_code": {"key": "eventCode", "type": "str"}, - "description": {"key": "description", "type": "str"}, - "event_type": {"key": "eventType", "type": "str"}, - "affected_object_friendly_name": {"key": "affectedObjectFriendlyName", "type": "str"}, - "affected_object_correlation_id": {"key": "affectedObjectCorrelationId", "type": "str"}, - "severity": {"key": "severity", "type": "str"}, - "time_of_occurrence": {"key": "timeOfOccurrence", "type": "iso-8601"}, - "fabric_id": {"key": "fabricId", "type": "str"}, - "provider_specific_details": {"key": "providerSpecificDetails", "type": "EventProviderSpecificDetails"}, - "event_specific_details": {"key": "eventSpecificDetails", "type": "EventSpecificDetails"}, - "health_errors": {"key": "healthErrors", "type": "[HealthError]"}, - } - - def __init__( - self, - *, - event_code: Optional[str] = None, - description: Optional[str] = None, - event_type: Optional[str] = None, - affected_object_friendly_name: Optional[str] = None, - affected_object_correlation_id: Optional[str] = None, - severity: Optional[str] = None, - time_of_occurrence: Optional[datetime.datetime] = None, - fabric_id: Optional[str] = None, - provider_specific_details: Optional["_models.EventProviderSpecificDetails"] = None, - event_specific_details: Optional["_models.EventSpecificDetails"] = None, - health_errors: Optional[List["_models.HealthError"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword event_code: The Id of the monitoring event. - :paramtype event_code: str - :keyword description: The event name. - :paramtype description: str - :keyword event_type: The type of the event. for example: VM Health, Server Health, Job Failure - etc. - :paramtype event_type: str - :keyword affected_object_friendly_name: The friendly name of the source of the event on which - it is raised (for example, VM, VMM etc). - :paramtype affected_object_friendly_name: str - :keyword affected_object_correlation_id: The affected object correlationId for the event. - :paramtype affected_object_correlation_id: str - :keyword severity: The severity of the event. - :paramtype severity: str - :keyword time_of_occurrence: The time of occurrence of the event. - :paramtype time_of_occurrence: ~datetime.datetime - :keyword fabric_id: The ARM ID of the fabric. - :paramtype fabric_id: str - :keyword provider_specific_details: The provider specific settings. - :paramtype provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.EventProviderSpecificDetails - :keyword event_specific_details: The event specific settings. - :paramtype event_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.EventSpecificDetails - :keyword health_errors: The list of errors / warnings capturing details associated with the - issue(s). - :paramtype health_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] - """ - super().__init__(**kwargs) - self.event_code = event_code - self.description = description - self.event_type = event_type - self.affected_object_friendly_name = affected_object_friendly_name - self.affected_object_correlation_id = affected_object_correlation_id - self.severity = severity - self.time_of_occurrence = time_of_occurrence - self.fabric_id = fabric_id - self.provider_specific_details = provider_specific_details - self.event_specific_details = event_specific_details - self.health_errors = health_errors - - -class EventQueryParameter(_serialization.Model): - """Implements the event query parameter. - - :ivar event_code: The source id of the events to be queried. - :vartype event_code: str - :ivar severity: The severity of the events to be queried. - :vartype severity: str - :ivar event_type: The type of the events to be queried. - :vartype event_type: str - :ivar fabric_name: The affected object server id of the events to be queried. - :vartype fabric_name: str - :ivar affected_object_friendly_name: The affected object name of the events to be queried. - :vartype affected_object_friendly_name: str - :ivar affected_object_correlation_id: The affected object correlationId for the events to be - queried. - :vartype affected_object_correlation_id: str - :ivar start_time: The start time of the time range within which the events are to be queried. - :vartype start_time: ~datetime.datetime - :ivar end_time: The end time of the time range within which the events are to be queried. - :vartype end_time: ~datetime.datetime - """ - - _attribute_map = { - "event_code": {"key": "eventCode", "type": "str"}, - "severity": {"key": "severity", "type": "str"}, - "event_type": {"key": "eventType", "type": "str"}, - "fabric_name": {"key": "fabricName", "type": "str"}, - "affected_object_friendly_name": {"key": "affectedObjectFriendlyName", "type": "str"}, - "affected_object_correlation_id": {"key": "affectedObjectCorrelationId", "type": "str"}, - "start_time": {"key": "startTime", "type": "iso-8601"}, - "end_time": {"key": "endTime", "type": "iso-8601"}, - } - - def __init__( - self, - *, - event_code: Optional[str] = None, - severity: Optional[str] = None, - event_type: Optional[str] = None, - fabric_name: Optional[str] = None, - affected_object_friendly_name: Optional[str] = None, - affected_object_correlation_id: Optional[str] = None, - start_time: Optional[datetime.datetime] = None, - end_time: Optional[datetime.datetime] = None, - **kwargs: Any - ) -> None: - """ - :keyword event_code: The source id of the events to be queried. - :paramtype event_code: str - :keyword severity: The severity of the events to be queried. - :paramtype severity: str - :keyword event_type: The type of the events to be queried. - :paramtype event_type: str - :keyword fabric_name: The affected object server id of the events to be queried. - :paramtype fabric_name: str - :keyword affected_object_friendly_name: The affected object name of the events to be queried. - :paramtype affected_object_friendly_name: str - :keyword affected_object_correlation_id: The affected object correlationId for the events to be - queried. - :paramtype affected_object_correlation_id: str - :keyword start_time: The start time of the time range within which the events are to be - queried. - :paramtype start_time: ~datetime.datetime - :keyword end_time: The end time of the time range within which the events are to be queried. - :paramtype end_time: ~datetime.datetime - """ - super().__init__(**kwargs) - self.event_code = event_code - self.severity = severity - self.event_type = event_type - self.fabric_name = fabric_name - self.affected_object_friendly_name = affected_object_friendly_name - self.affected_object_correlation_id = affected_object_correlation_id - self.start_time = start_time - self.end_time = end_time - - -class EventSpecificDetails(_serialization.Model): - """Model class for event specific details for an event. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - JobStatusEventDetails - - All required parameters must be populated in order to send to server. - - :ivar instance_type: Gets the class type. Overridden in derived classes. Required. - :vartype instance_type: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - } - - _subtype_map = {"instance_type": {"JobStatus": "JobStatusEventDetails"}} - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.instance_type: Optional[str] = None - - -class ProtectionProfileCustomDetails(_serialization.Model): - """Protection Profile custom input. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - ExistingProtectionProfile, NewProtectionProfile - - All required parameters must be populated in order to send to server. - - :ivar resource_type: The class type. Required. - :vartype resource_type: str - """ - - _validation = { - "resource_type": {"required": True}, - } - - _attribute_map = { - "resource_type": {"key": "resourceType", "type": "str"}, - } - - _subtype_map = {"resource_type": {"Existing": "ExistingProtectionProfile", "New": "NewProtectionProfile"}} - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.resource_type: Optional[str] = None - - -class ExistingProtectionProfile(ProtectionProfileCustomDetails): - """Existing storage account input. - - All required parameters must be populated in order to send to server. - - :ivar resource_type: The class type. Required. - :vartype resource_type: str - :ivar protection_profile_id: The protection profile Arm Id. Throw error, if resource does not - exists. Required. - :vartype protection_profile_id: str - """ - - _validation = { - "resource_type": {"required": True}, - "protection_profile_id": {"required": True}, - } - - _attribute_map = { - "resource_type": {"key": "resourceType", "type": "str"}, - "protection_profile_id": {"key": "protectionProfileId", "type": "str"}, - } - - def __init__(self, *, protection_profile_id: str, **kwargs: Any) -> None: - """ - :keyword protection_profile_id: The protection profile Arm Id. Throw error, if resource does - not exists. Required. - :paramtype protection_profile_id: str - """ - super().__init__(**kwargs) - self.resource_type: str = "Existing" - self.protection_profile_id = protection_profile_id - - -class RecoveryAvailabilitySetCustomDetails(_serialization.Model): - """Recovery Availability Set custom input. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - ExistingRecoveryAvailabilitySet - - All required parameters must be populated in order to send to server. - - :ivar resource_type: The class type. Required. - :vartype resource_type: str - """ - - _validation = { - "resource_type": {"required": True}, - } - - _attribute_map = { - "resource_type": {"key": "resourceType", "type": "str"}, - } - - _subtype_map = {"resource_type": {"Existing": "ExistingRecoveryAvailabilitySet"}} - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.resource_type: Optional[str] = None - - -class ExistingRecoveryAvailabilitySet(RecoveryAvailabilitySetCustomDetails): - """Existing recovery availability set input. - - All required parameters must be populated in order to send to server. - - :ivar resource_type: The class type. Required. - :vartype resource_type: str - :ivar recovery_availability_set_id: The recovery availability set Id. Will throw error, if - resource does not exist. - :vartype recovery_availability_set_id: str - """ - - _validation = { - "resource_type": {"required": True}, - } - - _attribute_map = { - "resource_type": {"key": "resourceType", "type": "str"}, - "recovery_availability_set_id": {"key": "recoveryAvailabilitySetId", "type": "str"}, - } - - def __init__(self, *, recovery_availability_set_id: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword recovery_availability_set_id: The recovery availability set Id. Will throw error, if - resource does not exist. - :paramtype recovery_availability_set_id: str - """ - super().__init__(**kwargs) - self.resource_type: str = "Existing" - self.recovery_availability_set_id = recovery_availability_set_id - - -class RecoveryProximityPlacementGroupCustomDetails(_serialization.Model): # pylint: disable=name-too-long - """Recovery Proximity placement group custom input. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - ExistingRecoveryProximityPlacementGroup - - All required parameters must be populated in order to send to server. - - :ivar resource_type: The class type. Required. - :vartype resource_type: str - """ - - _validation = { - "resource_type": {"required": True}, - } - - _attribute_map = { - "resource_type": {"key": "resourceType", "type": "str"}, - } - - _subtype_map = {"resource_type": {"Existing": "ExistingRecoveryProximityPlacementGroup"}} - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.resource_type: Optional[str] = None - - -class ExistingRecoveryProximityPlacementGroup(RecoveryProximityPlacementGroupCustomDetails): - """Existing recovery proximity placement group input. - - All required parameters must be populated in order to send to server. - - :ivar resource_type: The class type. Required. - :vartype resource_type: str - :ivar recovery_proximity_placement_group_id: The recovery proximity placement group Id. Will - throw error, if resource does not exist. - :vartype recovery_proximity_placement_group_id: str - """ - - _validation = { - "resource_type": {"required": True}, - } - - _attribute_map = { - "resource_type": {"key": "resourceType", "type": "str"}, - "recovery_proximity_placement_group_id": {"key": "recoveryProximityPlacementGroupId", "type": "str"}, - } - - def __init__(self, *, recovery_proximity_placement_group_id: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword recovery_proximity_placement_group_id: The recovery proximity placement group Id. Will - throw error, if resource does not exist. - :paramtype recovery_proximity_placement_group_id: str - """ - super().__init__(**kwargs) - self.resource_type: str = "Existing" - self.recovery_proximity_placement_group_id = recovery_proximity_placement_group_id - - -class RecoveryResourceGroupCustomDetails(_serialization.Model): - """Recovery Resource Group custom input. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - ExistingRecoveryResourceGroup - - All required parameters must be populated in order to send to server. - - :ivar resource_type: The class type. Required. - :vartype resource_type: str - """ - - _validation = { - "resource_type": {"required": True}, - } - - _attribute_map = { - "resource_type": {"key": "resourceType", "type": "str"}, - } - - _subtype_map = {"resource_type": {"Existing": "ExistingRecoveryResourceGroup"}} - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.resource_type: Optional[str] = None - - -class ExistingRecoveryResourceGroup(RecoveryResourceGroupCustomDetails): - """Existing recovery resource group input. - - All required parameters must be populated in order to send to server. - - :ivar resource_type: The class type. Required. - :vartype resource_type: str - :ivar recovery_resource_group_id: The recovery resource group Id. Valid for V2 scenarios. - :vartype recovery_resource_group_id: str - """ - - _validation = { - "resource_type": {"required": True}, - } - - _attribute_map = { - "resource_type": {"key": "resourceType", "type": "str"}, - "recovery_resource_group_id": {"key": "recoveryResourceGroupId", "type": "str"}, - } - - def __init__(self, *, recovery_resource_group_id: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword recovery_resource_group_id: The recovery resource group Id. Valid for V2 scenarios. - :paramtype recovery_resource_group_id: str - """ - super().__init__(**kwargs) - self.resource_type: str = "Existing" - self.recovery_resource_group_id = recovery_resource_group_id - - -class RecoveryVirtualNetworkCustomDetails(_serialization.Model): - """Recovery Virtual network custom input. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - ExistingRecoveryVirtualNetwork, NewRecoveryVirtualNetwork - - All required parameters must be populated in order to send to server. - - :ivar resource_type: The class type. Required. - :vartype resource_type: str - """ - - _validation = { - "resource_type": {"required": True}, - } - - _attribute_map = { - "resource_type": {"key": "resourceType", "type": "str"}, - } - - _subtype_map = {"resource_type": {"Existing": "ExistingRecoveryVirtualNetwork", "New": "NewRecoveryVirtualNetwork"}} - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.resource_type: Optional[str] = None - - -class ExistingRecoveryVirtualNetwork(RecoveryVirtualNetworkCustomDetails): - """Existing recovery virtual network input. - - All required parameters must be populated in order to send to server. - - :ivar resource_type: The class type. Required. - :vartype resource_type: str - :ivar recovery_virtual_network_id: The recovery virtual network Id. Will throw error, if - resource does not exist. Required. - :vartype recovery_virtual_network_id: str - :ivar recovery_subnet_name: The recovery subnet name. - :vartype recovery_subnet_name: str - """ - - _validation = { - "resource_type": {"required": True}, - "recovery_virtual_network_id": {"required": True}, - } - - _attribute_map = { - "resource_type": {"key": "resourceType", "type": "str"}, - "recovery_virtual_network_id": {"key": "recoveryVirtualNetworkId", "type": "str"}, - "recovery_subnet_name": {"key": "recoverySubnetName", "type": "str"}, - } - - def __init__( - self, *, recovery_virtual_network_id: str, recovery_subnet_name: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword recovery_virtual_network_id: The recovery virtual network Id. Will throw error, if - resource does not exist. Required. - :paramtype recovery_virtual_network_id: str - :keyword recovery_subnet_name: The recovery subnet name. - :paramtype recovery_subnet_name: str - """ - super().__init__(**kwargs) - self.resource_type: str = "Existing" - self.recovery_virtual_network_id = recovery_virtual_network_id - self.recovery_subnet_name = recovery_subnet_name - - -class StorageAccountCustomDetails(_serialization.Model): - """Storage account custom input. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - ExistingStorageAccount - - All required parameters must be populated in order to send to server. - - :ivar resource_type: The class type. Required. - :vartype resource_type: str - """ - - _validation = { - "resource_type": {"required": True}, - } - - _attribute_map = { - "resource_type": {"key": "resourceType", "type": "str"}, - } - - _subtype_map = {"resource_type": {"Existing": "ExistingStorageAccount"}} - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.resource_type: Optional[str] = None - - -class ExistingStorageAccount(StorageAccountCustomDetails): - """Existing storage account input. - - All required parameters must be populated in order to send to server. - - :ivar resource_type: The class type. Required. - :vartype resource_type: str - :ivar azure_storage_account_id: The storage account Arm Id. Throw error, if resource does not - exists. Required. - :vartype azure_storage_account_id: str - """ - - _validation = { - "resource_type": {"required": True}, - "azure_storage_account_id": {"required": True}, - } - - _attribute_map = { - "resource_type": {"key": "resourceType", "type": "str"}, - "azure_storage_account_id": {"key": "azureStorageAccountId", "type": "str"}, - } - - def __init__(self, *, azure_storage_account_id: str, **kwargs: Any) -> None: - """ - :keyword azure_storage_account_id: The storage account Arm Id. Throw error, if resource does - not exists. Required. - :paramtype azure_storage_account_id: str - """ - super().__init__(**kwargs) - self.resource_type: str = "Existing" - self.azure_storage_account_id = azure_storage_account_id - - -class ExportJobDetails(JobDetails): - """This class represents details for export jobs workflow. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: Gets the type of job details (see JobDetailsTypes enum for possible - values). Required. - :vartype instance_type: str - :ivar affected_object_details: The affected object properties like source server, source cloud, - target server, target cloud etc. based on the workflow object details. - :vartype affected_object_details: dict[str, str] - :ivar blob_uri: BlobUri of the exported jobs. - :vartype blob_uri: str - :ivar sas_token: The sas token to access blob. - :vartype sas_token: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "affected_object_details": {"key": "affectedObjectDetails", "type": "{str}"}, - "blob_uri": {"key": "blobUri", "type": "str"}, - "sas_token": {"key": "sasToken", "type": "str"}, - } - - def __init__( - self, - *, - affected_object_details: Optional[Dict[str, str]] = None, - blob_uri: Optional[str] = None, - sas_token: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword affected_object_details: The affected object properties like source server, source - cloud, target server, target cloud etc. based on the workflow object details. - :paramtype affected_object_details: dict[str, str] - :keyword blob_uri: BlobUri of the exported jobs. - :paramtype blob_uri: str - :keyword sas_token: The sas token to access blob. - :paramtype sas_token: str - """ - super().__init__(affected_object_details=affected_object_details, **kwargs) - self.instance_type: str = "ExportJobDetails" - self.blob_uri = blob_uri - self.sas_token = sas_token - - -class ExtendedLocation(_serialization.Model): - """Extended location of the resource. - - All required parameters must be populated in order to send to server. - - :ivar name: The name of the extended location. Required. - :vartype name: str - :ivar type: The extended location type. Required. "EdgeZone" - :vartype type: str or ~azure.mgmt.recoveryservicessiterecovery.models.ExtendedLocationType - """ - - _validation = { - "name": {"required": True}, - "type": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - } - - def __init__(self, *, name: str, type: Union[str, "_models.ExtendedLocationType"], **kwargs: Any) -> None: - """ - :keyword name: The name of the extended location. Required. - :paramtype name: str - :keyword type: The extended location type. Required. "EdgeZone" - :paramtype type: str or ~azure.mgmt.recoveryservicessiterecovery.models.ExtendedLocationType - """ - super().__init__(**kwargs) - self.name = name - self.type = type - - -class Fabric(Resource): - """Fabric definition. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :ivar type: Resource Type. - :vartype type: str - :ivar location: Resource Location. - :vartype location: str - :ivar properties: Fabric related data. - :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.FabricProperties - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "properties": {"key": "properties", "type": "FabricProperties"}, - } - - def __init__( - self, *, location: Optional[str] = None, properties: Optional["_models.FabricProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword location: Resource Location. - :paramtype location: str - :keyword properties: Fabric related data. - :paramtype properties: ~azure.mgmt.recoveryservicessiterecovery.models.FabricProperties - """ - super().__init__(location=location, **kwargs) - self.properties = properties - - -class FabricCollection(_serialization.Model): - """Collection of fabric details. - - :ivar value: The fabric details. - :vartype value: list[~azure.mgmt.recoveryservicessiterecovery.models.Fabric] - :ivar next_link: The value of next link. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[Fabric]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.Fabric"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The fabric details. - :paramtype value: list[~azure.mgmt.recoveryservicessiterecovery.models.Fabric] - :keyword next_link: The value of next link. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class FabricCreationInput(_serialization.Model): - """Site details provided during the time of site creation. - - :ivar properties: Fabric creation input. - :vartype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.FabricCreationInputProperties - """ - - _attribute_map = { - "properties": {"key": "properties", "type": "FabricCreationInputProperties"}, - } - - def __init__(self, *, properties: Optional["_models.FabricCreationInputProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Fabric creation input. - :paramtype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.FabricCreationInputProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class FabricCreationInputProperties(_serialization.Model): - """Properties of site details provided during the time of site creation. - - :ivar custom_details: Fabric provider specific creation input. - :vartype custom_details: - ~azure.mgmt.recoveryservicessiterecovery.models.FabricSpecificCreationInput - """ - - _attribute_map = { - "custom_details": {"key": "customDetails", "type": "FabricSpecificCreationInput"}, - } - - def __init__( - self, *, custom_details: Optional["_models.FabricSpecificCreationInput"] = None, **kwargs: Any - ) -> None: - """ - :keyword custom_details: Fabric provider specific creation input. - :paramtype custom_details: - ~azure.mgmt.recoveryservicessiterecovery.models.FabricSpecificCreationInput - """ - super().__init__(**kwargs) - self.custom_details = custom_details - - -class FabricProperties(_serialization.Model): - """Fabric properties. - - :ivar friendly_name: Friendly name of the fabric. - :vartype friendly_name: str - :ivar encryption_details: Encryption details for the fabric. - :vartype encryption_details: ~azure.mgmt.recoveryservicessiterecovery.models.EncryptionDetails - :ivar rollover_encryption_details: Rollover encryption details for the fabric. - :vartype rollover_encryption_details: - ~azure.mgmt.recoveryservicessiterecovery.models.EncryptionDetails - :ivar internal_identifier: Dra Registration Id. - :vartype internal_identifier: str - :ivar bcdr_state: BCDR state of the fabric. - :vartype bcdr_state: str - :ivar custom_details: Fabric specific settings. - :vartype custom_details: ~azure.mgmt.recoveryservicessiterecovery.models.FabricSpecificDetails - :ivar health_error_details: Fabric health error details. - :vartype health_error_details: - list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] - :ivar health: Health of fabric. - :vartype health: str - """ - - _attribute_map = { - "friendly_name": {"key": "friendlyName", "type": "str"}, - "encryption_details": {"key": "encryptionDetails", "type": "EncryptionDetails"}, - "rollover_encryption_details": {"key": "rolloverEncryptionDetails", "type": "EncryptionDetails"}, - "internal_identifier": {"key": "internalIdentifier", "type": "str"}, - "bcdr_state": {"key": "bcdrState", "type": "str"}, - "custom_details": {"key": "customDetails", "type": "FabricSpecificDetails"}, - "health_error_details": {"key": "healthErrorDetails", "type": "[HealthError]"}, - "health": {"key": "health", "type": "str"}, - } - - def __init__( - self, - *, - friendly_name: Optional[str] = None, - encryption_details: Optional["_models.EncryptionDetails"] = None, - rollover_encryption_details: Optional["_models.EncryptionDetails"] = None, - internal_identifier: Optional[str] = None, - bcdr_state: Optional[str] = None, - custom_details: Optional["_models.FabricSpecificDetails"] = None, - health_error_details: Optional[List["_models.HealthError"]] = None, - health: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword friendly_name: Friendly name of the fabric. - :paramtype friendly_name: str - :keyword encryption_details: Encryption details for the fabric. - :paramtype encryption_details: - ~azure.mgmt.recoveryservicessiterecovery.models.EncryptionDetails - :keyword rollover_encryption_details: Rollover encryption details for the fabric. - :paramtype rollover_encryption_details: - ~azure.mgmt.recoveryservicessiterecovery.models.EncryptionDetails - :keyword internal_identifier: Dra Registration Id. - :paramtype internal_identifier: str - :keyword bcdr_state: BCDR state of the fabric. - :paramtype bcdr_state: str - :keyword custom_details: Fabric specific settings. - :paramtype custom_details: - ~azure.mgmt.recoveryservicessiterecovery.models.FabricSpecificDetails - :keyword health_error_details: Fabric health error details. - :paramtype health_error_details: - list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] - :keyword health: Health of fabric. - :paramtype health: str - """ - super().__init__(**kwargs) - self.friendly_name = friendly_name - self.encryption_details = encryption_details - self.rollover_encryption_details = rollover_encryption_details - self.internal_identifier = internal_identifier - self.bcdr_state = bcdr_state - self.custom_details = custom_details - self.health_error_details = health_error_details - self.health = health - - -class FabricQueryParameter(_serialization.Model): - """Query parameter to get fabric. - - :ivar zone_to_zone_mappings: A value indicating whether the zone to zone mappings are to be - returned. - :vartype zone_to_zone_mappings: str - :ivar extended_location_mappings: A value indicating whether the Extended Location mappings are - to be returned. - :vartype extended_location_mappings: str - :ivar location_details: A value indicating whether the location details are to be returned. - :vartype location_details: str - :ivar fetch_agent_details: A value indicating whether the agent details are to be fetched. - :vartype fetch_agent_details: str - :ivar bios_id: The BIOS Id to be used for fetching agent details. - :vartype bios_id: str - :ivar fqdn: The FQDN to be used for fetching agent details. - :vartype fqdn: str - :ivar discovery_type: The type of the discovered machine to be used for fetching agent details. - :vartype discovery_type: str - :ivar os_type: The OS type to be used for fetching agent details. - :vartype os_type: str - """ - - _attribute_map = { - "zone_to_zone_mappings": {"key": "zoneToZoneMappings", "type": "str"}, - "extended_location_mappings": {"key": "extendedLocationMappings", "type": "str"}, - "location_details": {"key": "locationDetails", "type": "str"}, - "fetch_agent_details": {"key": "fetchAgentDetails", "type": "str"}, - "bios_id": {"key": "biosId", "type": "str"}, - "fqdn": {"key": "fqdn", "type": "str"}, - "discovery_type": {"key": "discoveryType", "type": "str"}, - "os_type": {"key": "osType", "type": "str"}, - } - - def __init__( - self, - *, - zone_to_zone_mappings: Optional[str] = None, - extended_location_mappings: Optional[str] = None, - location_details: Optional[str] = None, - fetch_agent_details: Optional[str] = None, - bios_id: Optional[str] = None, - fqdn: Optional[str] = None, - discovery_type: Optional[str] = None, - os_type: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword zone_to_zone_mappings: A value indicating whether the zone to zone mappings are to be - returned. - :paramtype zone_to_zone_mappings: str - :keyword extended_location_mappings: A value indicating whether the Extended Location mappings - are to be returned. - :paramtype extended_location_mappings: str - :keyword location_details: A value indicating whether the location details are to be returned. - :paramtype location_details: str - :keyword fetch_agent_details: A value indicating whether the agent details are to be fetched. - :paramtype fetch_agent_details: str - :keyword bios_id: The BIOS Id to be used for fetching agent details. - :paramtype bios_id: str - :keyword fqdn: The FQDN to be used for fetching agent details. - :paramtype fqdn: str - :keyword discovery_type: The type of the discovered machine to be used for fetching agent - details. - :paramtype discovery_type: str - :keyword os_type: The OS type to be used for fetching agent details. - :paramtype os_type: str - """ - super().__init__(**kwargs) - self.zone_to_zone_mappings = zone_to_zone_mappings - self.extended_location_mappings = extended_location_mappings - self.location_details = location_details - self.fetch_agent_details = fetch_agent_details - self.bios_id = bios_id - self.fqdn = fqdn - self.discovery_type = discovery_type - self.os_type = os_type - - -class JobTaskDetails(TaskTypeDetails): - """This class represents a task which is actually a workflow so that one can navigate to its - individual drill down. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - FabricReplicationGroupTaskDetails, VirtualMachineTaskDetails - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The type of task details. Required. - :vartype instance_type: str - :ivar job_task: The job entity. - :vartype job_task: ~azure.mgmt.recoveryservicessiterecovery.models.JobEntity - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "job_task": {"key": "jobTask", "type": "JobEntity"}, - } - - _subtype_map = { - "instance_type": { - "FabricReplicationGroupTaskDetails": "FabricReplicationGroupTaskDetails", - "VirtualMachineTaskDetails": "VirtualMachineTaskDetails", - } - } - - def __init__(self, *, job_task: Optional["_models.JobEntity"] = None, **kwargs: Any) -> None: - """ - :keyword job_task: The job entity. - :paramtype job_task: ~azure.mgmt.recoveryservicessiterecovery.models.JobEntity - """ - super().__init__(**kwargs) - self.instance_type: str = "JobTaskDetails" - self.job_task = job_task - - -class FabricReplicationGroupTaskDetails(JobTaskDetails): - """This class represents the fabric replication group task details. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The type of task details. Required. - :vartype instance_type: str - :ivar job_task: The job entity. - :vartype job_task: ~azure.mgmt.recoveryservicessiterecovery.models.JobEntity - :ivar skipped_reason: The skipped reason. - :vartype skipped_reason: str - :ivar skipped_reason_string: The skipped reason string. - :vartype skipped_reason_string: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "job_task": {"key": "jobTask", "type": "JobEntity"}, - "skipped_reason": {"key": "skippedReason", "type": "str"}, - "skipped_reason_string": {"key": "skippedReasonString", "type": "str"}, - } - - def __init__( - self, - *, - job_task: Optional["_models.JobEntity"] = None, - skipped_reason: Optional[str] = None, - skipped_reason_string: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword job_task: The job entity. - :paramtype job_task: ~azure.mgmt.recoveryservicessiterecovery.models.JobEntity - :keyword skipped_reason: The skipped reason. - :paramtype skipped_reason: str - :keyword skipped_reason_string: The skipped reason string. - :paramtype skipped_reason_string: str - """ - super().__init__(job_task=job_task, **kwargs) - self.instance_type: str = "FabricReplicationGroupTaskDetails" - self.skipped_reason = skipped_reason - self.skipped_reason_string = skipped_reason_string - - -class FailoverJobDetails(JobDetails): - """This class represents the details for a failover job. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: Gets the type of job details (see JobDetailsTypes enum for possible - values). Required. - :vartype instance_type: str - :ivar affected_object_details: The affected object properties like source server, source cloud, - target server, target cloud etc. based on the workflow object details. - :vartype affected_object_details: dict[str, str] - :ivar protected_item_details: The test VM details. - :vartype protected_item_details: - list[~azure.mgmt.recoveryservicessiterecovery.models.FailoverReplicationProtectedItemDetails] - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "affected_object_details": {"key": "affectedObjectDetails", "type": "{str}"}, - "protected_item_details": {"key": "protectedItemDetails", "type": "[FailoverReplicationProtectedItemDetails]"}, - } - - def __init__( - self, - *, - affected_object_details: Optional[Dict[str, str]] = None, - protected_item_details: Optional[List["_models.FailoverReplicationProtectedItemDetails"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword affected_object_details: The affected object properties like source server, source - cloud, target server, target cloud etc. based on the workflow object details. - :paramtype affected_object_details: dict[str, str] - :keyword protected_item_details: The test VM details. - :paramtype protected_item_details: - list[~azure.mgmt.recoveryservicessiterecovery.models.FailoverReplicationProtectedItemDetails] - """ - super().__init__(affected_object_details=affected_object_details, **kwargs) - self.instance_type: str = "FailoverJobDetails" - self.protected_item_details = protected_item_details - - -class FailoverProcessServerRequest(_serialization.Model): - """Request to failover a process server. - - :ivar properties: The properties of the PS Failover request. - :vartype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.FailoverProcessServerRequestProperties - """ - - _attribute_map = { - "properties": {"key": "properties", "type": "FailoverProcessServerRequestProperties"}, - } - - def __init__( - self, *, properties: Optional["_models.FailoverProcessServerRequestProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: The properties of the PS Failover request. - :paramtype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.FailoverProcessServerRequestProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class FailoverProcessServerRequestProperties(_serialization.Model): - """The properties of the Failover Process Server request. - - :ivar container_name: The container identifier. - :vartype container_name: str - :ivar source_process_server_id: The source process server. - :vartype source_process_server_id: str - :ivar target_process_server_id: The new process server. - :vartype target_process_server_id: str - :ivar vms_to_migrate: The VMS to migrate. - :vartype vms_to_migrate: list[str] - :ivar update_type: A value for failover type. It can be systemlevel/serverlevel. - :vartype update_type: str - """ - - _attribute_map = { - "container_name": {"key": "containerName", "type": "str"}, - "source_process_server_id": {"key": "sourceProcessServerId", "type": "str"}, - "target_process_server_id": {"key": "targetProcessServerId", "type": "str"}, - "vms_to_migrate": {"key": "vmsToMigrate", "type": "[str]"}, - "update_type": {"key": "updateType", "type": "str"}, - } - - def __init__( - self, - *, - container_name: Optional[str] = None, - source_process_server_id: Optional[str] = None, - target_process_server_id: Optional[str] = None, - vms_to_migrate: Optional[List[str]] = None, - update_type: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword container_name: The container identifier. - :paramtype container_name: str - :keyword source_process_server_id: The source process server. - :paramtype source_process_server_id: str - :keyword target_process_server_id: The new process server. - :paramtype target_process_server_id: str - :keyword vms_to_migrate: The VMS to migrate. - :paramtype vms_to_migrate: list[str] - :keyword update_type: A value for failover type. It can be systemlevel/serverlevel. - :paramtype update_type: str - """ - super().__init__(**kwargs) - self.container_name = container_name - self.source_process_server_id = source_process_server_id - self.target_process_server_id = target_process_server_id - self.vms_to_migrate = vms_to_migrate - self.update_type = update_type - - -class FailoverReplicationProtectedItemDetails(_serialization.Model): - """Failover details for a replication protected item. - - :ivar name: The name. - :vartype name: str - :ivar friendly_name: The friendly name. - :vartype friendly_name: str - :ivar test_vm_name: The test Vm name. - :vartype test_vm_name: str - :ivar test_vm_friendly_name: The test Vm friendly name. - :vartype test_vm_friendly_name: str - :ivar network_connection_status: The network connection status. - :vartype network_connection_status: str - :ivar network_friendly_name: The network friendly name. - :vartype network_friendly_name: str - :ivar subnet: The network subnet. - :vartype subnet: str - :ivar recovery_point_id: The recovery point Id. - :vartype recovery_point_id: str - :ivar recovery_point_time: The recovery point time. - :vartype recovery_point_time: ~datetime.datetime - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "friendly_name": {"key": "friendlyName", "type": "str"}, - "test_vm_name": {"key": "testVmName", "type": "str"}, - "test_vm_friendly_name": {"key": "testVmFriendlyName", "type": "str"}, - "network_connection_status": {"key": "networkConnectionStatus", "type": "str"}, - "network_friendly_name": {"key": "networkFriendlyName", "type": "str"}, - "subnet": {"key": "subnet", "type": "str"}, - "recovery_point_id": {"key": "recoveryPointId", "type": "str"}, - "recovery_point_time": {"key": "recoveryPointTime", "type": "iso-8601"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - friendly_name: Optional[str] = None, - test_vm_name: Optional[str] = None, - test_vm_friendly_name: Optional[str] = None, - network_connection_status: Optional[str] = None, - network_friendly_name: Optional[str] = None, - subnet: Optional[str] = None, - recovery_point_id: Optional[str] = None, - recovery_point_time: Optional[datetime.datetime] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: The name. - :paramtype name: str - :keyword friendly_name: The friendly name. - :paramtype friendly_name: str - :keyword test_vm_name: The test Vm name. - :paramtype test_vm_name: str - :keyword test_vm_friendly_name: The test Vm friendly name. - :paramtype test_vm_friendly_name: str - :keyword network_connection_status: The network connection status. - :paramtype network_connection_status: str - :keyword network_friendly_name: The network friendly name. - :paramtype network_friendly_name: str - :keyword subnet: The network subnet. - :paramtype subnet: str - :keyword recovery_point_id: The recovery point Id. - :paramtype recovery_point_id: str - :keyword recovery_point_time: The recovery point time. - :paramtype recovery_point_time: ~datetime.datetime - """ - super().__init__(**kwargs) - self.name = name - self.friendly_name = friendly_name - self.test_vm_name = test_vm_name - self.test_vm_friendly_name = test_vm_friendly_name - self.network_connection_status = network_connection_status - self.network_friendly_name = network_friendly_name - self.subnet = subnet - self.recovery_point_id = recovery_point_id - self.recovery_point_time = recovery_point_time - - -class GatewayOperationDetails(_serialization.Model): - """Details of the gateway operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar state: A value indicating the state of gateway operation. - :vartype state: str - :ivar progress_percentage: A value indicating the progress percentage of gateway operation. - :vartype progress_percentage: int - :ivar time_elapsed: A value indicating the time elapsed for the operation in milliseconds. - :vartype time_elapsed: int - :ivar time_remaining: A value indicating the time remaining for the operation in milliseconds. - :vartype time_remaining: int - :ivar upload_speed: A value indicating the upload speed in bytes per second. - :vartype upload_speed: int - :ivar host_name: A value indicating the ESXi host name. - :vartype host_name: str - :ivar data_stores: A value indicating the datastore collection. - :vartype data_stores: list[str] - :ivar vmware_read_throughput: A value indicating the VMware read throughput in bytes per - second. - :vartype vmware_read_throughput: int - """ - - _validation = { - "state": {"readonly": True}, - "progress_percentage": {"readonly": True}, - "time_elapsed": {"readonly": True}, - "time_remaining": {"readonly": True}, - "upload_speed": {"readonly": True}, - "host_name": {"readonly": True}, - "data_stores": {"readonly": True}, - "vmware_read_throughput": {"readonly": True}, - } - - _attribute_map = { - "state": {"key": "state", "type": "str"}, - "progress_percentage": {"key": "progressPercentage", "type": "int"}, - "time_elapsed": {"key": "timeElapsed", "type": "int"}, - "time_remaining": {"key": "timeRemaining", "type": "int"}, - "upload_speed": {"key": "uploadSpeed", "type": "int"}, - "host_name": {"key": "hostName", "type": "str"}, - "data_stores": {"key": "dataStores", "type": "[str]"}, - "vmware_read_throughput": {"key": "vmwareReadThroughput", "type": "int"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.state: Optional[str] = None - self.progress_percentage: Optional[int] = None - self.time_elapsed: Optional[int] = None - self.time_remaining: Optional[int] = None - self.upload_speed: Optional[int] = None - self.host_name: Optional[str] = None - self.data_stores: Optional[List[str]] = None - self.vmware_read_throughput: Optional[int] = None - - -class GroupTaskDetails(_serialization.Model): - """This class represents the group task details when parent child relationship exists in the drill - down. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - InlineWorkflowTaskDetails, RecoveryPlanGroupTaskDetails - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The type of task details. Required. - :vartype instance_type: str - :ivar child_tasks: The child tasks. - :vartype child_tasks: list[~azure.mgmt.recoveryservicessiterecovery.models.ASRTask] - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "child_tasks": {"key": "childTasks", "type": "[ASRTask]"}, - } - - _subtype_map = { - "instance_type": { - "InlineWorkflowTaskDetails": "InlineWorkflowTaskDetails", - "RecoveryPlanGroupTaskDetails": "RecoveryPlanGroupTaskDetails", - } - } - - def __init__(self, *, child_tasks: Optional[List["_models.ASRTask"]] = None, **kwargs: Any) -> None: - """ - :keyword child_tasks: The child tasks. - :paramtype child_tasks: list[~azure.mgmt.recoveryservicessiterecovery.models.ASRTask] - """ - super().__init__(**kwargs) - self.instance_type: Optional[str] = None - self.child_tasks = child_tasks - - -class HealthError(_serialization.Model): - """Health Error. - - :ivar inner_health_errors: The inner health errors. HealthError having a list of HealthError as - child errors is problematic. InnerHealthError is used because this will prevent an infinite - loop of structures when Hydra tries to auto-generate the contract. We are exposing the related - health errors as inner health errors and all API consumers can utilize this in the same fashion - as Exception -> InnerException. - :vartype inner_health_errors: - list[~azure.mgmt.recoveryservicessiterecovery.models.InnerHealthError] - :ivar error_source: Source of error. - :vartype error_source: str - :ivar error_type: Type of error. - :vartype error_type: str - :ivar error_level: Level of error. - :vartype error_level: str - :ivar error_category: Category of error. - :vartype error_category: str - :ivar error_code: Error code. - :vartype error_code: str - :ivar summary_message: Summary message of the entity. - :vartype summary_message: str - :ivar error_message: Error message. - :vartype error_message: str - :ivar possible_causes: Possible causes of error. - :vartype possible_causes: str - :ivar recommended_action: Recommended action to resolve error. - :vartype recommended_action: str - :ivar creation_time_utc: Error creation time (UTC). - :vartype creation_time_utc: ~datetime.datetime - :ivar recovery_provider_error_message: DRA error message. - :vartype recovery_provider_error_message: str - :ivar entity_id: ID of the entity. - :vartype entity_id: str - :ivar error_id: The health error unique id. - :vartype error_id: str - :ivar customer_resolvability: Value indicating whether the health error is customer resolvable. - Known values are: "Allowed" and "NotAllowed". - :vartype customer_resolvability: str or - ~azure.mgmt.recoveryservicessiterecovery.models.HealthErrorCustomerResolvability - """ - - _attribute_map = { - "inner_health_errors": {"key": "innerHealthErrors", "type": "[InnerHealthError]"}, - "error_source": {"key": "errorSource", "type": "str"}, - "error_type": {"key": "errorType", "type": "str"}, - "error_level": {"key": "errorLevel", "type": "str"}, - "error_category": {"key": "errorCategory", "type": "str"}, - "error_code": {"key": "errorCode", "type": "str"}, - "summary_message": {"key": "summaryMessage", "type": "str"}, - "error_message": {"key": "errorMessage", "type": "str"}, - "possible_causes": {"key": "possibleCauses", "type": "str"}, - "recommended_action": {"key": "recommendedAction", "type": "str"}, - "creation_time_utc": {"key": "creationTimeUtc", "type": "iso-8601"}, - "recovery_provider_error_message": {"key": "recoveryProviderErrorMessage", "type": "str"}, - "entity_id": {"key": "entityId", "type": "str"}, - "error_id": {"key": "errorId", "type": "str"}, - "customer_resolvability": {"key": "customerResolvability", "type": "str"}, - } - - def __init__( - self, - *, - inner_health_errors: Optional[List["_models.InnerHealthError"]] = None, - error_source: Optional[str] = None, - error_type: Optional[str] = None, - error_level: Optional[str] = None, - error_category: Optional[str] = None, - error_code: Optional[str] = None, - summary_message: Optional[str] = None, - error_message: Optional[str] = None, - possible_causes: Optional[str] = None, - recommended_action: Optional[str] = None, - creation_time_utc: Optional[datetime.datetime] = None, - recovery_provider_error_message: Optional[str] = None, - entity_id: Optional[str] = None, - error_id: Optional[str] = None, - customer_resolvability: Optional[Union[str, "_models.HealthErrorCustomerResolvability"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword inner_health_errors: The inner health errors. HealthError having a list of HealthError - as child errors is problematic. InnerHealthError is used because this will prevent an infinite - loop of structures when Hydra tries to auto-generate the contract. We are exposing the related - health errors as inner health errors and all API consumers can utilize this in the same fashion - as Exception -> InnerException. - :paramtype inner_health_errors: - list[~azure.mgmt.recoveryservicessiterecovery.models.InnerHealthError] - :keyword error_source: Source of error. - :paramtype error_source: str - :keyword error_type: Type of error. - :paramtype error_type: str - :keyword error_level: Level of error. - :paramtype error_level: str - :keyword error_category: Category of error. - :paramtype error_category: str - :keyword error_code: Error code. - :paramtype error_code: str - :keyword summary_message: Summary message of the entity. - :paramtype summary_message: str - :keyword error_message: Error message. - :paramtype error_message: str - :keyword possible_causes: Possible causes of error. - :paramtype possible_causes: str - :keyword recommended_action: Recommended action to resolve error. - :paramtype recommended_action: str - :keyword creation_time_utc: Error creation time (UTC). - :paramtype creation_time_utc: ~datetime.datetime - :keyword recovery_provider_error_message: DRA error message. - :paramtype recovery_provider_error_message: str - :keyword entity_id: ID of the entity. - :paramtype entity_id: str - :keyword error_id: The health error unique id. - :paramtype error_id: str - :keyword customer_resolvability: Value indicating whether the health error is customer - resolvable. Known values are: "Allowed" and "NotAllowed". - :paramtype customer_resolvability: str or - ~azure.mgmt.recoveryservicessiterecovery.models.HealthErrorCustomerResolvability - """ - super().__init__(**kwargs) - self.inner_health_errors = inner_health_errors - self.error_source = error_source - self.error_type = error_type - self.error_level = error_level - self.error_category = error_category - self.error_code = error_code - self.summary_message = summary_message - self.error_message = error_message - self.possible_causes = possible_causes - self.recommended_action = recommended_action - self.creation_time_utc = creation_time_utc - self.recovery_provider_error_message = recovery_provider_error_message - self.entity_id = entity_id - self.error_id = error_id - self.customer_resolvability = customer_resolvability - - -class HealthErrorSummary(_serialization.Model): - """class to define the summary of the health error details. - - :ivar summary_code: The code of the health error. - :vartype summary_code: str - :ivar category: The category of the health error. Known values are: "None", "Replication", - "TestFailover", "Configuration", "FabricInfrastructure", "VersionExpiry", - "AgentAutoUpdateInfra", "AgentAutoUpdateArtifactDeleted", "AgentAutoUpdateRunAsAccount", - "AgentAutoUpdateRunAsAccountExpiry", and "AgentAutoUpdateRunAsAccountExpired". - :vartype category: str or ~azure.mgmt.recoveryservicessiterecovery.models.HealthErrorCategory - :ivar severity: Severity of error. Known values are: "NONE", "Warning", "Error", and "Info". - :vartype severity: str or ~azure.mgmt.recoveryservicessiterecovery.models.Severity - :ivar summary_message: The summary message of the health error. - :vartype summary_message: str - :ivar affected_resource_type: The type of affected ARM resource. - :vartype affected_resource_type: str - :ivar affected_resource_subtype: The sub type of any subcomponent within the ARM resource that - this might be applicable. Value remains null if not applicable. - :vartype affected_resource_subtype: str - :ivar affected_resource_correlation_ids: The list of affected resource correlation Ids. This - can be used to uniquely identify the count of items affected by a specific category and - severity as well as count of item affected by an specific issue. - :vartype affected_resource_correlation_ids: list[str] - """ - - _attribute_map = { - "summary_code": {"key": "summaryCode", "type": "str"}, - "category": {"key": "category", "type": "str"}, - "severity": {"key": "severity", "type": "str"}, - "summary_message": {"key": "summaryMessage", "type": "str"}, - "affected_resource_type": {"key": "affectedResourceType", "type": "str"}, - "affected_resource_subtype": {"key": "affectedResourceSubtype", "type": "str"}, - "affected_resource_correlation_ids": {"key": "affectedResourceCorrelationIds", "type": "[str]"}, - } - - def __init__( - self, - *, - summary_code: Optional[str] = None, - category: Optional[Union[str, "_models.HealthErrorCategory"]] = None, - severity: Optional[Union[str, "_models.Severity"]] = None, - summary_message: Optional[str] = None, - affected_resource_type: Optional[str] = None, - affected_resource_subtype: Optional[str] = None, - affected_resource_correlation_ids: Optional[List[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword summary_code: The code of the health error. - :paramtype summary_code: str - :keyword category: The category of the health error. Known values are: "None", "Replication", - "TestFailover", "Configuration", "FabricInfrastructure", "VersionExpiry", - "AgentAutoUpdateInfra", "AgentAutoUpdateArtifactDeleted", "AgentAutoUpdateRunAsAccount", - "AgentAutoUpdateRunAsAccountExpiry", and "AgentAutoUpdateRunAsAccountExpired". - :paramtype category: str or ~azure.mgmt.recoveryservicessiterecovery.models.HealthErrorCategory - :keyword severity: Severity of error. Known values are: "NONE", "Warning", "Error", and "Info". - :paramtype severity: str or ~azure.mgmt.recoveryservicessiterecovery.models.Severity - :keyword summary_message: The summary message of the health error. - :paramtype summary_message: str - :keyword affected_resource_type: The type of affected ARM resource. - :paramtype affected_resource_type: str - :keyword affected_resource_subtype: The sub type of any subcomponent within the ARM resource - that this might be applicable. Value remains null if not applicable. - :paramtype affected_resource_subtype: str - :keyword affected_resource_correlation_ids: The list of affected resource correlation Ids. This - can be used to uniquely identify the count of items affected by a specific category and - severity as well as count of item affected by an specific issue. - :paramtype affected_resource_correlation_ids: list[str] - """ - super().__init__(**kwargs) - self.summary_code = summary_code - self.category = category - self.severity = severity - self.summary_message = summary_message - self.affected_resource_type = affected_resource_type - self.affected_resource_subtype = affected_resource_subtype - self.affected_resource_correlation_ids = affected_resource_correlation_ids - - -class HyperVHostDetails(_serialization.Model): - """Hyper-V host details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The Hyper-V host Id. - :vartype id: str - :ivar name: The Hyper-V host name. - :vartype name: str - :ivar mars_agent_version: The Mars agent version. - :vartype mars_agent_version: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "mars_agent_version": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "mars_agent_version": {"key": "marsAgentVersion", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.id: Optional[str] = None - self.name: Optional[str] = None - self.mars_agent_version: Optional[str] = None - - -class HyperVReplica2012EventDetails(EventProviderSpecificDetails): - """Model class for event details of a HyperVReplica E2E event. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: Gets the class type. Overridden in derived classes. Required. - :vartype instance_type: str - :ivar container_name: The container friendly name. - :vartype container_name: str - :ivar fabric_name: The fabric friendly name. - :vartype fabric_name: str - :ivar remote_container_name: The remote container name. - :vartype remote_container_name: str - :ivar remote_fabric_name: The remote fabric name. - :vartype remote_fabric_name: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "container_name": {"key": "containerName", "type": "str"}, - "fabric_name": {"key": "fabricName", "type": "str"}, - "remote_container_name": {"key": "remoteContainerName", "type": "str"}, - "remote_fabric_name": {"key": "remoteFabricName", "type": "str"}, - } - - def __init__( - self, - *, - container_name: Optional[str] = None, - fabric_name: Optional[str] = None, - remote_container_name: Optional[str] = None, - remote_fabric_name: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword container_name: The container friendly name. - :paramtype container_name: str - :keyword fabric_name: The fabric friendly name. - :paramtype fabric_name: str - :keyword remote_container_name: The remote container name. - :paramtype remote_container_name: str - :keyword remote_fabric_name: The remote fabric name. - :paramtype remote_fabric_name: str - """ - super().__init__(**kwargs) - self.instance_type: str = "HyperVReplica2012" - self.container_name = container_name - self.fabric_name = fabric_name - self.remote_container_name = remote_container_name - self.remote_fabric_name = remote_fabric_name - - -class HyperVReplica2012R2EventDetails(EventProviderSpecificDetails): - """Model class for event details of a HyperVReplica blue E2E event. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: Gets the class type. Overridden in derived classes. Required. - :vartype instance_type: str - :ivar container_name: The container friendly name. - :vartype container_name: str - :ivar fabric_name: The fabric friendly name. - :vartype fabric_name: str - :ivar remote_container_name: The remote container name. - :vartype remote_container_name: str - :ivar remote_fabric_name: The remote fabric name. - :vartype remote_fabric_name: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "container_name": {"key": "containerName", "type": "str"}, - "fabric_name": {"key": "fabricName", "type": "str"}, - "remote_container_name": {"key": "remoteContainerName", "type": "str"}, - "remote_fabric_name": {"key": "remoteFabricName", "type": "str"}, - } - - def __init__( - self, - *, - container_name: Optional[str] = None, - fabric_name: Optional[str] = None, - remote_container_name: Optional[str] = None, - remote_fabric_name: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword container_name: The container friendly name. - :paramtype container_name: str - :keyword fabric_name: The fabric friendly name. - :paramtype fabric_name: str - :keyword remote_container_name: The remote container name. - :paramtype remote_container_name: str - :keyword remote_fabric_name: The remote fabric name. - :paramtype remote_fabric_name: str - """ - super().__init__(**kwargs) - self.instance_type: str = "HyperVReplica2012R2" - self.container_name = container_name - self.fabric_name = fabric_name - self.remote_container_name = remote_container_name - self.remote_fabric_name = remote_fabric_name - - -class HyperVReplicaAzureApplyRecoveryPointInput( - ApplyRecoveryPointProviderSpecificInput -): # pylint: disable=name-too-long - """ApplyRecoveryPoint input specific to HyperVReplicaAzure provider. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - :ivar primary_kek_certificate_pfx: The primary kek certificate pfx. - :vartype primary_kek_certificate_pfx: str - :ivar secondary_kek_certificate_pfx: The secondary kek certificate pfx. - :vartype secondary_kek_certificate_pfx: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "primary_kek_certificate_pfx": {"key": "primaryKekCertificatePfx", "type": "str"}, - "secondary_kek_certificate_pfx": {"key": "secondaryKekCertificatePfx", "type": "str"}, - } - - def __init__( - self, - *, - primary_kek_certificate_pfx: Optional[str] = None, - secondary_kek_certificate_pfx: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword primary_kek_certificate_pfx: The primary kek certificate pfx. - :paramtype primary_kek_certificate_pfx: str - :keyword secondary_kek_certificate_pfx: The secondary kek certificate pfx. - :paramtype secondary_kek_certificate_pfx: str - """ - super().__init__(**kwargs) - self.instance_type: str = "HyperVReplicaAzure" - self.primary_kek_certificate_pfx = primary_kek_certificate_pfx - self.secondary_kek_certificate_pfx = secondary_kek_certificate_pfx - - -class HyperVReplicaAzureDiskInputDetails(_serialization.Model): - """Disk input details. - - :ivar disk_id: The DiskId. - :vartype disk_id: str - :ivar log_storage_account_id: The LogStorageAccountId. - :vartype log_storage_account_id: str - :ivar disk_type: The disk type. Known values are: "Standard_LRS", "Premium_LRS", - "StandardSSD_LRS", "PremiumV2_LRS", "UltraSSD_LRS", "StandardSSD_ZRS", and "Premium_ZRS". - :vartype disk_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.DiskAccountType - :ivar disk_encryption_set_id: The DiskEncryptionSet ARM ID. - :vartype disk_encryption_set_id: str - :ivar sector_size_in_bytes: The logical sector size (in bytes), 512 by default. - :vartype sector_size_in_bytes: int - """ - - _attribute_map = { - "disk_id": {"key": "diskId", "type": "str"}, - "log_storage_account_id": {"key": "logStorageAccountId", "type": "str"}, - "disk_type": {"key": "diskType", "type": "str"}, - "disk_encryption_set_id": {"key": "diskEncryptionSetId", "type": "str"}, - "sector_size_in_bytes": {"key": "sectorSizeInBytes", "type": "int"}, - } - - def __init__( - self, - *, - disk_id: Optional[str] = None, - log_storage_account_id: Optional[str] = None, - disk_type: Optional[Union[str, "_models.DiskAccountType"]] = None, - disk_encryption_set_id: Optional[str] = None, - sector_size_in_bytes: Optional[int] = None, - **kwargs: Any - ) -> None: - """ - :keyword disk_id: The DiskId. - :paramtype disk_id: str - :keyword log_storage_account_id: The LogStorageAccountId. - :paramtype log_storage_account_id: str - :keyword disk_type: The disk type. Known values are: "Standard_LRS", "Premium_LRS", - "StandardSSD_LRS", "PremiumV2_LRS", "UltraSSD_LRS", "StandardSSD_ZRS", and "Premium_ZRS". - :paramtype disk_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.DiskAccountType - :keyword disk_encryption_set_id: The DiskEncryptionSet ARM ID. - :paramtype disk_encryption_set_id: str - :keyword sector_size_in_bytes: The logical sector size (in bytes), 512 by default. - :paramtype sector_size_in_bytes: int - """ - super().__init__(**kwargs) - self.disk_id = disk_id - self.log_storage_account_id = log_storage_account_id - self.disk_type = disk_type - self.disk_encryption_set_id = disk_encryption_set_id - self.sector_size_in_bytes = sector_size_in_bytes - - -class HyperVReplicaAzureEnableProtectionInput(EnableProtectionProviderSpecificInput): - """HyperVReplicaAzure specific enable protection input. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - :ivar hv_host_vm_id: The Hyper-V host VM Id. - :vartype hv_host_vm_id: str - :ivar vm_name: The VM Name. - :vartype vm_name: str - :ivar os_type: The OS type associated with VM. - :vartype os_type: str - :ivar user_selected_os_name: The OS name selected by user. - :vartype user_selected_os_name: str - :ivar vhd_id: The OS disk VHD id associated with VM. - :vartype vhd_id: str - :ivar target_storage_account_id: The storage account Id. - :vartype target_storage_account_id: str - :ivar target_azure_network_id: The selected target Azure network Id. - :vartype target_azure_network_id: str - :ivar target_azure_subnet_id: The selected target Azure subnet Id. - :vartype target_azure_subnet_id: str - :ivar enable_rdp_on_target_option: The selected option to enable RDP\\SSH on target vm after - failover. String value of SrsDataContract.EnableRDPOnTargetOption enum. - :vartype enable_rdp_on_target_option: str - :ivar target_azure_vm_name: The target azure VM Name. - :vartype target_azure_vm_name: str - :ivar log_storage_account_id: The storage account to be used for logging during replication. - :vartype log_storage_account_id: str - :ivar disks_to_include: The list of VHD Ids of disks to be protected. - :vartype disks_to_include: list[str] - :ivar target_azure_v1_resource_group_id: The Id of the target resource group (for classic - deployment) in which the failover VM is to be created. - :vartype target_azure_v1_resource_group_id: str - :ivar target_azure_v2_resource_group_id: The Id of the target resource group (for resource - manager deployment) in which the failover VM is to be created. - :vartype target_azure_v2_resource_group_id: str - :ivar use_managed_disks: A value indicating whether managed disks should be used during - failover. - :vartype use_managed_disks: str - :ivar target_availability_set_id: The target availability set ARM Id for resource manager - deployment. - :vartype target_availability_set_id: str - :ivar target_availability_zone: The target availability zone. - :vartype target_availability_zone: str - :ivar license_type: License type. Known values are: "NotSpecified", "NoLicenseType", and - "WindowsServer". - :vartype license_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.LicenseType - :ivar sql_server_license_type: The SQL Server license type. Known values are: "NotSpecified", - "NoLicenseType", "PAYG", and "AHUB". - :vartype sql_server_license_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.SqlServerLicenseType - :ivar linux_license_type: The license type for Linux VM's. Known values are: "NotSpecified", - "NoLicenseType", and "LinuxServer". - :vartype linux_license_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.LinuxLicenseType - :ivar target_vm_security_profile: The target VM security profile. - :vartype target_vm_security_profile: - ~azure.mgmt.recoveryservicessiterecovery.models.SecurityProfileProperties - :ivar target_vm_size: The target VM size. - :vartype target_vm_size: str - :ivar target_proximity_placement_group_id: The proximity placement group ARM Id. - :vartype target_proximity_placement_group_id: str - :ivar use_managed_disks_for_replication: A value indicating whether managed disks should be - used during replication. - :vartype use_managed_disks_for_replication: str - :ivar disk_type: The disk type. Known values are: "Standard_LRS", "Premium_LRS", - "StandardSSD_LRS", "PremiumV2_LRS", "UltraSSD_LRS", "StandardSSD_ZRS", and "Premium_ZRS". - :vartype disk_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.DiskAccountType - :ivar disks_to_include_for_managed_disks: The disks to include list for managed disks. - :vartype disks_to_include_for_managed_disks: - list[~azure.mgmt.recoveryservicessiterecovery.models.HyperVReplicaAzureDiskInputDetails] - :ivar disk_encryption_set_id: The DiskEncryptionSet ARM Id. - :vartype disk_encryption_set_id: str - :ivar target_vm_tags: The target VM tags. - :vartype target_vm_tags: dict[str, str] - :ivar seed_managed_disk_tags: The tags for the seed managed disks. - :vartype seed_managed_disk_tags: dict[str, str] - :ivar target_managed_disk_tags: The tags for the target managed disks. - :vartype target_managed_disk_tags: dict[str, str] - :ivar target_nic_tags: The tags for the target NICs. - :vartype target_nic_tags: dict[str, str] - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "hv_host_vm_id": {"key": "hvHostVmId", "type": "str"}, - "vm_name": {"key": "vmName", "type": "str"}, - "os_type": {"key": "osType", "type": "str"}, - "user_selected_os_name": {"key": "userSelectedOSName", "type": "str"}, - "vhd_id": {"key": "vhdId", "type": "str"}, - "target_storage_account_id": {"key": "targetStorageAccountId", "type": "str"}, - "target_azure_network_id": {"key": "targetAzureNetworkId", "type": "str"}, - "target_azure_subnet_id": {"key": "targetAzureSubnetId", "type": "str"}, - "enable_rdp_on_target_option": {"key": "enableRdpOnTargetOption", "type": "str"}, - "target_azure_vm_name": {"key": "targetAzureVmName", "type": "str"}, - "log_storage_account_id": {"key": "logStorageAccountId", "type": "str"}, - "disks_to_include": {"key": "disksToInclude", "type": "[str]"}, - "target_azure_v1_resource_group_id": {"key": "targetAzureV1ResourceGroupId", "type": "str"}, - "target_azure_v2_resource_group_id": {"key": "targetAzureV2ResourceGroupId", "type": "str"}, - "use_managed_disks": {"key": "useManagedDisks", "type": "str"}, - "target_availability_set_id": {"key": "targetAvailabilitySetId", "type": "str"}, - "target_availability_zone": {"key": "targetAvailabilityZone", "type": "str"}, - "license_type": {"key": "licenseType", "type": "str"}, - "sql_server_license_type": {"key": "sqlServerLicenseType", "type": "str"}, - "linux_license_type": {"key": "linuxLicenseType", "type": "str"}, - "target_vm_security_profile": {"key": "targetVmSecurityProfile", "type": "SecurityProfileProperties"}, - "target_vm_size": {"key": "targetVmSize", "type": "str"}, - "target_proximity_placement_group_id": {"key": "targetProximityPlacementGroupId", "type": "str"}, - "use_managed_disks_for_replication": {"key": "useManagedDisksForReplication", "type": "str"}, - "disk_type": {"key": "diskType", "type": "str"}, - "disks_to_include_for_managed_disks": { - "key": "disksToIncludeForManagedDisks", - "type": "[HyperVReplicaAzureDiskInputDetails]", - }, - "disk_encryption_set_id": {"key": "diskEncryptionSetId", "type": "str"}, - "target_vm_tags": {"key": "targetVmTags", "type": "{str}"}, - "seed_managed_disk_tags": {"key": "seedManagedDiskTags", "type": "{str}"}, - "target_managed_disk_tags": {"key": "targetManagedDiskTags", "type": "{str}"}, - "target_nic_tags": {"key": "targetNicTags", "type": "{str}"}, - } - - def __init__( # pylint: disable=too-many-locals - self, - *, - hv_host_vm_id: Optional[str] = None, - vm_name: Optional[str] = None, - os_type: Optional[str] = None, - user_selected_os_name: Optional[str] = None, - vhd_id: Optional[str] = None, - target_storage_account_id: Optional[str] = None, - target_azure_network_id: Optional[str] = None, - target_azure_subnet_id: Optional[str] = None, - enable_rdp_on_target_option: Optional[str] = None, - target_azure_vm_name: Optional[str] = None, - log_storage_account_id: Optional[str] = None, - disks_to_include: Optional[List[str]] = None, - target_azure_v1_resource_group_id: Optional[str] = None, - target_azure_v2_resource_group_id: Optional[str] = None, - use_managed_disks: Optional[str] = None, - target_availability_set_id: Optional[str] = None, - target_availability_zone: Optional[str] = None, - license_type: Optional[Union[str, "_models.LicenseType"]] = None, - sql_server_license_type: Optional[Union[str, "_models.SqlServerLicenseType"]] = None, - linux_license_type: Optional[Union[str, "_models.LinuxLicenseType"]] = None, - target_vm_security_profile: Optional["_models.SecurityProfileProperties"] = None, - target_vm_size: Optional[str] = None, - target_proximity_placement_group_id: Optional[str] = None, - use_managed_disks_for_replication: Optional[str] = None, - disk_type: Optional[Union[str, "_models.DiskAccountType"]] = None, - disks_to_include_for_managed_disks: Optional[List["_models.HyperVReplicaAzureDiskInputDetails"]] = None, - disk_encryption_set_id: Optional[str] = None, - target_vm_tags: Optional[Dict[str, str]] = None, - seed_managed_disk_tags: Optional[Dict[str, str]] = None, - target_managed_disk_tags: Optional[Dict[str, str]] = None, - target_nic_tags: Optional[Dict[str, str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword hv_host_vm_id: The Hyper-V host VM Id. - :paramtype hv_host_vm_id: str - :keyword vm_name: The VM Name. - :paramtype vm_name: str - :keyword os_type: The OS type associated with VM. - :paramtype os_type: str - :keyword user_selected_os_name: The OS name selected by user. - :paramtype user_selected_os_name: str - :keyword vhd_id: The OS disk VHD id associated with VM. - :paramtype vhd_id: str - :keyword target_storage_account_id: The storage account Id. - :paramtype target_storage_account_id: str - :keyword target_azure_network_id: The selected target Azure network Id. - :paramtype target_azure_network_id: str - :keyword target_azure_subnet_id: The selected target Azure subnet Id. - :paramtype target_azure_subnet_id: str - :keyword enable_rdp_on_target_option: The selected option to enable RDP\\SSH on target vm after - failover. String value of SrsDataContract.EnableRDPOnTargetOption enum. - :paramtype enable_rdp_on_target_option: str - :keyword target_azure_vm_name: The target azure VM Name. - :paramtype target_azure_vm_name: str - :keyword log_storage_account_id: The storage account to be used for logging during replication. - :paramtype log_storage_account_id: str - :keyword disks_to_include: The list of VHD Ids of disks to be protected. - :paramtype disks_to_include: list[str] - :keyword target_azure_v1_resource_group_id: The Id of the target resource group (for classic - deployment) in which the failover VM is to be created. - :paramtype target_azure_v1_resource_group_id: str - :keyword target_azure_v2_resource_group_id: The Id of the target resource group (for resource - manager deployment) in which the failover VM is to be created. - :paramtype target_azure_v2_resource_group_id: str - :keyword use_managed_disks: A value indicating whether managed disks should be used during - failover. - :paramtype use_managed_disks: str - :keyword target_availability_set_id: The target availability set ARM Id for resource manager - deployment. - :paramtype target_availability_set_id: str - :keyword target_availability_zone: The target availability zone. - :paramtype target_availability_zone: str - :keyword license_type: License type. Known values are: "NotSpecified", "NoLicenseType", and - "WindowsServer". - :paramtype license_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.LicenseType - :keyword sql_server_license_type: The SQL Server license type. Known values are: - "NotSpecified", "NoLicenseType", "PAYG", and "AHUB". - :paramtype sql_server_license_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.SqlServerLicenseType - :keyword linux_license_type: The license type for Linux VM's. Known values are: "NotSpecified", - "NoLicenseType", and "LinuxServer". - :paramtype linux_license_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.LinuxLicenseType - :keyword target_vm_security_profile: The target VM security profile. - :paramtype target_vm_security_profile: - ~azure.mgmt.recoveryservicessiterecovery.models.SecurityProfileProperties - :keyword target_vm_size: The target VM size. - :paramtype target_vm_size: str - :keyword target_proximity_placement_group_id: The proximity placement group ARM Id. - :paramtype target_proximity_placement_group_id: str - :keyword use_managed_disks_for_replication: A value indicating whether managed disks should be - used during replication. - :paramtype use_managed_disks_for_replication: str - :keyword disk_type: The disk type. Known values are: "Standard_LRS", "Premium_LRS", - "StandardSSD_LRS", "PremiumV2_LRS", "UltraSSD_LRS", "StandardSSD_ZRS", and "Premium_ZRS". - :paramtype disk_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.DiskAccountType - :keyword disks_to_include_for_managed_disks: The disks to include list for managed disks. - :paramtype disks_to_include_for_managed_disks: - list[~azure.mgmt.recoveryservicessiterecovery.models.HyperVReplicaAzureDiskInputDetails] - :keyword disk_encryption_set_id: The DiskEncryptionSet ARM Id. - :paramtype disk_encryption_set_id: str - :keyword target_vm_tags: The target VM tags. - :paramtype target_vm_tags: dict[str, str] - :keyword seed_managed_disk_tags: The tags for the seed managed disks. - :paramtype seed_managed_disk_tags: dict[str, str] - :keyword target_managed_disk_tags: The tags for the target managed disks. - :paramtype target_managed_disk_tags: dict[str, str] - :keyword target_nic_tags: The tags for the target NICs. - :paramtype target_nic_tags: dict[str, str] - """ - super().__init__(**kwargs) - self.instance_type: str = "HyperVReplicaAzure" - self.hv_host_vm_id = hv_host_vm_id - self.vm_name = vm_name - self.os_type = os_type - self.user_selected_os_name = user_selected_os_name - self.vhd_id = vhd_id - self.target_storage_account_id = target_storage_account_id - self.target_azure_network_id = target_azure_network_id - self.target_azure_subnet_id = target_azure_subnet_id - self.enable_rdp_on_target_option = enable_rdp_on_target_option - self.target_azure_vm_name = target_azure_vm_name - self.log_storage_account_id = log_storage_account_id - self.disks_to_include = disks_to_include - self.target_azure_v1_resource_group_id = target_azure_v1_resource_group_id - self.target_azure_v2_resource_group_id = target_azure_v2_resource_group_id - self.use_managed_disks = use_managed_disks - self.target_availability_set_id = target_availability_set_id - self.target_availability_zone = target_availability_zone - self.license_type = license_type - self.sql_server_license_type = sql_server_license_type - self.linux_license_type = linux_license_type - self.target_vm_security_profile = target_vm_security_profile - self.target_vm_size = target_vm_size - self.target_proximity_placement_group_id = target_proximity_placement_group_id - self.use_managed_disks_for_replication = use_managed_disks_for_replication - self.disk_type = disk_type - self.disks_to_include_for_managed_disks = disks_to_include_for_managed_disks - self.disk_encryption_set_id = disk_encryption_set_id - self.target_vm_tags = target_vm_tags - self.seed_managed_disk_tags = seed_managed_disk_tags - self.target_managed_disk_tags = target_managed_disk_tags - self.target_nic_tags = target_nic_tags - - -class HyperVReplicaAzureEventDetails(EventProviderSpecificDetails): - """Model class for event details of a HyperVReplica E2A event. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: Gets the class type. Overridden in derived classes. Required. - :vartype instance_type: str - :ivar container_name: The container friendly name. - :vartype container_name: str - :ivar fabric_name: The fabric friendly name. - :vartype fabric_name: str - :ivar remote_container_name: The remote container name. - :vartype remote_container_name: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "container_name": {"key": "containerName", "type": "str"}, - "fabric_name": {"key": "fabricName", "type": "str"}, - "remote_container_name": {"key": "remoteContainerName", "type": "str"}, - } - - def __init__( - self, - *, - container_name: Optional[str] = None, - fabric_name: Optional[str] = None, - remote_container_name: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword container_name: The container friendly name. - :paramtype container_name: str - :keyword fabric_name: The fabric friendly name. - :paramtype fabric_name: str - :keyword remote_container_name: The remote container name. - :paramtype remote_container_name: str - """ - super().__init__(**kwargs) - self.instance_type: str = "HyperVReplicaAzure" - self.container_name = container_name - self.fabric_name = fabric_name - self.remote_container_name = remote_container_name - - -class PlannedFailoverProviderSpecificFailoverInput(_serialization.Model): # pylint: disable=name-too-long - """Provider specific failover input. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - HyperVReplicaAzurePlannedFailoverProviderInput, HyperVReplicaAzureFailbackProviderInput, - InMageRcmFailbackPlannedFailoverProviderInput - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - } - - _subtype_map = { - "instance_type": { - "HyperVReplicaAzure": "HyperVReplicaAzurePlannedFailoverProviderInput", - "HyperVReplicaAzureFailback": "HyperVReplicaAzureFailbackProviderInput", - "InMageRcmFailback": "InMageRcmFailbackPlannedFailoverProviderInput", - } - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.instance_type: Optional[str] = None - - -class HyperVReplicaAzureFailbackProviderInput(PlannedFailoverProviderSpecificFailoverInput): - """HyperVReplicaAzureFailback specific planned failover input. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - :ivar data_sync_option: Data sync option. - :vartype data_sync_option: str - :ivar recovery_vm_creation_option: ALR options to create alternate recovery. - :vartype recovery_vm_creation_option: str - :ivar provider_id_for_alternate_recovery: Provider Id for alternate location. - :vartype provider_id_for_alternate_recovery: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "data_sync_option": {"key": "dataSyncOption", "type": "str"}, - "recovery_vm_creation_option": {"key": "recoveryVmCreationOption", "type": "str"}, - "provider_id_for_alternate_recovery": {"key": "providerIdForAlternateRecovery", "type": "str"}, - } - - def __init__( - self, - *, - data_sync_option: Optional[str] = None, - recovery_vm_creation_option: Optional[str] = None, - provider_id_for_alternate_recovery: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword data_sync_option: Data sync option. - :paramtype data_sync_option: str - :keyword recovery_vm_creation_option: ALR options to create alternate recovery. - :paramtype recovery_vm_creation_option: str - :keyword provider_id_for_alternate_recovery: Provider Id for alternate location. - :paramtype provider_id_for_alternate_recovery: str - """ - super().__init__(**kwargs) - self.instance_type: str = "HyperVReplicaAzureFailback" - self.data_sync_option = data_sync_option - self.recovery_vm_creation_option = recovery_vm_creation_option - self.provider_id_for_alternate_recovery = provider_id_for_alternate_recovery - - -class HyperVReplicaAzureManagedDiskDetails(_serialization.Model): - """Hyper-V Managed disk details. - - :ivar disk_id: The disk Id. - :vartype disk_id: str - :ivar seed_managed_disk_id: Seed managed disk Id. - :vartype seed_managed_disk_id: str - :ivar replica_disk_type: The replica disk type. - :vartype replica_disk_type: str - :ivar disk_encryption_set_id: The disk encryption set ARM Id. - :vartype disk_encryption_set_id: str - :ivar target_disk_account_type: The disk type. Known values are: "Standard_LRS", "Premium_LRS", - "StandardSSD_LRS", "PremiumV2_LRS", "UltraSSD_LRS", "StandardSSD_ZRS", and "Premium_ZRS". - :vartype target_disk_account_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.DiskAccountType - :ivar sector_size_in_bytes: The logical sector size (in bytes), 512 by default. - :vartype sector_size_in_bytes: int - """ - - _attribute_map = { - "disk_id": {"key": "diskId", "type": "str"}, - "seed_managed_disk_id": {"key": "seedManagedDiskId", "type": "str"}, - "replica_disk_type": {"key": "replicaDiskType", "type": "str"}, - "disk_encryption_set_id": {"key": "diskEncryptionSetId", "type": "str"}, - "target_disk_account_type": {"key": "targetDiskAccountType", "type": "str"}, - "sector_size_in_bytes": {"key": "sectorSizeInBytes", "type": "int"}, - } - - def __init__( - self, - *, - disk_id: Optional[str] = None, - seed_managed_disk_id: Optional[str] = None, - replica_disk_type: Optional[str] = None, - disk_encryption_set_id: Optional[str] = None, - target_disk_account_type: Optional[Union[str, "_models.DiskAccountType"]] = None, - sector_size_in_bytes: Optional[int] = None, - **kwargs: Any - ) -> None: - """ - :keyword disk_id: The disk Id. - :paramtype disk_id: str - :keyword seed_managed_disk_id: Seed managed disk Id. - :paramtype seed_managed_disk_id: str - :keyword replica_disk_type: The replica disk type. - :paramtype replica_disk_type: str - :keyword disk_encryption_set_id: The disk encryption set ARM Id. - :paramtype disk_encryption_set_id: str - :keyword target_disk_account_type: The disk type. Known values are: "Standard_LRS", - "Premium_LRS", "StandardSSD_LRS", "PremiumV2_LRS", "UltraSSD_LRS", "StandardSSD_ZRS", and - "Premium_ZRS". - :paramtype target_disk_account_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.DiskAccountType - :keyword sector_size_in_bytes: The logical sector size (in bytes), 512 by default. - :paramtype sector_size_in_bytes: int - """ - super().__init__(**kwargs) - self.disk_id = disk_id - self.seed_managed_disk_id = seed_managed_disk_id - self.replica_disk_type = replica_disk_type - self.disk_encryption_set_id = disk_encryption_set_id - self.target_disk_account_type = target_disk_account_type - self.sector_size_in_bytes = sector_size_in_bytes - - -class HyperVReplicaAzurePlannedFailoverProviderInput( - PlannedFailoverProviderSpecificFailoverInput -): # pylint: disable=name-too-long - """HyperVReplicaAzure specific planned failover input. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - :ivar primary_kek_certificate_pfx: Primary kek certificate pfx. - :vartype primary_kek_certificate_pfx: str - :ivar secondary_kek_certificate_pfx: Secondary kek certificate pfx. - :vartype secondary_kek_certificate_pfx: str - :ivar recovery_point_id: The recovery point id to be passed to failover to a particular - recovery point. In case of latest recovery point, null should be passed. - :vartype recovery_point_id: str - :ivar os_upgrade_version: A value indicating the inplace OS Upgrade version. - :vartype os_upgrade_version: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "primary_kek_certificate_pfx": {"key": "primaryKekCertificatePfx", "type": "str"}, - "secondary_kek_certificate_pfx": {"key": "secondaryKekCertificatePfx", "type": "str"}, - "recovery_point_id": {"key": "recoveryPointId", "type": "str"}, - "os_upgrade_version": {"key": "osUpgradeVersion", "type": "str"}, - } - - def __init__( - self, - *, - primary_kek_certificate_pfx: Optional[str] = None, - secondary_kek_certificate_pfx: Optional[str] = None, - recovery_point_id: Optional[str] = None, - os_upgrade_version: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword primary_kek_certificate_pfx: Primary kek certificate pfx. - :paramtype primary_kek_certificate_pfx: str - :keyword secondary_kek_certificate_pfx: Secondary kek certificate pfx. - :paramtype secondary_kek_certificate_pfx: str - :keyword recovery_point_id: The recovery point id to be passed to failover to a particular - recovery point. In case of latest recovery point, null should be passed. - :paramtype recovery_point_id: str - :keyword os_upgrade_version: A value indicating the inplace OS Upgrade version. - :paramtype os_upgrade_version: str - """ - super().__init__(**kwargs) - self.instance_type: str = "HyperVReplicaAzure" - self.primary_kek_certificate_pfx = primary_kek_certificate_pfx - self.secondary_kek_certificate_pfx = secondary_kek_certificate_pfx - self.recovery_point_id = recovery_point_id - self.os_upgrade_version = os_upgrade_version - - -class HyperVReplicaAzurePolicyDetails(PolicyProviderSpecificDetails): - """Hyper-V Replica Azure specific protection profile details. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: Gets the class type. Overridden in derived classes. Required. - :vartype instance_type: str - :ivar recovery_point_history_duration_in_hours: The duration (in hours) to which point the - recovery history needs to be maintained. - :vartype recovery_point_history_duration_in_hours: int - :ivar application_consistent_snapshot_frequency_in_hours: The interval (in hours) at which - Hyper-V Replica should create an application consistent snapshot within the VM. - :vartype application_consistent_snapshot_frequency_in_hours: int - :ivar replication_interval: The replication interval. - :vartype replication_interval: int - :ivar online_replication_start_time: The scheduled start time for the initial replication. If - this parameter is Null, the initial replication starts immediately. - :vartype online_replication_start_time: str - :ivar encryption: A value indicating whether encryption is enabled for virtual machines in this - cloud. - :vartype encryption: str - :ivar active_storage_account_id: The active storage account Id. - :vartype active_storage_account_id: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "recovery_point_history_duration_in_hours": {"key": "recoveryPointHistoryDurationInHours", "type": "int"}, - "application_consistent_snapshot_frequency_in_hours": { - "key": "applicationConsistentSnapshotFrequencyInHours", - "type": "int", - }, - "replication_interval": {"key": "replicationInterval", "type": "int"}, - "online_replication_start_time": {"key": "onlineReplicationStartTime", "type": "str"}, - "encryption": {"key": "encryption", "type": "str"}, - "active_storage_account_id": {"key": "activeStorageAccountId", "type": "str"}, - } - - def __init__( - self, - *, - recovery_point_history_duration_in_hours: Optional[int] = None, - application_consistent_snapshot_frequency_in_hours: Optional[int] = None, - replication_interval: Optional[int] = None, - online_replication_start_time: Optional[str] = None, - encryption: Optional[str] = None, - active_storage_account_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword recovery_point_history_duration_in_hours: The duration (in hours) to which point the - recovery history needs to be maintained. - :paramtype recovery_point_history_duration_in_hours: int - :keyword application_consistent_snapshot_frequency_in_hours: The interval (in hours) at which - Hyper-V Replica should create an application consistent snapshot within the VM. - :paramtype application_consistent_snapshot_frequency_in_hours: int - :keyword replication_interval: The replication interval. - :paramtype replication_interval: int - :keyword online_replication_start_time: The scheduled start time for the initial replication. - If this parameter is Null, the initial replication starts immediately. - :paramtype online_replication_start_time: str - :keyword encryption: A value indicating whether encryption is enabled for virtual machines in - this cloud. - :paramtype encryption: str - :keyword active_storage_account_id: The active storage account Id. - :paramtype active_storage_account_id: str - """ - super().__init__(**kwargs) - self.instance_type: str = "HyperVReplicaAzure" - self.recovery_point_history_duration_in_hours = recovery_point_history_duration_in_hours - self.application_consistent_snapshot_frequency_in_hours = application_consistent_snapshot_frequency_in_hours - self.replication_interval = replication_interval - self.online_replication_start_time = online_replication_start_time - self.encryption = encryption - self.active_storage_account_id = active_storage_account_id - - -class HyperVReplicaAzurePolicyInput(PolicyProviderSpecificInput): - """Hyper-V Replica Azure specific input for creating a protection profile. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - :ivar recovery_point_history_duration: The duration (in hours) to which point the recovery - history needs to be maintained. - :vartype recovery_point_history_duration: int - :ivar application_consistent_snapshot_frequency_in_hours: The interval (in hours) at which - Hyper-V Replica should create an application consistent snapshot within the VM. - :vartype application_consistent_snapshot_frequency_in_hours: int - :ivar replication_interval: The replication interval. - :vartype replication_interval: int - :ivar online_replication_start_time: The scheduled start time for the initial replication. If - this parameter is Null, the initial replication starts immediately. - :vartype online_replication_start_time: str - :ivar storage_accounts: The list of storage accounts to which the VMs in the primary cloud can - replicate to. - :vartype storage_accounts: list[str] - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "recovery_point_history_duration": {"key": "recoveryPointHistoryDuration", "type": "int"}, - "application_consistent_snapshot_frequency_in_hours": { - "key": "applicationConsistentSnapshotFrequencyInHours", - "type": "int", - }, - "replication_interval": {"key": "replicationInterval", "type": "int"}, - "online_replication_start_time": {"key": "onlineReplicationStartTime", "type": "str"}, - "storage_accounts": {"key": "storageAccounts", "type": "[str]"}, - } - - def __init__( - self, - *, - recovery_point_history_duration: Optional[int] = None, - application_consistent_snapshot_frequency_in_hours: Optional[int] = None, - replication_interval: Optional[int] = None, - online_replication_start_time: Optional[str] = None, - storage_accounts: Optional[List[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword recovery_point_history_duration: The duration (in hours) to which point the recovery - history needs to be maintained. - :paramtype recovery_point_history_duration: int - :keyword application_consistent_snapshot_frequency_in_hours: The interval (in hours) at which - Hyper-V Replica should create an application consistent snapshot within the VM. - :paramtype application_consistent_snapshot_frequency_in_hours: int - :keyword replication_interval: The replication interval. - :paramtype replication_interval: int - :keyword online_replication_start_time: The scheduled start time for the initial replication. - If this parameter is Null, the initial replication starts immediately. - :paramtype online_replication_start_time: str - :keyword storage_accounts: The list of storage accounts to which the VMs in the primary cloud - can replicate to. - :paramtype storage_accounts: list[str] - """ - super().__init__(**kwargs) - self.instance_type: str = "HyperVReplicaAzure" - self.recovery_point_history_duration = recovery_point_history_duration - self.application_consistent_snapshot_frequency_in_hours = application_consistent_snapshot_frequency_in_hours - self.replication_interval = replication_interval - self.online_replication_start_time = online_replication_start_time - self.storage_accounts = storage_accounts - - -class HyperVReplicaAzureReplicationDetails(ReplicationProviderSpecificSettings): - """Hyper V Replica Azure provider specific settings. - - 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 instance_type: Gets the Instance type. Required. - :vartype instance_type: str - :ivar azure_vm_disk_details: Azure VM Disk details. - :vartype azure_vm_disk_details: - list[~azure.mgmt.recoveryservicessiterecovery.models.AzureVmDiskDetails] - :ivar recovery_azure_vm_name: Recovery Azure given name. - :vartype recovery_azure_vm_name: str - :ivar recovery_azure_vm_size: The Recovery Azure VM size. - :vartype recovery_azure_vm_size: str - :ivar recovery_azure_storage_account: The recovery Azure storage account. - :vartype recovery_azure_storage_account: str - :ivar recovery_azure_log_storage_account_id: The ARM id of the log storage account used for - replication. This will be set to null if no log storage account was provided during enable - protection. - :vartype recovery_azure_log_storage_account_id: str - :ivar last_replicated_time: The Last replication time. - :vartype last_replicated_time: ~datetime.datetime - :ivar rpo_in_seconds: Last RPO value. - :vartype rpo_in_seconds: int - :ivar last_rpo_calculated_time: The last RPO calculated time. - :vartype last_rpo_calculated_time: ~datetime.datetime - :ivar vm_id: The virtual machine Id. - :vartype vm_id: str - :ivar vm_protection_state: The protection state for the vm. - :vartype vm_protection_state: str - :ivar vm_protection_state_description: The protection state description for the vm. - :vartype vm_protection_state_description: str - :ivar initial_replication_details: Initial replication details. - :vartype initial_replication_details: - ~azure.mgmt.recoveryservicessiterecovery.models.InitialReplicationDetails - :ivar vm_nics: The PE Network details. - :vartype vm_nics: list[~azure.mgmt.recoveryservicessiterecovery.models.VMNicDetails] - :ivar selected_recovery_azure_network_id: The selected recovery azure network Id. - :vartype selected_recovery_azure_network_id: str - :ivar selected_source_nic_id: The selected source nic Id which will be used as the primary nic - during failover. - :vartype selected_source_nic_id: str - :ivar encryption: The encryption info. - :vartype encryption: str - :ivar o_s_details: The operating system info. - :vartype o_s_details: ~azure.mgmt.recoveryservicessiterecovery.models.OSDetails - :ivar source_vm_ram_size_in_mb: The RAM size of the VM on the primary side. - :vartype source_vm_ram_size_in_mb: int - :ivar source_vm_cpu_count: The CPU count of the VM on the primary side. - :vartype source_vm_cpu_count: int - :ivar enable_rdp_on_target_option: The selected option to enable RDP\\SSH on target vm after - failover. String value of SrsDataContract.EnableRDPOnTargetOption enum. - :vartype enable_rdp_on_target_option: str - :ivar recovery_azure_resource_group_id: The target resource group Id. - :vartype recovery_azure_resource_group_id: str - :ivar recovery_availability_set_id: The recovery availability set Id. - :vartype recovery_availability_set_id: str - :ivar target_availability_zone: The target availability zone. - :vartype target_availability_zone: str - :ivar target_proximity_placement_group_id: The target proximity placement group Id. - :vartype target_proximity_placement_group_id: str - :ivar use_managed_disks: A value indicating whether managed disks should be used during - failover. - :vartype use_managed_disks: str - :ivar license_type: License Type of the VM to be used. - :vartype license_type: str - :ivar sql_server_license_type: The SQL Server license type. - :vartype sql_server_license_type: str - :ivar linux_license_type: The license type for Linux VM's. Known values are: "NotSpecified", - "NoLicenseType", and "LinuxServer". - :vartype linux_license_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.LinuxLicenseType - :ivar last_recovery_point_received: The last recovery point received time. - :vartype last_recovery_point_received: ~datetime.datetime - :ivar target_vm_tags: The target VM tags. - :vartype target_vm_tags: dict[str, str] - :ivar seed_managed_disk_tags: The tags for the seed managed disks. - :vartype seed_managed_disk_tags: dict[str, str] - :ivar target_managed_disk_tags: The tags for the target managed disks. - :vartype target_managed_disk_tags: dict[str, str] - :ivar target_nic_tags: The tags for the target NICs. - :vartype target_nic_tags: dict[str, str] - :ivar protected_managed_disks: The list of protected managed disks. - :vartype protected_managed_disks: - list[~azure.mgmt.recoveryservicessiterecovery.models.HyperVReplicaAzureManagedDiskDetails] - :ivar all_available_os_upgrade_configurations: A value indicating all available inplace OS - Upgrade configurations. - :vartype all_available_os_upgrade_configurations: - list[~azure.mgmt.recoveryservicessiterecovery.models.OSUpgradeSupportedVersions] - :ivar target_vm_security_profile: The target VM security profile. - :vartype target_vm_security_profile: - ~azure.mgmt.recoveryservicessiterecovery.models.SecurityProfileProperties - """ - - _validation = { - "instance_type": {"required": True}, - "last_recovery_point_received": {"readonly": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "azure_vm_disk_details": {"key": "azureVmDiskDetails", "type": "[AzureVmDiskDetails]"}, - "recovery_azure_vm_name": {"key": "recoveryAzureVmName", "type": "str"}, - "recovery_azure_vm_size": {"key": "recoveryAzureVMSize", "type": "str"}, - "recovery_azure_storage_account": {"key": "recoveryAzureStorageAccount", "type": "str"}, - "recovery_azure_log_storage_account_id": {"key": "recoveryAzureLogStorageAccountId", "type": "str"}, - "last_replicated_time": {"key": "lastReplicatedTime", "type": "iso-8601"}, - "rpo_in_seconds": {"key": "rpoInSeconds", "type": "int"}, - "last_rpo_calculated_time": {"key": "lastRpoCalculatedTime", "type": "iso-8601"}, - "vm_id": {"key": "vmId", "type": "str"}, - "vm_protection_state": {"key": "vmProtectionState", "type": "str"}, - "vm_protection_state_description": {"key": "vmProtectionStateDescription", "type": "str"}, - "initial_replication_details": {"key": "initialReplicationDetails", "type": "InitialReplicationDetails"}, - "vm_nics": {"key": "vmNics", "type": "[VMNicDetails]"}, - "selected_recovery_azure_network_id": {"key": "selectedRecoveryAzureNetworkId", "type": "str"}, - "selected_source_nic_id": {"key": "selectedSourceNicId", "type": "str"}, - "encryption": {"key": "encryption", "type": "str"}, - "o_s_details": {"key": "oSDetails", "type": "OSDetails"}, - "source_vm_ram_size_in_mb": {"key": "sourceVmRamSizeInMB", "type": "int"}, - "source_vm_cpu_count": {"key": "sourceVmCpuCount", "type": "int"}, - "enable_rdp_on_target_option": {"key": "enableRdpOnTargetOption", "type": "str"}, - "recovery_azure_resource_group_id": {"key": "recoveryAzureResourceGroupId", "type": "str"}, - "recovery_availability_set_id": {"key": "recoveryAvailabilitySetId", "type": "str"}, - "target_availability_zone": {"key": "targetAvailabilityZone", "type": "str"}, - "target_proximity_placement_group_id": {"key": "targetProximityPlacementGroupId", "type": "str"}, - "use_managed_disks": {"key": "useManagedDisks", "type": "str"}, - "license_type": {"key": "licenseType", "type": "str"}, - "sql_server_license_type": {"key": "sqlServerLicenseType", "type": "str"}, - "linux_license_type": {"key": "linuxLicenseType", "type": "str"}, - "last_recovery_point_received": {"key": "lastRecoveryPointReceived", "type": "iso-8601"}, - "target_vm_tags": {"key": "targetVmTags", "type": "{str}"}, - "seed_managed_disk_tags": {"key": "seedManagedDiskTags", "type": "{str}"}, - "target_managed_disk_tags": {"key": "targetManagedDiskTags", "type": "{str}"}, - "target_nic_tags": {"key": "targetNicTags", "type": "{str}"}, - "protected_managed_disks": {"key": "protectedManagedDisks", "type": "[HyperVReplicaAzureManagedDiskDetails]"}, - "all_available_os_upgrade_configurations": { - "key": "allAvailableOSUpgradeConfigurations", - "type": "[OSUpgradeSupportedVersions]", - }, - "target_vm_security_profile": {"key": "targetVmSecurityProfile", "type": "SecurityProfileProperties"}, - } - - def __init__( # pylint: disable=too-many-locals - self, - *, - azure_vm_disk_details: Optional[List["_models.AzureVmDiskDetails"]] = None, - recovery_azure_vm_name: Optional[str] = None, - recovery_azure_vm_size: Optional[str] = None, - recovery_azure_storage_account: Optional[str] = None, - recovery_azure_log_storage_account_id: Optional[str] = None, - last_replicated_time: Optional[datetime.datetime] = None, - rpo_in_seconds: Optional[int] = None, - last_rpo_calculated_time: Optional[datetime.datetime] = None, - vm_id: Optional[str] = None, - vm_protection_state: Optional[str] = None, - vm_protection_state_description: Optional[str] = None, - initial_replication_details: Optional["_models.InitialReplicationDetails"] = None, - vm_nics: Optional[List["_models.VMNicDetails"]] = None, - selected_recovery_azure_network_id: Optional[str] = None, - selected_source_nic_id: Optional[str] = None, - encryption: Optional[str] = None, - o_s_details: Optional["_models.OSDetails"] = None, - source_vm_ram_size_in_mb: Optional[int] = None, - source_vm_cpu_count: Optional[int] = None, - enable_rdp_on_target_option: Optional[str] = None, - recovery_azure_resource_group_id: Optional[str] = None, - recovery_availability_set_id: Optional[str] = None, - target_availability_zone: Optional[str] = None, - target_proximity_placement_group_id: Optional[str] = None, - use_managed_disks: Optional[str] = None, - license_type: Optional[str] = None, - sql_server_license_type: Optional[str] = None, - linux_license_type: Optional[Union[str, "_models.LinuxLicenseType"]] = None, - target_vm_tags: Optional[Dict[str, str]] = None, - seed_managed_disk_tags: Optional[Dict[str, str]] = None, - target_managed_disk_tags: Optional[Dict[str, str]] = None, - target_nic_tags: Optional[Dict[str, str]] = None, - protected_managed_disks: Optional[List["_models.HyperVReplicaAzureManagedDiskDetails"]] = None, - all_available_os_upgrade_configurations: Optional[List["_models.OSUpgradeSupportedVersions"]] = None, - target_vm_security_profile: Optional["_models.SecurityProfileProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword azure_vm_disk_details: Azure VM Disk details. - :paramtype azure_vm_disk_details: - list[~azure.mgmt.recoveryservicessiterecovery.models.AzureVmDiskDetails] - :keyword recovery_azure_vm_name: Recovery Azure given name. - :paramtype recovery_azure_vm_name: str - :keyword recovery_azure_vm_size: The Recovery Azure VM size. - :paramtype recovery_azure_vm_size: str - :keyword recovery_azure_storage_account: The recovery Azure storage account. - :paramtype recovery_azure_storage_account: str - :keyword recovery_azure_log_storage_account_id: The ARM id of the log storage account used for - replication. This will be set to null if no log storage account was provided during enable - protection. - :paramtype recovery_azure_log_storage_account_id: str - :keyword last_replicated_time: The Last replication time. - :paramtype last_replicated_time: ~datetime.datetime - :keyword rpo_in_seconds: Last RPO value. - :paramtype rpo_in_seconds: int - :keyword last_rpo_calculated_time: The last RPO calculated time. - :paramtype last_rpo_calculated_time: ~datetime.datetime - :keyword vm_id: The virtual machine Id. - :paramtype vm_id: str - :keyword vm_protection_state: The protection state for the vm. - :paramtype vm_protection_state: str - :keyword vm_protection_state_description: The protection state description for the vm. - :paramtype vm_protection_state_description: str - :keyword initial_replication_details: Initial replication details. - :paramtype initial_replication_details: - ~azure.mgmt.recoveryservicessiterecovery.models.InitialReplicationDetails - :keyword vm_nics: The PE Network details. - :paramtype vm_nics: list[~azure.mgmt.recoveryservicessiterecovery.models.VMNicDetails] - :keyword selected_recovery_azure_network_id: The selected recovery azure network Id. - :paramtype selected_recovery_azure_network_id: str - :keyword selected_source_nic_id: The selected source nic Id which will be used as the primary - nic during failover. - :paramtype selected_source_nic_id: str - :keyword encryption: The encryption info. - :paramtype encryption: str - :keyword o_s_details: The operating system info. - :paramtype o_s_details: ~azure.mgmt.recoveryservicessiterecovery.models.OSDetails - :keyword source_vm_ram_size_in_mb: The RAM size of the VM on the primary side. - :paramtype source_vm_ram_size_in_mb: int - :keyword source_vm_cpu_count: The CPU count of the VM on the primary side. - :paramtype source_vm_cpu_count: int - :keyword enable_rdp_on_target_option: The selected option to enable RDP\\SSH on target vm after - failover. String value of SrsDataContract.EnableRDPOnTargetOption enum. - :paramtype enable_rdp_on_target_option: str - :keyword recovery_azure_resource_group_id: The target resource group Id. - :paramtype recovery_azure_resource_group_id: str - :keyword recovery_availability_set_id: The recovery availability set Id. - :paramtype recovery_availability_set_id: str - :keyword target_availability_zone: The target availability zone. - :paramtype target_availability_zone: str - :keyword target_proximity_placement_group_id: The target proximity placement group Id. - :paramtype target_proximity_placement_group_id: str - :keyword use_managed_disks: A value indicating whether managed disks should be used during - failover. - :paramtype use_managed_disks: str - :keyword license_type: License Type of the VM to be used. - :paramtype license_type: str - :keyword sql_server_license_type: The SQL Server license type. - :paramtype sql_server_license_type: str - :keyword linux_license_type: The license type for Linux VM's. Known values are: "NotSpecified", - "NoLicenseType", and "LinuxServer". - :paramtype linux_license_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.LinuxLicenseType - :keyword target_vm_tags: The target VM tags. - :paramtype target_vm_tags: dict[str, str] - :keyword seed_managed_disk_tags: The tags for the seed managed disks. - :paramtype seed_managed_disk_tags: dict[str, str] - :keyword target_managed_disk_tags: The tags for the target managed disks. - :paramtype target_managed_disk_tags: dict[str, str] - :keyword target_nic_tags: The tags for the target NICs. - :paramtype target_nic_tags: dict[str, str] - :keyword protected_managed_disks: The list of protected managed disks. - :paramtype protected_managed_disks: - list[~azure.mgmt.recoveryservicessiterecovery.models.HyperVReplicaAzureManagedDiskDetails] - :keyword all_available_os_upgrade_configurations: A value indicating all available inplace OS - Upgrade configurations. - :paramtype all_available_os_upgrade_configurations: - list[~azure.mgmt.recoveryservicessiterecovery.models.OSUpgradeSupportedVersions] - :keyword target_vm_security_profile: The target VM security profile. - :paramtype target_vm_security_profile: - ~azure.mgmt.recoveryservicessiterecovery.models.SecurityProfileProperties - """ - super().__init__(**kwargs) - self.instance_type: str = "HyperVReplicaAzure" - self.azure_vm_disk_details = azure_vm_disk_details - self.recovery_azure_vm_name = recovery_azure_vm_name - self.recovery_azure_vm_size = recovery_azure_vm_size - self.recovery_azure_storage_account = recovery_azure_storage_account - self.recovery_azure_log_storage_account_id = recovery_azure_log_storage_account_id - self.last_replicated_time = last_replicated_time - self.rpo_in_seconds = rpo_in_seconds - self.last_rpo_calculated_time = last_rpo_calculated_time - self.vm_id = vm_id - self.vm_protection_state = vm_protection_state - self.vm_protection_state_description = vm_protection_state_description - self.initial_replication_details = initial_replication_details - self.vm_nics = vm_nics - self.selected_recovery_azure_network_id = selected_recovery_azure_network_id - self.selected_source_nic_id = selected_source_nic_id - self.encryption = encryption - self.o_s_details = o_s_details - self.source_vm_ram_size_in_mb = source_vm_ram_size_in_mb - self.source_vm_cpu_count = source_vm_cpu_count - self.enable_rdp_on_target_option = enable_rdp_on_target_option - self.recovery_azure_resource_group_id = recovery_azure_resource_group_id - self.recovery_availability_set_id = recovery_availability_set_id - self.target_availability_zone = target_availability_zone - self.target_proximity_placement_group_id = target_proximity_placement_group_id - self.use_managed_disks = use_managed_disks - self.license_type = license_type - self.sql_server_license_type = sql_server_license_type - self.linux_license_type = linux_license_type - self.last_recovery_point_received: Optional[datetime.datetime] = None - self.target_vm_tags = target_vm_tags - self.seed_managed_disk_tags = seed_managed_disk_tags - self.target_managed_disk_tags = target_managed_disk_tags - self.target_nic_tags = target_nic_tags - self.protected_managed_disks = protected_managed_disks - self.all_available_os_upgrade_configurations = all_available_os_upgrade_configurations - self.target_vm_security_profile = target_vm_security_profile - - -class HyperVReplicaAzureReprotectInput(ReverseReplicationProviderSpecificInput): - """Azure specific reprotect input. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - :ivar hv_host_vm_id: The Hyper-V host Vm Id. - :vartype hv_host_vm_id: str - :ivar vm_name: The Vm Name. - :vartype vm_name: str - :ivar os_type: The OS type associated with vm. - :vartype os_type: str - :ivar v_hd_id: The OS disk VHD id associated with vm. - :vartype v_hd_id: str - :ivar storage_account_id: The storage account name. - :vartype storage_account_id: str - :ivar log_storage_account_id: The storage account to be used for logging during replication. - :vartype log_storage_account_id: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "hv_host_vm_id": {"key": "hvHostVmId", "type": "str"}, - "vm_name": {"key": "vmName", "type": "str"}, - "os_type": {"key": "osType", "type": "str"}, - "v_hd_id": {"key": "vHDId", "type": "str"}, - "storage_account_id": {"key": "storageAccountId", "type": "str"}, - "log_storage_account_id": {"key": "logStorageAccountId", "type": "str"}, - } - - def __init__( - self, - *, - hv_host_vm_id: Optional[str] = None, - vm_name: Optional[str] = None, - os_type: Optional[str] = None, - v_hd_id: Optional[str] = None, - storage_account_id: Optional[str] = None, - log_storage_account_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword hv_host_vm_id: The Hyper-V host Vm Id. - :paramtype hv_host_vm_id: str - :keyword vm_name: The Vm Name. - :paramtype vm_name: str - :keyword os_type: The OS type associated with vm. - :paramtype os_type: str - :keyword v_hd_id: The OS disk VHD id associated with vm. - :paramtype v_hd_id: str - :keyword storage_account_id: The storage account name. - :paramtype storage_account_id: str - :keyword log_storage_account_id: The storage account to be used for logging during replication. - :paramtype log_storage_account_id: str - """ - super().__init__(**kwargs) - self.instance_type: str = "HyperVReplicaAzure" - self.hv_host_vm_id = hv_host_vm_id - self.vm_name = vm_name - self.os_type = os_type - self.v_hd_id = v_hd_id - self.storage_account_id = storage_account_id - self.log_storage_account_id = log_storage_account_id - - -class HyperVReplicaAzureTestFailoverInput(TestFailoverProviderSpecificInput): - """HvrA provider specific input for test failover. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - :ivar primary_kek_certificate_pfx: Primary kek certificate pfx. - :vartype primary_kek_certificate_pfx: str - :ivar secondary_kek_certificate_pfx: Secondary kek certificate pfx. - :vartype secondary_kek_certificate_pfx: str - :ivar recovery_point_id: The recovery point id to be passed to test failover to a particular - recovery point. In case of latest recovery point, null should be passed. - :vartype recovery_point_id: str - :ivar os_upgrade_version: A value indicating the inplace OS Upgrade version. - :vartype os_upgrade_version: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "primary_kek_certificate_pfx": {"key": "primaryKekCertificatePfx", "type": "str"}, - "secondary_kek_certificate_pfx": {"key": "secondaryKekCertificatePfx", "type": "str"}, - "recovery_point_id": {"key": "recoveryPointId", "type": "str"}, - "os_upgrade_version": {"key": "osUpgradeVersion", "type": "str"}, - } - - def __init__( - self, - *, - primary_kek_certificate_pfx: Optional[str] = None, - secondary_kek_certificate_pfx: Optional[str] = None, - recovery_point_id: Optional[str] = None, - os_upgrade_version: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword primary_kek_certificate_pfx: Primary kek certificate pfx. - :paramtype primary_kek_certificate_pfx: str - :keyword secondary_kek_certificate_pfx: Secondary kek certificate pfx. - :paramtype secondary_kek_certificate_pfx: str - :keyword recovery_point_id: The recovery point id to be passed to test failover to a particular - recovery point. In case of latest recovery point, null should be passed. - :paramtype recovery_point_id: str - :keyword os_upgrade_version: A value indicating the inplace OS Upgrade version. - :paramtype os_upgrade_version: str - """ - super().__init__(**kwargs) - self.instance_type: str = "HyperVReplicaAzure" - self.primary_kek_certificate_pfx = primary_kek_certificate_pfx - self.secondary_kek_certificate_pfx = secondary_kek_certificate_pfx - self.recovery_point_id = recovery_point_id - self.os_upgrade_version = os_upgrade_version - - -class HyperVReplicaAzureUnplannedFailoverInput(UnplannedFailoverProviderSpecificInput): - """HvrA provider specific input for unplanned failover. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - :ivar primary_kek_certificate_pfx: Primary kek certificate pfx. - :vartype primary_kek_certificate_pfx: str - :ivar secondary_kek_certificate_pfx: Secondary kek certificate pfx. - :vartype secondary_kek_certificate_pfx: str - :ivar recovery_point_id: The recovery point id to be passed to failover to a particular - recovery point. In case of latest recovery point, null should be passed. - :vartype recovery_point_id: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "primary_kek_certificate_pfx": {"key": "primaryKekCertificatePfx", "type": "str"}, - "secondary_kek_certificate_pfx": {"key": "secondaryKekCertificatePfx", "type": "str"}, - "recovery_point_id": {"key": "recoveryPointId", "type": "str"}, - } - - def __init__( - self, - *, - primary_kek_certificate_pfx: Optional[str] = None, - secondary_kek_certificate_pfx: Optional[str] = None, - recovery_point_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword primary_kek_certificate_pfx: Primary kek certificate pfx. - :paramtype primary_kek_certificate_pfx: str - :keyword secondary_kek_certificate_pfx: Secondary kek certificate pfx. - :paramtype secondary_kek_certificate_pfx: str - :keyword recovery_point_id: The recovery point id to be passed to failover to a particular - recovery point. In case of latest recovery point, null should be passed. - :paramtype recovery_point_id: str - """ - super().__init__(**kwargs) - self.instance_type: str = "HyperVReplicaAzure" - self.primary_kek_certificate_pfx = primary_kek_certificate_pfx - self.secondary_kek_certificate_pfx = secondary_kek_certificate_pfx - self.recovery_point_id = recovery_point_id - - -class HyperVReplicaAzureUpdateReplicationProtectedItemInput( - UpdateReplicationProtectedItemProviderInput -): # pylint: disable=name-too-long - """HyperV replica Azure input to update replication protected item. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - :ivar recovery_azure_v1_resource_group_id: The recovery Azure resource group Id for classic - deployment. - :vartype recovery_azure_v1_resource_group_id: str - :ivar recovery_azure_v2_resource_group_id: The recovery Azure resource group Id for resource - manager deployment. - :vartype recovery_azure_v2_resource_group_id: str - :ivar use_managed_disks: A value indicating whether managed disks should be used during - failover. - :vartype use_managed_disks: str - :ivar disk_id_to_disk_encryption_map: The dictionary of disk resource Id to disk encryption set - ARM Id. - :vartype disk_id_to_disk_encryption_map: dict[str, str] - :ivar target_proximity_placement_group_id: The target proximity placement group Id. - :vartype target_proximity_placement_group_id: str - :ivar target_availability_zone: The target availability zone. - :vartype target_availability_zone: str - :ivar target_vm_tags: The target VM tags. - :vartype target_vm_tags: dict[str, str] - :ivar target_managed_disk_tags: The tags for the target managed disks. - :vartype target_managed_disk_tags: dict[str, str] - :ivar target_nic_tags: The tags for the target NICs. - :vartype target_nic_tags: dict[str, str] - :ivar sql_server_license_type: The SQL Server license type. Known values are: "NotSpecified", - "NoLicenseType", "PAYG", and "AHUB". - :vartype sql_server_license_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.SqlServerLicenseType - :ivar linux_license_type: The license type for Linux VM's. Known values are: "NotSpecified", - "NoLicenseType", and "LinuxServer". - :vartype linux_license_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.LinuxLicenseType - :ivar user_selected_os_name: The OS name selected by user. - :vartype user_selected_os_name: str - :ivar vm_disks: The list of disk update properties. - :vartype vm_disks: list[~azure.mgmt.recoveryservicessiterecovery.models.UpdateDiskInput] - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "recovery_azure_v1_resource_group_id": {"key": "recoveryAzureV1ResourceGroupId", "type": "str"}, - "recovery_azure_v2_resource_group_id": {"key": "recoveryAzureV2ResourceGroupId", "type": "str"}, - "use_managed_disks": {"key": "useManagedDisks", "type": "str"}, - "disk_id_to_disk_encryption_map": {"key": "diskIdToDiskEncryptionMap", "type": "{str}"}, - "target_proximity_placement_group_id": {"key": "targetProximityPlacementGroupId", "type": "str"}, - "target_availability_zone": {"key": "targetAvailabilityZone", "type": "str"}, - "target_vm_tags": {"key": "targetVmTags", "type": "{str}"}, - "target_managed_disk_tags": {"key": "targetManagedDiskTags", "type": "{str}"}, - "target_nic_tags": {"key": "targetNicTags", "type": "{str}"}, - "sql_server_license_type": {"key": "sqlServerLicenseType", "type": "str"}, - "linux_license_type": {"key": "linuxLicenseType", "type": "str"}, - "user_selected_os_name": {"key": "userSelectedOSName", "type": "str"}, - "vm_disks": {"key": "vmDisks", "type": "[UpdateDiskInput]"}, - } - - def __init__( - self, - *, - recovery_azure_v1_resource_group_id: Optional[str] = None, - recovery_azure_v2_resource_group_id: Optional[str] = None, - use_managed_disks: Optional[str] = None, - disk_id_to_disk_encryption_map: Optional[Dict[str, str]] = None, - target_proximity_placement_group_id: Optional[str] = None, - target_availability_zone: Optional[str] = None, - target_vm_tags: Optional[Dict[str, str]] = None, - target_managed_disk_tags: Optional[Dict[str, str]] = None, - target_nic_tags: Optional[Dict[str, str]] = None, - sql_server_license_type: Optional[Union[str, "_models.SqlServerLicenseType"]] = None, - linux_license_type: Optional[Union[str, "_models.LinuxLicenseType"]] = None, - user_selected_os_name: Optional[str] = None, - vm_disks: Optional[List["_models.UpdateDiskInput"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword recovery_azure_v1_resource_group_id: The recovery Azure resource group Id for classic - deployment. - :paramtype recovery_azure_v1_resource_group_id: str - :keyword recovery_azure_v2_resource_group_id: The recovery Azure resource group Id for resource - manager deployment. - :paramtype recovery_azure_v2_resource_group_id: str - :keyword use_managed_disks: A value indicating whether managed disks should be used during - failover. - :paramtype use_managed_disks: str - :keyword disk_id_to_disk_encryption_map: The dictionary of disk resource Id to disk encryption - set ARM Id. - :paramtype disk_id_to_disk_encryption_map: dict[str, str] - :keyword target_proximity_placement_group_id: The target proximity placement group Id. - :paramtype target_proximity_placement_group_id: str - :keyword target_availability_zone: The target availability zone. - :paramtype target_availability_zone: str - :keyword target_vm_tags: The target VM tags. - :paramtype target_vm_tags: dict[str, str] - :keyword target_managed_disk_tags: The tags for the target managed disks. - :paramtype target_managed_disk_tags: dict[str, str] - :keyword target_nic_tags: The tags for the target NICs. - :paramtype target_nic_tags: dict[str, str] - :keyword sql_server_license_type: The SQL Server license type. Known values are: - "NotSpecified", "NoLicenseType", "PAYG", and "AHUB". - :paramtype sql_server_license_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.SqlServerLicenseType - :keyword linux_license_type: The license type for Linux VM's. Known values are: "NotSpecified", - "NoLicenseType", and "LinuxServer". - :paramtype linux_license_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.LinuxLicenseType - :keyword user_selected_os_name: The OS name selected by user. - :paramtype user_selected_os_name: str - :keyword vm_disks: The list of disk update properties. - :paramtype vm_disks: list[~azure.mgmt.recoveryservicessiterecovery.models.UpdateDiskInput] - """ - super().__init__(**kwargs) - self.instance_type: str = "HyperVReplicaAzure" - self.recovery_azure_v1_resource_group_id = recovery_azure_v1_resource_group_id - self.recovery_azure_v2_resource_group_id = recovery_azure_v2_resource_group_id - self.use_managed_disks = use_managed_disks - self.disk_id_to_disk_encryption_map = disk_id_to_disk_encryption_map - self.target_proximity_placement_group_id = target_proximity_placement_group_id - self.target_availability_zone = target_availability_zone - self.target_vm_tags = target_vm_tags - self.target_managed_disk_tags = target_managed_disk_tags - self.target_nic_tags = target_nic_tags - self.sql_server_license_type = sql_server_license_type - self.linux_license_type = linux_license_type - self.user_selected_os_name = user_selected_os_name - self.vm_disks = vm_disks - - -class HyperVReplicaBaseEventDetails(EventProviderSpecificDetails): - """Abstract model class for event details of a HyperVReplica E2E event. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: Gets the class type. Overridden in derived classes. Required. - :vartype instance_type: str - :ivar container_name: The container friendly name. - :vartype container_name: str - :ivar fabric_name: The fabric friendly name. - :vartype fabric_name: str - :ivar remote_container_name: The remote container name. - :vartype remote_container_name: str - :ivar remote_fabric_name: The remote fabric name. - :vartype remote_fabric_name: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "container_name": {"key": "containerName", "type": "str"}, - "fabric_name": {"key": "fabricName", "type": "str"}, - "remote_container_name": {"key": "remoteContainerName", "type": "str"}, - "remote_fabric_name": {"key": "remoteFabricName", "type": "str"}, - } - - def __init__( - self, - *, - container_name: Optional[str] = None, - fabric_name: Optional[str] = None, - remote_container_name: Optional[str] = None, - remote_fabric_name: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword container_name: The container friendly name. - :paramtype container_name: str - :keyword fabric_name: The fabric friendly name. - :paramtype fabric_name: str - :keyword remote_container_name: The remote container name. - :paramtype remote_container_name: str - :keyword remote_fabric_name: The remote fabric name. - :paramtype remote_fabric_name: str - """ - super().__init__(**kwargs) - self.instance_type: str = "HyperVReplicaBaseEventDetails" - self.container_name = container_name - self.fabric_name = fabric_name - self.remote_container_name = remote_container_name - self.remote_fabric_name = remote_fabric_name - - -class HyperVReplicaBasePolicyDetails(PolicyProviderSpecificDetails): - """Base class for HyperVReplica policy details. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: Gets the class type. Overridden in derived classes. Required. - :vartype instance_type: str - :ivar recovery_points: A value indicating the number of recovery points. - :vartype recovery_points: int - :ivar application_consistent_snapshot_frequency_in_hours: A value indicating the application - consistent frequency. - :vartype application_consistent_snapshot_frequency_in_hours: int - :ivar compression: A value indicating whether compression has to be enabled. - :vartype compression: str - :ivar initial_replication_method: A value indicating whether IR is online. - :vartype initial_replication_method: str - :ivar online_replication_start_time: A value indicating the online IR start time. - :vartype online_replication_start_time: str - :ivar offline_replication_import_path: A value indicating the offline IR import path. - :vartype offline_replication_import_path: str - :ivar offline_replication_export_path: A value indicating the offline IR export path. - :vartype offline_replication_export_path: str - :ivar replication_port: A value indicating the recovery HTTPS port. - :vartype replication_port: int - :ivar allowed_authentication_type: A value indicating the authentication type. - :vartype allowed_authentication_type: int - :ivar replica_deletion_option: A value indicating whether the VM has to be auto deleted. - Supported Values: String.Empty, None, OnRecoveryCloud. - :vartype replica_deletion_option: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "recovery_points": {"key": "recoveryPoints", "type": "int"}, - "application_consistent_snapshot_frequency_in_hours": { - "key": "applicationConsistentSnapshotFrequencyInHours", - "type": "int", - }, - "compression": {"key": "compression", "type": "str"}, - "initial_replication_method": {"key": "initialReplicationMethod", "type": "str"}, - "online_replication_start_time": {"key": "onlineReplicationStartTime", "type": "str"}, - "offline_replication_import_path": {"key": "offlineReplicationImportPath", "type": "str"}, - "offline_replication_export_path": {"key": "offlineReplicationExportPath", "type": "str"}, - "replication_port": {"key": "replicationPort", "type": "int"}, - "allowed_authentication_type": {"key": "allowedAuthenticationType", "type": "int"}, - "replica_deletion_option": {"key": "replicaDeletionOption", "type": "str"}, - } - - def __init__( - self, - *, - recovery_points: Optional[int] = None, - application_consistent_snapshot_frequency_in_hours: Optional[int] = None, - compression: Optional[str] = None, - initial_replication_method: Optional[str] = None, - online_replication_start_time: Optional[str] = None, - offline_replication_import_path: Optional[str] = None, - offline_replication_export_path: Optional[str] = None, - replication_port: Optional[int] = None, - allowed_authentication_type: Optional[int] = None, - replica_deletion_option: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword recovery_points: A value indicating the number of recovery points. - :paramtype recovery_points: int - :keyword application_consistent_snapshot_frequency_in_hours: A value indicating the application - consistent frequency. - :paramtype application_consistent_snapshot_frequency_in_hours: int - :keyword compression: A value indicating whether compression has to be enabled. - :paramtype compression: str - :keyword initial_replication_method: A value indicating whether IR is online. - :paramtype initial_replication_method: str - :keyword online_replication_start_time: A value indicating the online IR start time. - :paramtype online_replication_start_time: str - :keyword offline_replication_import_path: A value indicating the offline IR import path. - :paramtype offline_replication_import_path: str - :keyword offline_replication_export_path: A value indicating the offline IR export path. - :paramtype offline_replication_export_path: str - :keyword replication_port: A value indicating the recovery HTTPS port. - :paramtype replication_port: int - :keyword allowed_authentication_type: A value indicating the authentication type. - :paramtype allowed_authentication_type: int - :keyword replica_deletion_option: A value indicating whether the VM has to be auto deleted. - Supported Values: String.Empty, None, OnRecoveryCloud. - :paramtype replica_deletion_option: str - """ - super().__init__(**kwargs) - self.instance_type: str = "HyperVReplicaBasePolicyDetails" - self.recovery_points = recovery_points - self.application_consistent_snapshot_frequency_in_hours = application_consistent_snapshot_frequency_in_hours - self.compression = compression - self.initial_replication_method = initial_replication_method - self.online_replication_start_time = online_replication_start_time - self.offline_replication_import_path = offline_replication_import_path - self.offline_replication_export_path = offline_replication_export_path - self.replication_port = replication_port - self.allowed_authentication_type = allowed_authentication_type - self.replica_deletion_option = replica_deletion_option - - -class HyperVReplicaBaseReplicationDetails(ReplicationProviderSpecificSettings): - """Hyper V replica provider specific settings base class. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: Gets the Instance type. Required. - :vartype instance_type: str - :ivar last_replicated_time: The Last replication time. - :vartype last_replicated_time: ~datetime.datetime - :ivar vm_nics: The PE Network details. - :vartype vm_nics: list[~azure.mgmt.recoveryservicessiterecovery.models.VMNicDetails] - :ivar vm_id: The virtual machine Id. - :vartype vm_id: str - :ivar vm_protection_state: The protection state for the vm. - :vartype vm_protection_state: str - :ivar vm_protection_state_description: The protection state description for the vm. - :vartype vm_protection_state_description: str - :ivar initial_replication_details: Initial replication details. - :vartype initial_replication_details: - ~azure.mgmt.recoveryservicessiterecovery.models.InitialReplicationDetails - :ivar v_m_disk_details: VM disk details. - :vartype v_m_disk_details: list[~azure.mgmt.recoveryservicessiterecovery.models.DiskDetails] - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "last_replicated_time": {"key": "lastReplicatedTime", "type": "iso-8601"}, - "vm_nics": {"key": "vmNics", "type": "[VMNicDetails]"}, - "vm_id": {"key": "vmId", "type": "str"}, - "vm_protection_state": {"key": "vmProtectionState", "type": "str"}, - "vm_protection_state_description": {"key": "vmProtectionStateDescription", "type": "str"}, - "initial_replication_details": {"key": "initialReplicationDetails", "type": "InitialReplicationDetails"}, - "v_m_disk_details": {"key": "vMDiskDetails", "type": "[DiskDetails]"}, - } - - def __init__( - self, - *, - last_replicated_time: Optional[datetime.datetime] = None, - vm_nics: Optional[List["_models.VMNicDetails"]] = None, - vm_id: Optional[str] = None, - vm_protection_state: Optional[str] = None, - vm_protection_state_description: Optional[str] = None, - initial_replication_details: Optional["_models.InitialReplicationDetails"] = None, - v_m_disk_details: Optional[List["_models.DiskDetails"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword last_replicated_time: The Last replication time. - :paramtype last_replicated_time: ~datetime.datetime - :keyword vm_nics: The PE Network details. - :paramtype vm_nics: list[~azure.mgmt.recoveryservicessiterecovery.models.VMNicDetails] - :keyword vm_id: The virtual machine Id. - :paramtype vm_id: str - :keyword vm_protection_state: The protection state for the vm. - :paramtype vm_protection_state: str - :keyword vm_protection_state_description: The protection state description for the vm. - :paramtype vm_protection_state_description: str - :keyword initial_replication_details: Initial replication details. - :paramtype initial_replication_details: - ~azure.mgmt.recoveryservicessiterecovery.models.InitialReplicationDetails - :keyword v_m_disk_details: VM disk details. - :paramtype v_m_disk_details: list[~azure.mgmt.recoveryservicessiterecovery.models.DiskDetails] - """ - super().__init__(**kwargs) - self.instance_type: str = "HyperVReplicaBaseReplicationDetails" - self.last_replicated_time = last_replicated_time - self.vm_nics = vm_nics - self.vm_id = vm_id - self.vm_protection_state = vm_protection_state - self.vm_protection_state_description = vm_protection_state_description - self.initial_replication_details = initial_replication_details - self.v_m_disk_details = v_m_disk_details - - -class HyperVReplicaBluePolicyDetails(PolicyProviderSpecificDetails): - """Hyper-V Replica Blue specific protection profile details. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: Gets the class type. Overridden in derived classes. Required. - :vartype instance_type: str - :ivar replication_frequency_in_seconds: A value indicating the replication interval. - :vartype replication_frequency_in_seconds: int - :ivar recovery_points: A value indicating the number of recovery points. - :vartype recovery_points: int - :ivar application_consistent_snapshot_frequency_in_hours: A value indicating the application - consistent frequency. - :vartype application_consistent_snapshot_frequency_in_hours: int - :ivar compression: A value indicating whether compression has to be enabled. - :vartype compression: str - :ivar initial_replication_method: A value indicating whether IR is online. - :vartype initial_replication_method: str - :ivar online_replication_start_time: A value indicating the online IR start time. - :vartype online_replication_start_time: str - :ivar offline_replication_import_path: A value indicating the offline IR import path. - :vartype offline_replication_import_path: str - :ivar offline_replication_export_path: A value indicating the offline IR export path. - :vartype offline_replication_export_path: str - :ivar replication_port: A value indicating the recovery HTTPS port. - :vartype replication_port: int - :ivar allowed_authentication_type: A value indicating the authentication type. - :vartype allowed_authentication_type: int - :ivar replica_deletion_option: A value indicating whether the VM has to be auto deleted. - Supported Values: String.Empty, None, OnRecoveryCloud. - :vartype replica_deletion_option: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "replication_frequency_in_seconds": {"key": "replicationFrequencyInSeconds", "type": "int"}, - "recovery_points": {"key": "recoveryPoints", "type": "int"}, - "application_consistent_snapshot_frequency_in_hours": { - "key": "applicationConsistentSnapshotFrequencyInHours", - "type": "int", - }, - "compression": {"key": "compression", "type": "str"}, - "initial_replication_method": {"key": "initialReplicationMethod", "type": "str"}, - "online_replication_start_time": {"key": "onlineReplicationStartTime", "type": "str"}, - "offline_replication_import_path": {"key": "offlineReplicationImportPath", "type": "str"}, - "offline_replication_export_path": {"key": "offlineReplicationExportPath", "type": "str"}, - "replication_port": {"key": "replicationPort", "type": "int"}, - "allowed_authentication_type": {"key": "allowedAuthenticationType", "type": "int"}, - "replica_deletion_option": {"key": "replicaDeletionOption", "type": "str"}, - } - - def __init__( - self, - *, - replication_frequency_in_seconds: Optional[int] = None, - recovery_points: Optional[int] = None, - application_consistent_snapshot_frequency_in_hours: Optional[int] = None, - compression: Optional[str] = None, - initial_replication_method: Optional[str] = None, - online_replication_start_time: Optional[str] = None, - offline_replication_import_path: Optional[str] = None, - offline_replication_export_path: Optional[str] = None, - replication_port: Optional[int] = None, - allowed_authentication_type: Optional[int] = None, - replica_deletion_option: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword replication_frequency_in_seconds: A value indicating the replication interval. - :paramtype replication_frequency_in_seconds: int - :keyword recovery_points: A value indicating the number of recovery points. - :paramtype recovery_points: int - :keyword application_consistent_snapshot_frequency_in_hours: A value indicating the application - consistent frequency. - :paramtype application_consistent_snapshot_frequency_in_hours: int - :keyword compression: A value indicating whether compression has to be enabled. - :paramtype compression: str - :keyword initial_replication_method: A value indicating whether IR is online. - :paramtype initial_replication_method: str - :keyword online_replication_start_time: A value indicating the online IR start time. - :paramtype online_replication_start_time: str - :keyword offline_replication_import_path: A value indicating the offline IR import path. - :paramtype offline_replication_import_path: str - :keyword offline_replication_export_path: A value indicating the offline IR export path. - :paramtype offline_replication_export_path: str - :keyword replication_port: A value indicating the recovery HTTPS port. - :paramtype replication_port: int - :keyword allowed_authentication_type: A value indicating the authentication type. - :paramtype allowed_authentication_type: int - :keyword replica_deletion_option: A value indicating whether the VM has to be auto deleted. - Supported Values: String.Empty, None, OnRecoveryCloud. - :paramtype replica_deletion_option: str - """ - super().__init__(**kwargs) - self.instance_type: str = "HyperVReplica2012R2" - self.replication_frequency_in_seconds = replication_frequency_in_seconds - self.recovery_points = recovery_points - self.application_consistent_snapshot_frequency_in_hours = application_consistent_snapshot_frequency_in_hours - self.compression = compression - self.initial_replication_method = initial_replication_method - self.online_replication_start_time = online_replication_start_time - self.offline_replication_import_path = offline_replication_import_path - self.offline_replication_export_path = offline_replication_export_path - self.replication_port = replication_port - self.allowed_authentication_type = allowed_authentication_type - self.replica_deletion_option = replica_deletion_option - - -class HyperVReplicaPolicyInput(PolicyProviderSpecificInput): - """Hyper-V Replica specific policy Input. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - HyperVReplicaBluePolicyInput - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - :ivar recovery_points: A value indicating the number of recovery points. - :vartype recovery_points: int - :ivar application_consistent_snapshot_frequency_in_hours: A value indicating the application - consistent frequency. - :vartype application_consistent_snapshot_frequency_in_hours: int - :ivar compression: A value indicating whether compression has to be enabled. - :vartype compression: str - :ivar initial_replication_method: A value indicating whether IR is online. - :vartype initial_replication_method: str - :ivar online_replication_start_time: A value indicating the online IR start time. - :vartype online_replication_start_time: str - :ivar offline_replication_import_path: A value indicating the offline IR import path. - :vartype offline_replication_import_path: str - :ivar offline_replication_export_path: A value indicating the offline IR export path. - :vartype offline_replication_export_path: str - :ivar replication_port: A value indicating the recovery HTTPS port. - :vartype replication_port: int - :ivar allowed_authentication_type: A value indicating the authentication type. - :vartype allowed_authentication_type: int - :ivar replica_deletion: A value indicating whether the VM has to be auto deleted. - :vartype replica_deletion: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "recovery_points": {"key": "recoveryPoints", "type": "int"}, - "application_consistent_snapshot_frequency_in_hours": { - "key": "applicationConsistentSnapshotFrequencyInHours", - "type": "int", - }, - "compression": {"key": "compression", "type": "str"}, - "initial_replication_method": {"key": "initialReplicationMethod", "type": "str"}, - "online_replication_start_time": {"key": "onlineReplicationStartTime", "type": "str"}, - "offline_replication_import_path": {"key": "offlineReplicationImportPath", "type": "str"}, - "offline_replication_export_path": {"key": "offlineReplicationExportPath", "type": "str"}, - "replication_port": {"key": "replicationPort", "type": "int"}, - "allowed_authentication_type": {"key": "allowedAuthenticationType", "type": "int"}, - "replica_deletion": {"key": "replicaDeletion", "type": "str"}, - } - - _subtype_map = {"instance_type": {"HyperVReplica2012R2": "HyperVReplicaBluePolicyInput"}} - - def __init__( - self, - *, - recovery_points: Optional[int] = None, - application_consistent_snapshot_frequency_in_hours: Optional[int] = None, - compression: Optional[str] = None, - initial_replication_method: Optional[str] = None, - online_replication_start_time: Optional[str] = None, - offline_replication_import_path: Optional[str] = None, - offline_replication_export_path: Optional[str] = None, - replication_port: Optional[int] = None, - allowed_authentication_type: Optional[int] = None, - replica_deletion: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword recovery_points: A value indicating the number of recovery points. - :paramtype recovery_points: int - :keyword application_consistent_snapshot_frequency_in_hours: A value indicating the application - consistent frequency. - :paramtype application_consistent_snapshot_frequency_in_hours: int - :keyword compression: A value indicating whether compression has to be enabled. - :paramtype compression: str - :keyword initial_replication_method: A value indicating whether IR is online. - :paramtype initial_replication_method: str - :keyword online_replication_start_time: A value indicating the online IR start time. - :paramtype online_replication_start_time: str - :keyword offline_replication_import_path: A value indicating the offline IR import path. - :paramtype offline_replication_import_path: str - :keyword offline_replication_export_path: A value indicating the offline IR export path. - :paramtype offline_replication_export_path: str - :keyword replication_port: A value indicating the recovery HTTPS port. - :paramtype replication_port: int - :keyword allowed_authentication_type: A value indicating the authentication type. - :paramtype allowed_authentication_type: int - :keyword replica_deletion: A value indicating whether the VM has to be auto deleted. - :paramtype replica_deletion: str - """ - super().__init__(**kwargs) - self.instance_type: str = "HyperVReplica2012" - self.recovery_points = recovery_points - self.application_consistent_snapshot_frequency_in_hours = application_consistent_snapshot_frequency_in_hours - self.compression = compression - self.initial_replication_method = initial_replication_method - self.online_replication_start_time = online_replication_start_time - self.offline_replication_import_path = offline_replication_import_path - self.offline_replication_export_path = offline_replication_export_path - self.replication_port = replication_port - self.allowed_authentication_type = allowed_authentication_type - self.replica_deletion = replica_deletion - - -class HyperVReplicaBluePolicyInput(HyperVReplicaPolicyInput): - """HyperV Replica Blue policy input. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - :ivar recovery_points: A value indicating the number of recovery points. - :vartype recovery_points: int - :ivar application_consistent_snapshot_frequency_in_hours: A value indicating the application - consistent frequency. - :vartype application_consistent_snapshot_frequency_in_hours: int - :ivar compression: A value indicating whether compression has to be enabled. - :vartype compression: str - :ivar initial_replication_method: A value indicating whether IR is online. - :vartype initial_replication_method: str - :ivar online_replication_start_time: A value indicating the online IR start time. - :vartype online_replication_start_time: str - :ivar offline_replication_import_path: A value indicating the offline IR import path. - :vartype offline_replication_import_path: str - :ivar offline_replication_export_path: A value indicating the offline IR export path. - :vartype offline_replication_export_path: str - :ivar replication_port: A value indicating the recovery HTTPS port. - :vartype replication_port: int - :ivar allowed_authentication_type: A value indicating the authentication type. - :vartype allowed_authentication_type: int - :ivar replica_deletion: A value indicating whether the VM has to be auto deleted. - :vartype replica_deletion: str - :ivar replication_frequency_in_seconds: A value indicating the replication interval. - :vartype replication_frequency_in_seconds: int - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "recovery_points": {"key": "recoveryPoints", "type": "int"}, - "application_consistent_snapshot_frequency_in_hours": { - "key": "applicationConsistentSnapshotFrequencyInHours", - "type": "int", - }, - "compression": {"key": "compression", "type": "str"}, - "initial_replication_method": {"key": "initialReplicationMethod", "type": "str"}, - "online_replication_start_time": {"key": "onlineReplicationStartTime", "type": "str"}, - "offline_replication_import_path": {"key": "offlineReplicationImportPath", "type": "str"}, - "offline_replication_export_path": {"key": "offlineReplicationExportPath", "type": "str"}, - "replication_port": {"key": "replicationPort", "type": "int"}, - "allowed_authentication_type": {"key": "allowedAuthenticationType", "type": "int"}, - "replica_deletion": {"key": "replicaDeletion", "type": "str"}, - "replication_frequency_in_seconds": {"key": "replicationFrequencyInSeconds", "type": "int"}, - } - - def __init__( - self, - *, - recovery_points: Optional[int] = None, - application_consistent_snapshot_frequency_in_hours: Optional[int] = None, - compression: Optional[str] = None, - initial_replication_method: Optional[str] = None, - online_replication_start_time: Optional[str] = None, - offline_replication_import_path: Optional[str] = None, - offline_replication_export_path: Optional[str] = None, - replication_port: Optional[int] = None, - allowed_authentication_type: Optional[int] = None, - replica_deletion: Optional[str] = None, - replication_frequency_in_seconds: Optional[int] = None, - **kwargs: Any - ) -> None: - """ - :keyword recovery_points: A value indicating the number of recovery points. - :paramtype recovery_points: int - :keyword application_consistent_snapshot_frequency_in_hours: A value indicating the application - consistent frequency. - :paramtype application_consistent_snapshot_frequency_in_hours: int - :keyword compression: A value indicating whether compression has to be enabled. - :paramtype compression: str - :keyword initial_replication_method: A value indicating whether IR is online. - :paramtype initial_replication_method: str - :keyword online_replication_start_time: A value indicating the online IR start time. - :paramtype online_replication_start_time: str - :keyword offline_replication_import_path: A value indicating the offline IR import path. - :paramtype offline_replication_import_path: str - :keyword offline_replication_export_path: A value indicating the offline IR export path. - :paramtype offline_replication_export_path: str - :keyword replication_port: A value indicating the recovery HTTPS port. - :paramtype replication_port: int - :keyword allowed_authentication_type: A value indicating the authentication type. - :paramtype allowed_authentication_type: int - :keyword replica_deletion: A value indicating whether the VM has to be auto deleted. - :paramtype replica_deletion: str - :keyword replication_frequency_in_seconds: A value indicating the replication interval. - :paramtype replication_frequency_in_seconds: int - """ - super().__init__( - recovery_points=recovery_points, - application_consistent_snapshot_frequency_in_hours=application_consistent_snapshot_frequency_in_hours, - compression=compression, - initial_replication_method=initial_replication_method, - online_replication_start_time=online_replication_start_time, - offline_replication_import_path=offline_replication_import_path, - offline_replication_export_path=offline_replication_export_path, - replication_port=replication_port, - allowed_authentication_type=allowed_authentication_type, - replica_deletion=replica_deletion, - **kwargs - ) - self.instance_type: str = "HyperVReplica2012R2" - self.replication_frequency_in_seconds = replication_frequency_in_seconds - - -class HyperVReplicaBlueReplicationDetails(ReplicationProviderSpecificSettings): - """HyperV replica 2012 R2 (Blue) replication details. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: Gets the Instance type. Required. - :vartype instance_type: str - :ivar last_replicated_time: The Last replication time. - :vartype last_replicated_time: ~datetime.datetime - :ivar vm_nics: The PE Network details. - :vartype vm_nics: list[~azure.mgmt.recoveryservicessiterecovery.models.VMNicDetails] - :ivar vm_id: The virtual machine Id. - :vartype vm_id: str - :ivar vm_protection_state: The protection state for the vm. - :vartype vm_protection_state: str - :ivar vm_protection_state_description: The protection state description for the vm. - :vartype vm_protection_state_description: str - :ivar initial_replication_details: Initial replication details. - :vartype initial_replication_details: - ~azure.mgmt.recoveryservicessiterecovery.models.InitialReplicationDetails - :ivar v_m_disk_details: VM disk details. - :vartype v_m_disk_details: list[~azure.mgmt.recoveryservicessiterecovery.models.DiskDetails] - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "last_replicated_time": {"key": "lastReplicatedTime", "type": "iso-8601"}, - "vm_nics": {"key": "vmNics", "type": "[VMNicDetails]"}, - "vm_id": {"key": "vmId", "type": "str"}, - "vm_protection_state": {"key": "vmProtectionState", "type": "str"}, - "vm_protection_state_description": {"key": "vmProtectionStateDescription", "type": "str"}, - "initial_replication_details": {"key": "initialReplicationDetails", "type": "InitialReplicationDetails"}, - "v_m_disk_details": {"key": "vMDiskDetails", "type": "[DiskDetails]"}, - } - - def __init__( - self, - *, - last_replicated_time: Optional[datetime.datetime] = None, - vm_nics: Optional[List["_models.VMNicDetails"]] = None, - vm_id: Optional[str] = None, - vm_protection_state: Optional[str] = None, - vm_protection_state_description: Optional[str] = None, - initial_replication_details: Optional["_models.InitialReplicationDetails"] = None, - v_m_disk_details: Optional[List["_models.DiskDetails"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword last_replicated_time: The Last replication time. - :paramtype last_replicated_time: ~datetime.datetime - :keyword vm_nics: The PE Network details. - :paramtype vm_nics: list[~azure.mgmt.recoveryservicessiterecovery.models.VMNicDetails] - :keyword vm_id: The virtual machine Id. - :paramtype vm_id: str - :keyword vm_protection_state: The protection state for the vm. - :paramtype vm_protection_state: str - :keyword vm_protection_state_description: The protection state description for the vm. - :paramtype vm_protection_state_description: str - :keyword initial_replication_details: Initial replication details. - :paramtype initial_replication_details: - ~azure.mgmt.recoveryservicessiterecovery.models.InitialReplicationDetails - :keyword v_m_disk_details: VM disk details. - :paramtype v_m_disk_details: list[~azure.mgmt.recoveryservicessiterecovery.models.DiskDetails] - """ - super().__init__(**kwargs) - self.instance_type: str = "HyperVReplica2012R2" - self.last_replicated_time = last_replicated_time - self.vm_nics = vm_nics - self.vm_id = vm_id - self.vm_protection_state = vm_protection_state - self.vm_protection_state_description = vm_protection_state_description - self.initial_replication_details = initial_replication_details - self.v_m_disk_details = v_m_disk_details - - -class HyperVReplicaPolicyDetails(PolicyProviderSpecificDetails): - """Hyper-V Replica Blue specific protection profile details. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: Gets the class type. Overridden in derived classes. Required. - :vartype instance_type: str - :ivar recovery_points: A value indicating the number of recovery points. - :vartype recovery_points: int - :ivar application_consistent_snapshot_frequency_in_hours: A value indicating the application - consistent frequency. - :vartype application_consistent_snapshot_frequency_in_hours: int - :ivar compression: A value indicating whether compression has to be enabled. - :vartype compression: str - :ivar initial_replication_method: A value indicating whether IR is online. - :vartype initial_replication_method: str - :ivar online_replication_start_time: A value indicating the online IR start time. - :vartype online_replication_start_time: str - :ivar offline_replication_import_path: A value indicating the offline IR import path. - :vartype offline_replication_import_path: str - :ivar offline_replication_export_path: A value indicating the offline IR export path. - :vartype offline_replication_export_path: str - :ivar replication_port: A value indicating the recovery HTTPS port. - :vartype replication_port: int - :ivar allowed_authentication_type: A value indicating the authentication type. - :vartype allowed_authentication_type: int - :ivar replica_deletion_option: A value indicating whether the VM has to be auto deleted. - Supported Values: String.Empty, None, OnRecoveryCloud. - :vartype replica_deletion_option: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "recovery_points": {"key": "recoveryPoints", "type": "int"}, - "application_consistent_snapshot_frequency_in_hours": { - "key": "applicationConsistentSnapshotFrequencyInHours", - "type": "int", - }, - "compression": {"key": "compression", "type": "str"}, - "initial_replication_method": {"key": "initialReplicationMethod", "type": "str"}, - "online_replication_start_time": {"key": "onlineReplicationStartTime", "type": "str"}, - "offline_replication_import_path": {"key": "offlineReplicationImportPath", "type": "str"}, - "offline_replication_export_path": {"key": "offlineReplicationExportPath", "type": "str"}, - "replication_port": {"key": "replicationPort", "type": "int"}, - "allowed_authentication_type": {"key": "allowedAuthenticationType", "type": "int"}, - "replica_deletion_option": {"key": "replicaDeletionOption", "type": "str"}, - } - - def __init__( - self, - *, - recovery_points: Optional[int] = None, - application_consistent_snapshot_frequency_in_hours: Optional[int] = None, - compression: Optional[str] = None, - initial_replication_method: Optional[str] = None, - online_replication_start_time: Optional[str] = None, - offline_replication_import_path: Optional[str] = None, - offline_replication_export_path: Optional[str] = None, - replication_port: Optional[int] = None, - allowed_authentication_type: Optional[int] = None, - replica_deletion_option: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword recovery_points: A value indicating the number of recovery points. - :paramtype recovery_points: int - :keyword application_consistent_snapshot_frequency_in_hours: A value indicating the application - consistent frequency. - :paramtype application_consistent_snapshot_frequency_in_hours: int - :keyword compression: A value indicating whether compression has to be enabled. - :paramtype compression: str - :keyword initial_replication_method: A value indicating whether IR is online. - :paramtype initial_replication_method: str - :keyword online_replication_start_time: A value indicating the online IR start time. - :paramtype online_replication_start_time: str - :keyword offline_replication_import_path: A value indicating the offline IR import path. - :paramtype offline_replication_import_path: str - :keyword offline_replication_export_path: A value indicating the offline IR export path. - :paramtype offline_replication_export_path: str - :keyword replication_port: A value indicating the recovery HTTPS port. - :paramtype replication_port: int - :keyword allowed_authentication_type: A value indicating the authentication type. - :paramtype allowed_authentication_type: int - :keyword replica_deletion_option: A value indicating whether the VM has to be auto deleted. - Supported Values: String.Empty, None, OnRecoveryCloud. - :paramtype replica_deletion_option: str - """ - super().__init__(**kwargs) - self.instance_type: str = "HyperVReplica2012" - self.recovery_points = recovery_points - self.application_consistent_snapshot_frequency_in_hours = application_consistent_snapshot_frequency_in_hours - self.compression = compression - self.initial_replication_method = initial_replication_method - self.online_replication_start_time = online_replication_start_time - self.offline_replication_import_path = offline_replication_import_path - self.offline_replication_export_path = offline_replication_export_path - self.replication_port = replication_port - self.allowed_authentication_type = allowed_authentication_type - self.replica_deletion_option = replica_deletion_option - - -class HyperVReplicaReplicationDetails(ReplicationProviderSpecificSettings): - """HyperV replica 2012 replication details. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: Gets the Instance type. Required. - :vartype instance_type: str - :ivar last_replicated_time: The Last replication time. - :vartype last_replicated_time: ~datetime.datetime - :ivar vm_nics: The PE Network details. - :vartype vm_nics: list[~azure.mgmt.recoveryservicessiterecovery.models.VMNicDetails] - :ivar vm_id: The virtual machine Id. - :vartype vm_id: str - :ivar vm_protection_state: The protection state for the vm. - :vartype vm_protection_state: str - :ivar vm_protection_state_description: The protection state description for the vm. - :vartype vm_protection_state_description: str - :ivar initial_replication_details: Initial replication details. - :vartype initial_replication_details: - ~azure.mgmt.recoveryservicessiterecovery.models.InitialReplicationDetails - :ivar v_m_disk_details: VM disk details. - :vartype v_m_disk_details: list[~azure.mgmt.recoveryservicessiterecovery.models.DiskDetails] - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "last_replicated_time": {"key": "lastReplicatedTime", "type": "iso-8601"}, - "vm_nics": {"key": "vmNics", "type": "[VMNicDetails]"}, - "vm_id": {"key": "vmId", "type": "str"}, - "vm_protection_state": {"key": "vmProtectionState", "type": "str"}, - "vm_protection_state_description": {"key": "vmProtectionStateDescription", "type": "str"}, - "initial_replication_details": {"key": "initialReplicationDetails", "type": "InitialReplicationDetails"}, - "v_m_disk_details": {"key": "vMDiskDetails", "type": "[DiskDetails]"}, - } - - def __init__( - self, - *, - last_replicated_time: Optional[datetime.datetime] = None, - vm_nics: Optional[List["_models.VMNicDetails"]] = None, - vm_id: Optional[str] = None, - vm_protection_state: Optional[str] = None, - vm_protection_state_description: Optional[str] = None, - initial_replication_details: Optional["_models.InitialReplicationDetails"] = None, - v_m_disk_details: Optional[List["_models.DiskDetails"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword last_replicated_time: The Last replication time. - :paramtype last_replicated_time: ~datetime.datetime - :keyword vm_nics: The PE Network details. - :paramtype vm_nics: list[~azure.mgmt.recoveryservicessiterecovery.models.VMNicDetails] - :keyword vm_id: The virtual machine Id. - :paramtype vm_id: str - :keyword vm_protection_state: The protection state for the vm. - :paramtype vm_protection_state: str - :keyword vm_protection_state_description: The protection state description for the vm. - :paramtype vm_protection_state_description: str - :keyword initial_replication_details: Initial replication details. - :paramtype initial_replication_details: - ~azure.mgmt.recoveryservicessiterecovery.models.InitialReplicationDetails - :keyword v_m_disk_details: VM disk details. - :paramtype v_m_disk_details: list[~azure.mgmt.recoveryservicessiterecovery.models.DiskDetails] - """ - super().__init__(**kwargs) - self.instance_type: str = "HyperVReplica2012" - self.last_replicated_time = last_replicated_time - self.vm_nics = vm_nics - self.vm_id = vm_id - self.vm_protection_state = vm_protection_state - self.vm_protection_state_description = vm_protection_state_description - self.initial_replication_details = initial_replication_details - self.v_m_disk_details = v_m_disk_details - - -class HyperVSiteDetails(FabricSpecificDetails): - """HyperVSite fabric specific details. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: Gets the class type. Overridden in derived classes. Required. - :vartype instance_type: str - :ivar hyper_v_hosts: The list of Hyper-V hosts associated with the fabric. - :vartype hyper_v_hosts: list[~azure.mgmt.recoveryservicessiterecovery.models.HyperVHostDetails] - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "hyper_v_hosts": {"key": "hyperVHosts", "type": "[HyperVHostDetails]"}, - } - - def __init__(self, *, hyper_v_hosts: Optional[List["_models.HyperVHostDetails"]] = None, **kwargs: Any) -> None: - """ - :keyword hyper_v_hosts: The list of Hyper-V hosts associated with the fabric. - :paramtype hyper_v_hosts: - list[~azure.mgmt.recoveryservicessiterecovery.models.HyperVHostDetails] - """ - super().__init__(**kwargs) - self.instance_type: str = "HyperVSite" - self.hyper_v_hosts = hyper_v_hosts - - -class HyperVVirtualMachineDetails(ConfigurationSettings): - """Single Host fabric provider specific VM settings. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - VmmVirtualMachineDetails - - All required parameters must be populated in order to send to server. - - :ivar instance_type: Gets the class type. Overridden in derived classes. Required. - :vartype instance_type: str - :ivar source_item_id: The source id of the object. - :vartype source_item_id: str - :ivar generation: The id of the object in fabric. - :vartype generation: str - :ivar os_details: The Last replication time. - :vartype os_details: ~azure.mgmt.recoveryservicessiterecovery.models.OSDetails - :ivar disk_details: The Last successful failover time. - :vartype disk_details: list[~azure.mgmt.recoveryservicessiterecovery.models.DiskDetails] - :ivar has_physical_disk: A value indicating whether the VM has a physical disk attached. String - value of SrsDataContract.PresenceStatus enum. Known values are: "Unknown", "Present", and - "NotPresent". - :vartype has_physical_disk: str or - ~azure.mgmt.recoveryservicessiterecovery.models.PresenceStatus - :ivar has_fibre_channel_adapter: A value indicating whether the VM has a fibre channel adapter - attached. String value of SrsDataContract.PresenceStatus enum. Known values are: "Unknown", - "Present", and "NotPresent". - :vartype has_fibre_channel_adapter: str or - ~azure.mgmt.recoveryservicessiterecovery.models.PresenceStatus - :ivar has_shared_vhd: A value indicating whether the VM has a shared VHD attached. String value - of SrsDataContract.PresenceStatus enum. Known values are: "Unknown", "Present", and - "NotPresent". - :vartype has_shared_vhd: str or ~azure.mgmt.recoveryservicessiterecovery.models.PresenceStatus - :ivar hyper_v_host_id: The Id of the hyper-v host in fabric. - :vartype hyper_v_host_id: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "source_item_id": {"key": "sourceItemId", "type": "str"}, - "generation": {"key": "generation", "type": "str"}, - "os_details": {"key": "osDetails", "type": "OSDetails"}, - "disk_details": {"key": "diskDetails", "type": "[DiskDetails]"}, - "has_physical_disk": {"key": "hasPhysicalDisk", "type": "str"}, - "has_fibre_channel_adapter": {"key": "hasFibreChannelAdapter", "type": "str"}, - "has_shared_vhd": {"key": "hasSharedVhd", "type": "str"}, - "hyper_v_host_id": {"key": "hyperVHostId", "type": "str"}, - } - - _subtype_map = {"instance_type": {"VmmVirtualMachine": "VmmVirtualMachineDetails"}} - - def __init__( - self, - *, - source_item_id: Optional[str] = None, - generation: Optional[str] = None, - os_details: Optional["_models.OSDetails"] = None, - disk_details: Optional[List["_models.DiskDetails"]] = None, - has_physical_disk: Optional[Union[str, "_models.PresenceStatus"]] = None, - has_fibre_channel_adapter: Optional[Union[str, "_models.PresenceStatus"]] = None, - has_shared_vhd: Optional[Union[str, "_models.PresenceStatus"]] = None, - hyper_v_host_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword source_item_id: The source id of the object. - :paramtype source_item_id: str - :keyword generation: The id of the object in fabric. - :paramtype generation: str - :keyword os_details: The Last replication time. - :paramtype os_details: ~azure.mgmt.recoveryservicessiterecovery.models.OSDetails - :keyword disk_details: The Last successful failover time. - :paramtype disk_details: list[~azure.mgmt.recoveryservicessiterecovery.models.DiskDetails] - :keyword has_physical_disk: A value indicating whether the VM has a physical disk attached. - String value of SrsDataContract.PresenceStatus enum. Known values are: "Unknown", "Present", - and "NotPresent". - :paramtype has_physical_disk: str or - ~azure.mgmt.recoveryservicessiterecovery.models.PresenceStatus - :keyword has_fibre_channel_adapter: A value indicating whether the VM has a fibre channel - adapter attached. String value of SrsDataContract.PresenceStatus enum. Known values are: - "Unknown", "Present", and "NotPresent". - :paramtype has_fibre_channel_adapter: str or - ~azure.mgmt.recoveryservicessiterecovery.models.PresenceStatus - :keyword has_shared_vhd: A value indicating whether the VM has a shared VHD attached. String - value of SrsDataContract.PresenceStatus enum. Known values are: "Unknown", "Present", and - "NotPresent". - :paramtype has_shared_vhd: str or - ~azure.mgmt.recoveryservicessiterecovery.models.PresenceStatus - :keyword hyper_v_host_id: The Id of the hyper-v host in fabric. - :paramtype hyper_v_host_id: str - """ - super().__init__(**kwargs) - self.instance_type: str = "HyperVVirtualMachine" - self.source_item_id = source_item_id - self.generation = generation - self.os_details = os_details - self.disk_details = disk_details - self.has_physical_disk = has_physical_disk - self.has_fibre_channel_adapter = has_fibre_channel_adapter - self.has_shared_vhd = has_shared_vhd - self.hyper_v_host_id = hyper_v_host_id - - -class IdentityProviderDetails(_serialization.Model): - """Identity provider details. - - :ivar tenant_id: The tenant Id for the service principal with which the on-premise - management/data plane components would communicate with our Azure services. - :vartype tenant_id: str - :ivar application_id: The application/client Id for the service principal with which the - on-premise management/data plane components would communicate with our Azure services. - :vartype application_id: str - :ivar object_id: The object Id of the service principal with which the on-premise - management/data plane components would communicate with our Azure services. - :vartype object_id: str - :ivar audience: The intended Audience of the service principal with which the on-premise - management/data plane components would communicate with our Azure services. - :vartype audience: str - :ivar aad_authority: The base authority for Azure Active Directory authentication. - :vartype aad_authority: str - """ - - _attribute_map = { - "tenant_id": {"key": "tenantId", "type": "str"}, - "application_id": {"key": "applicationId", "type": "str"}, - "object_id": {"key": "objectId", "type": "str"}, - "audience": {"key": "audience", "type": "str"}, - "aad_authority": {"key": "aadAuthority", "type": "str"}, - } - - def __init__( - self, - *, - tenant_id: Optional[str] = None, - application_id: Optional[str] = None, - object_id: Optional[str] = None, - audience: Optional[str] = None, - aad_authority: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword tenant_id: The tenant Id for the service principal with which the on-premise - management/data plane components would communicate with our Azure services. - :paramtype tenant_id: str - :keyword application_id: The application/client Id for the service principal with which the - on-premise management/data plane components would communicate with our Azure services. - :paramtype application_id: str - :keyword object_id: The object Id of the service principal with which the on-premise - management/data plane components would communicate with our Azure services. - :paramtype object_id: str - :keyword audience: The intended Audience of the service principal with which the on-premise - management/data plane components would communicate with our Azure services. - :paramtype audience: str - :keyword aad_authority: The base authority for Azure Active Directory authentication. - :paramtype aad_authority: str - """ - super().__init__(**kwargs) - self.tenant_id = tenant_id - self.application_id = application_id - self.object_id = object_id - self.audience = audience - self.aad_authority = aad_authority - - -class IdentityProviderInput(_serialization.Model): - """Identity provider input. - - All required parameters must be populated in order to send to server. - - :ivar tenant_id: The tenant Id for the service principal with which the on-premise - management/data plane components would communicate with our Azure services. Required. - :vartype tenant_id: str - :ivar application_id: The application/client Id for the service principal with which the - on-premise management/data plane components would communicate with our Azure services. - Required. - :vartype application_id: str - :ivar object_id: The object Id of the service principal with which the on-premise - management/data plane components would communicate with our Azure services. Required. - :vartype object_id: str - :ivar audience: The intended Audience of the service principal with which the on-premise - management/data plane components would communicate with our Azure services. Required. - :vartype audience: str - :ivar aad_authority: The base authority for Azure Active Directory authentication. Required. - :vartype aad_authority: str - """ - - _validation = { - "tenant_id": {"required": True}, - "application_id": {"required": True}, - "object_id": {"required": True}, - "audience": {"required": True}, - "aad_authority": {"required": True}, - } - - _attribute_map = { - "tenant_id": {"key": "tenantId", "type": "str"}, - "application_id": {"key": "applicationId", "type": "str"}, - "object_id": {"key": "objectId", "type": "str"}, - "audience": {"key": "audience", "type": "str"}, - "aad_authority": {"key": "aadAuthority", "type": "str"}, - } - - def __init__( - self, *, tenant_id: str, application_id: str, object_id: str, audience: str, aad_authority: str, **kwargs: Any - ) -> None: - """ - :keyword tenant_id: The tenant Id for the service principal with which the on-premise - management/data plane components would communicate with our Azure services. Required. - :paramtype tenant_id: str - :keyword application_id: The application/client Id for the service principal with which the - on-premise management/data plane components would communicate with our Azure services. - Required. - :paramtype application_id: str - :keyword object_id: The object Id of the service principal with which the on-premise - management/data plane components would communicate with our Azure services. Required. - :paramtype object_id: str - :keyword audience: The intended Audience of the service principal with which the on-premise - management/data plane components would communicate with our Azure services. Required. - :paramtype audience: str - :keyword aad_authority: The base authority for Azure Active Directory authentication. Required. - :paramtype aad_authority: str - """ - super().__init__(**kwargs) - self.tenant_id = tenant_id - self.application_id = application_id - self.object_id = object_id - self.audience = audience - self.aad_authority = aad_authority - - -class InconsistentVmDetails(_serialization.Model): - """This class stores the monitoring details for consistency check of inconsistent Protected - Entity. - - :ivar vm_name: The Vm name. - :vartype vm_name: str - :ivar cloud_name: The Cloud name. - :vartype cloud_name: str - :ivar details: The list of details regarding state of the Protected Entity in SRS and On prem. - :vartype details: list[str] - :ivar error_ids: The list of error ids. - :vartype error_ids: list[str] - """ - - _attribute_map = { - "vm_name": {"key": "vmName", "type": "str"}, - "cloud_name": {"key": "cloudName", "type": "str"}, - "details": {"key": "details", "type": "[str]"}, - "error_ids": {"key": "errorIds", "type": "[str]"}, - } - - def __init__( - self, - *, - vm_name: Optional[str] = None, - cloud_name: Optional[str] = None, - details: Optional[List[str]] = None, - error_ids: Optional[List[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword vm_name: The Vm name. - :paramtype vm_name: str - :keyword cloud_name: The Cloud name. - :paramtype cloud_name: str - :keyword details: The list of details regarding state of the Protected Entity in SRS and On - prem. - :paramtype details: list[str] - :keyword error_ids: The list of error ids. - :paramtype error_ids: list[str] - """ - super().__init__(**kwargs) - self.vm_name = vm_name - self.cloud_name = cloud_name - self.details = details - self.error_ids = error_ids - - -class InitialReplicationDetails(_serialization.Model): - """Initial replication details. - - :ivar initial_replication_type: Initial replication type. - :vartype initial_replication_type: str - :ivar initial_replication_progress_percentage: The initial replication progress percentage. - :vartype initial_replication_progress_percentage: str - """ - - _attribute_map = { - "initial_replication_type": {"key": "initialReplicationType", "type": "str"}, - "initial_replication_progress_percentage": {"key": "initialReplicationProgressPercentage", "type": "str"}, - } - - def __init__( - self, - *, - initial_replication_type: Optional[str] = None, - initial_replication_progress_percentage: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword initial_replication_type: Initial replication type. - :paramtype initial_replication_type: str - :keyword initial_replication_progress_percentage: The initial replication progress percentage. - :paramtype initial_replication_progress_percentage: str - """ - super().__init__(**kwargs) - self.initial_replication_type = initial_replication_type - self.initial_replication_progress_percentage = initial_replication_progress_percentage - - -class InlineWorkflowTaskDetails(GroupTaskDetails): - """This class represents the inline workflow task details. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The type of task details. Required. - :vartype instance_type: str - :ivar child_tasks: The child tasks. - :vartype child_tasks: list[~azure.mgmt.recoveryservicessiterecovery.models.ASRTask] - :ivar workflow_ids: The list of child workflow ids. - :vartype workflow_ids: list[str] - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "child_tasks": {"key": "childTasks", "type": "[ASRTask]"}, - "workflow_ids": {"key": "workflowIds", "type": "[str]"}, - } - - def __init__( - self, - *, - child_tasks: Optional[List["_models.ASRTask"]] = None, - workflow_ids: Optional[List[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword child_tasks: The child tasks. - :paramtype child_tasks: list[~azure.mgmt.recoveryservicessiterecovery.models.ASRTask] - :keyword workflow_ids: The list of child workflow ids. - :paramtype workflow_ids: list[str] - """ - super().__init__(child_tasks=child_tasks, **kwargs) - self.instance_type: str = "InlineWorkflowTaskDetails" - self.workflow_ids = workflow_ids - - -class InMageAgentDetails(_serialization.Model): - """The details of the InMage agent. - - :ivar agent_version: The agent version. - :vartype agent_version: str - :ivar agent_update_status: A value indicating whether installed agent needs to be updated. - :vartype agent_update_status: str - :ivar post_update_reboot_status: A value indicating whether reboot is required after update is - applied. - :vartype post_update_reboot_status: str - :ivar agent_expiry_date: Agent expiry date. - :vartype agent_expiry_date: ~datetime.datetime - """ - - _attribute_map = { - "agent_version": {"key": "agentVersion", "type": "str"}, - "agent_update_status": {"key": "agentUpdateStatus", "type": "str"}, - "post_update_reboot_status": {"key": "postUpdateRebootStatus", "type": "str"}, - "agent_expiry_date": {"key": "agentExpiryDate", "type": "iso-8601"}, - } - - def __init__( - self, - *, - agent_version: Optional[str] = None, - agent_update_status: Optional[str] = None, - post_update_reboot_status: Optional[str] = None, - agent_expiry_date: Optional[datetime.datetime] = None, - **kwargs: Any - ) -> None: - """ - :keyword agent_version: The agent version. - :paramtype agent_version: str - :keyword agent_update_status: A value indicating whether installed agent needs to be updated. - :paramtype agent_update_status: str - :keyword post_update_reboot_status: A value indicating whether reboot is required after update - is applied. - :paramtype post_update_reboot_status: str - :keyword agent_expiry_date: Agent expiry date. - :paramtype agent_expiry_date: ~datetime.datetime - """ - super().__init__(**kwargs) - self.agent_version = agent_version - self.agent_update_status = agent_update_status - self.post_update_reboot_status = post_update_reboot_status - self.agent_expiry_date = agent_expiry_date - - -class InMageAzureV2ApplyRecoveryPointInput(ApplyRecoveryPointProviderSpecificInput): - """ApplyRecoveryPoint input specific to InMageAzureV2 provider. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.instance_type: str = "InMageAzureV2" - - -class InMageAzureV2DiskInputDetails(_serialization.Model): - """Disk input details. - - :ivar disk_id: The DiskId. - :vartype disk_id: str - :ivar log_storage_account_id: The LogStorageAccountId. - :vartype log_storage_account_id: str - :ivar disk_type: The disk type. Known values are: "Standard_LRS", "Premium_LRS", - "StandardSSD_LRS", "PremiumV2_LRS", "UltraSSD_LRS", "StandardSSD_ZRS", and "Premium_ZRS". - :vartype disk_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.DiskAccountType - :ivar disk_encryption_set_id: The DiskEncryptionSet ARM ID. - :vartype disk_encryption_set_id: str - """ - - _attribute_map = { - "disk_id": {"key": "diskId", "type": "str"}, - "log_storage_account_id": {"key": "logStorageAccountId", "type": "str"}, - "disk_type": {"key": "diskType", "type": "str"}, - "disk_encryption_set_id": {"key": "diskEncryptionSetId", "type": "str"}, - } - - def __init__( - self, - *, - disk_id: Optional[str] = None, - log_storage_account_id: Optional[str] = None, - disk_type: Optional[Union[str, "_models.DiskAccountType"]] = None, - disk_encryption_set_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword disk_id: The DiskId. - :paramtype disk_id: str - :keyword log_storage_account_id: The LogStorageAccountId. - :paramtype log_storage_account_id: str - :keyword disk_type: The disk type. Known values are: "Standard_LRS", "Premium_LRS", - "StandardSSD_LRS", "PremiumV2_LRS", "UltraSSD_LRS", "StandardSSD_ZRS", and "Premium_ZRS". - :paramtype disk_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.DiskAccountType - :keyword disk_encryption_set_id: The DiskEncryptionSet ARM ID. - :paramtype disk_encryption_set_id: str - """ - super().__init__(**kwargs) - self.disk_id = disk_id - self.log_storage_account_id = log_storage_account_id - self.disk_type = disk_type - self.disk_encryption_set_id = disk_encryption_set_id - - -class InMageAzureV2EnableProtectionInput(EnableProtectionProviderSpecificInput): - """VMware Azure specific enable protection input. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - :ivar master_target_id: The Master target Id. - :vartype master_target_id: str - :ivar process_server_id: The Process Server Id. - :vartype process_server_id: str - :ivar storage_account_id: The storage account Id. - :vartype storage_account_id: str - :ivar run_as_account_id: The CS account Id. - :vartype run_as_account_id: str - :ivar multi_vm_group_id: The multi VM group Id. - :vartype multi_vm_group_id: str - :ivar multi_vm_group_name: The multi VM group name. - :vartype multi_vm_group_name: str - :ivar disks_to_include: The disks to include list. - :vartype disks_to_include: - list[~azure.mgmt.recoveryservicessiterecovery.models.InMageAzureV2DiskInputDetails] - :ivar target_azure_network_id: The selected target Azure network Id. - :vartype target_azure_network_id: str - :ivar target_azure_subnet_id: The selected target Azure subnet Id. - :vartype target_azure_subnet_id: str - :ivar enable_rdp_on_target_option: The selected option to enable RDP\\SSH on target VM after - failover. String value of SrsDataContract.EnableRDPOnTargetOption enum. - :vartype enable_rdp_on_target_option: str - :ivar target_azure_vm_name: The target azure VM Name. - :vartype target_azure_vm_name: str - :ivar log_storage_account_id: The storage account to be used for logging during replication. - :vartype log_storage_account_id: str - :ivar target_azure_v1_resource_group_id: The Id of the target resource group (for classic - deployment) in which the failover VM is to be created. - :vartype target_azure_v1_resource_group_id: str - :ivar target_azure_v2_resource_group_id: The Id of the target resource group (for resource - manager deployment) in which the failover VM is to be created. - :vartype target_azure_v2_resource_group_id: str - :ivar disk_type: The disk type. Known values are: "Standard_LRS", "Premium_LRS", - "StandardSSD_LRS", "PremiumV2_LRS", "UltraSSD_LRS", "StandardSSD_ZRS", and "Premium_ZRS". - :vartype disk_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.DiskAccountType - :ivar target_availability_set_id: The target availability set ARM Id for resource manager - deployment. - :vartype target_availability_set_id: str - :ivar target_availability_zone: The target availability zone. - :vartype target_availability_zone: str - :ivar target_proximity_placement_group_id: The proximity placement group ARM Id. - :vartype target_proximity_placement_group_id: str - :ivar license_type: License type. Known values are: "NotSpecified", "NoLicenseType", and - "WindowsServer". - :vartype license_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.LicenseType - :ivar sql_server_license_type: The SQL Server license type. Known values are: "NotSpecified", - "NoLicenseType", "PAYG", and "AHUB". - :vartype sql_server_license_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.SqlServerLicenseType - :ivar target_vm_size: The target VM size. - :vartype target_vm_size: str - :ivar disk_encryption_set_id: The DiskEncryptionSet ARM Id. - :vartype disk_encryption_set_id: str - :ivar target_vm_tags: The target VM tags. - :vartype target_vm_tags: dict[str, str] - :ivar seed_managed_disk_tags: The tags for the seed managed disks. - :vartype seed_managed_disk_tags: dict[str, str] - :ivar target_managed_disk_tags: The tags for the target managed disks. - :vartype target_managed_disk_tags: dict[str, str] - :ivar target_nic_tags: The tags for the target NICs. - :vartype target_nic_tags: dict[str, str] - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "master_target_id": {"key": "masterTargetId", "type": "str"}, - "process_server_id": {"key": "processServerId", "type": "str"}, - "storage_account_id": {"key": "storageAccountId", "type": "str"}, - "run_as_account_id": {"key": "runAsAccountId", "type": "str"}, - "multi_vm_group_id": {"key": "multiVmGroupId", "type": "str"}, - "multi_vm_group_name": {"key": "multiVmGroupName", "type": "str"}, - "disks_to_include": {"key": "disksToInclude", "type": "[InMageAzureV2DiskInputDetails]"}, - "target_azure_network_id": {"key": "targetAzureNetworkId", "type": "str"}, - "target_azure_subnet_id": {"key": "targetAzureSubnetId", "type": "str"}, - "enable_rdp_on_target_option": {"key": "enableRdpOnTargetOption", "type": "str"}, - "target_azure_vm_name": {"key": "targetAzureVmName", "type": "str"}, - "log_storage_account_id": {"key": "logStorageAccountId", "type": "str"}, - "target_azure_v1_resource_group_id": {"key": "targetAzureV1ResourceGroupId", "type": "str"}, - "target_azure_v2_resource_group_id": {"key": "targetAzureV2ResourceGroupId", "type": "str"}, - "disk_type": {"key": "diskType", "type": "str"}, - "target_availability_set_id": {"key": "targetAvailabilitySetId", "type": "str"}, - "target_availability_zone": {"key": "targetAvailabilityZone", "type": "str"}, - "target_proximity_placement_group_id": {"key": "targetProximityPlacementGroupId", "type": "str"}, - "license_type": {"key": "licenseType", "type": "str"}, - "sql_server_license_type": {"key": "sqlServerLicenseType", "type": "str"}, - "target_vm_size": {"key": "targetVmSize", "type": "str"}, - "disk_encryption_set_id": {"key": "diskEncryptionSetId", "type": "str"}, - "target_vm_tags": {"key": "targetVmTags", "type": "{str}"}, - "seed_managed_disk_tags": {"key": "seedManagedDiskTags", "type": "{str}"}, - "target_managed_disk_tags": {"key": "targetManagedDiskTags", "type": "{str}"}, - "target_nic_tags": {"key": "targetNicTags", "type": "{str}"}, - } - - def __init__( # pylint: disable=too-many-locals - self, - *, - master_target_id: Optional[str] = None, - process_server_id: Optional[str] = None, - storage_account_id: Optional[str] = None, - run_as_account_id: Optional[str] = None, - multi_vm_group_id: Optional[str] = None, - multi_vm_group_name: Optional[str] = None, - disks_to_include: Optional[List["_models.InMageAzureV2DiskInputDetails"]] = None, - target_azure_network_id: Optional[str] = None, - target_azure_subnet_id: Optional[str] = None, - enable_rdp_on_target_option: Optional[str] = None, - target_azure_vm_name: Optional[str] = None, - log_storage_account_id: Optional[str] = None, - target_azure_v1_resource_group_id: Optional[str] = None, - target_azure_v2_resource_group_id: Optional[str] = None, - disk_type: Optional[Union[str, "_models.DiskAccountType"]] = None, - target_availability_set_id: Optional[str] = None, - target_availability_zone: Optional[str] = None, - target_proximity_placement_group_id: Optional[str] = None, - license_type: Optional[Union[str, "_models.LicenseType"]] = None, - sql_server_license_type: Optional[Union[str, "_models.SqlServerLicenseType"]] = None, - target_vm_size: Optional[str] = None, - disk_encryption_set_id: Optional[str] = None, - target_vm_tags: Optional[Dict[str, str]] = None, - seed_managed_disk_tags: Optional[Dict[str, str]] = None, - target_managed_disk_tags: Optional[Dict[str, str]] = None, - target_nic_tags: Optional[Dict[str, str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword master_target_id: The Master target Id. - :paramtype master_target_id: str - :keyword process_server_id: The Process Server Id. - :paramtype process_server_id: str - :keyword storage_account_id: The storage account Id. - :paramtype storage_account_id: str - :keyword run_as_account_id: The CS account Id. - :paramtype run_as_account_id: str - :keyword multi_vm_group_id: The multi VM group Id. - :paramtype multi_vm_group_id: str - :keyword multi_vm_group_name: The multi VM group name. - :paramtype multi_vm_group_name: str - :keyword disks_to_include: The disks to include list. - :paramtype disks_to_include: - list[~azure.mgmt.recoveryservicessiterecovery.models.InMageAzureV2DiskInputDetails] - :keyword target_azure_network_id: The selected target Azure network Id. - :paramtype target_azure_network_id: str - :keyword target_azure_subnet_id: The selected target Azure subnet Id. - :paramtype target_azure_subnet_id: str - :keyword enable_rdp_on_target_option: The selected option to enable RDP\\SSH on target VM after - failover. String value of SrsDataContract.EnableRDPOnTargetOption enum. - :paramtype enable_rdp_on_target_option: str - :keyword target_azure_vm_name: The target azure VM Name. - :paramtype target_azure_vm_name: str - :keyword log_storage_account_id: The storage account to be used for logging during replication. - :paramtype log_storage_account_id: str - :keyword target_azure_v1_resource_group_id: The Id of the target resource group (for classic - deployment) in which the failover VM is to be created. - :paramtype target_azure_v1_resource_group_id: str - :keyword target_azure_v2_resource_group_id: The Id of the target resource group (for resource - manager deployment) in which the failover VM is to be created. - :paramtype target_azure_v2_resource_group_id: str - :keyword disk_type: The disk type. Known values are: "Standard_LRS", "Premium_LRS", - "StandardSSD_LRS", "PremiumV2_LRS", "UltraSSD_LRS", "StandardSSD_ZRS", and "Premium_ZRS". - :paramtype disk_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.DiskAccountType - :keyword target_availability_set_id: The target availability set ARM Id for resource manager - deployment. - :paramtype target_availability_set_id: str - :keyword target_availability_zone: The target availability zone. - :paramtype target_availability_zone: str - :keyword target_proximity_placement_group_id: The proximity placement group ARM Id. - :paramtype target_proximity_placement_group_id: str - :keyword license_type: License type. Known values are: "NotSpecified", "NoLicenseType", and - "WindowsServer". - :paramtype license_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.LicenseType - :keyword sql_server_license_type: The SQL Server license type. Known values are: - "NotSpecified", "NoLicenseType", "PAYG", and "AHUB". - :paramtype sql_server_license_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.SqlServerLicenseType - :keyword target_vm_size: The target VM size. - :paramtype target_vm_size: str - :keyword disk_encryption_set_id: The DiskEncryptionSet ARM Id. - :paramtype disk_encryption_set_id: str - :keyword target_vm_tags: The target VM tags. - :paramtype target_vm_tags: dict[str, str] - :keyword seed_managed_disk_tags: The tags for the seed managed disks. - :paramtype seed_managed_disk_tags: dict[str, str] - :keyword target_managed_disk_tags: The tags for the target managed disks. - :paramtype target_managed_disk_tags: dict[str, str] - :keyword target_nic_tags: The tags for the target NICs. - :paramtype target_nic_tags: dict[str, str] - """ - super().__init__(**kwargs) - self.instance_type: str = "InMageAzureV2" - self.master_target_id = master_target_id - self.process_server_id = process_server_id - self.storage_account_id = storage_account_id - self.run_as_account_id = run_as_account_id - self.multi_vm_group_id = multi_vm_group_id - self.multi_vm_group_name = multi_vm_group_name - self.disks_to_include = disks_to_include - self.target_azure_network_id = target_azure_network_id - self.target_azure_subnet_id = target_azure_subnet_id - self.enable_rdp_on_target_option = enable_rdp_on_target_option - self.target_azure_vm_name = target_azure_vm_name - self.log_storage_account_id = log_storage_account_id - self.target_azure_v1_resource_group_id = target_azure_v1_resource_group_id - self.target_azure_v2_resource_group_id = target_azure_v2_resource_group_id - self.disk_type = disk_type - self.target_availability_set_id = target_availability_set_id - self.target_availability_zone = target_availability_zone - self.target_proximity_placement_group_id = target_proximity_placement_group_id - self.license_type = license_type - self.sql_server_license_type = sql_server_license_type - self.target_vm_size = target_vm_size - self.disk_encryption_set_id = disk_encryption_set_id - self.target_vm_tags = target_vm_tags - self.seed_managed_disk_tags = seed_managed_disk_tags - self.target_managed_disk_tags = target_managed_disk_tags - self.target_nic_tags = target_nic_tags - - -class InMageAzureV2EventDetails(EventProviderSpecificDetails): - """Model class for event details of a VMwareAzureV2 event. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: Gets the class type. Overridden in derived classes. Required. - :vartype instance_type: str - :ivar event_type: InMage Event type. Takes one of the values of - InMageDataContract.InMageMonitoringEventType. - :vartype event_type: str - :ivar category: InMage Event Category. - :vartype category: str - :ivar component: InMage Event Component. - :vartype component: str - :ivar corrective_action: Corrective Action string for the event. - :vartype corrective_action: str - :ivar details: InMage Event Details. - :vartype details: str - :ivar summary: InMage Event Summary. - :vartype summary: str - :ivar site_name: VMware Site name. - :vartype site_name: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "event_type": {"key": "eventType", "type": "str"}, - "category": {"key": "category", "type": "str"}, - "component": {"key": "component", "type": "str"}, - "corrective_action": {"key": "correctiveAction", "type": "str"}, - "details": {"key": "details", "type": "str"}, - "summary": {"key": "summary", "type": "str"}, - "site_name": {"key": "siteName", "type": "str"}, - } - - def __init__( - self, - *, - event_type: Optional[str] = None, - category: Optional[str] = None, - component: Optional[str] = None, - corrective_action: Optional[str] = None, - details: Optional[str] = None, - summary: Optional[str] = None, - site_name: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword event_type: InMage Event type. Takes one of the values of - InMageDataContract.InMageMonitoringEventType. - :paramtype event_type: str - :keyword category: InMage Event Category. - :paramtype category: str - :keyword component: InMage Event Component. - :paramtype component: str - :keyword corrective_action: Corrective Action string for the event. - :paramtype corrective_action: str - :keyword details: InMage Event Details. - :paramtype details: str - :keyword summary: InMage Event Summary. - :paramtype summary: str - :keyword site_name: VMware Site name. - :paramtype site_name: str - """ - super().__init__(**kwargs) - self.instance_type: str = "InMageAzureV2" - self.event_type = event_type - self.category = category - self.component = component - self.corrective_action = corrective_action - self.details = details - self.summary = summary - self.site_name = site_name - - -class InMageAzureV2ManagedDiskDetails(_serialization.Model): - """InMageAzureV2 Managed disk details. - - :ivar disk_id: The disk id. - :vartype disk_id: str - :ivar seed_managed_disk_id: Seed managed disk Id. - :vartype seed_managed_disk_id: str - :ivar replica_disk_type: The replica disk type. - :vartype replica_disk_type: str - :ivar disk_encryption_set_id: The DiskEncryptionSet ARM ID. - :vartype disk_encryption_set_id: str - :ivar target_disk_name: The target disk name. - :vartype target_disk_name: str - """ - - _attribute_map = { - "disk_id": {"key": "diskId", "type": "str"}, - "seed_managed_disk_id": {"key": "seedManagedDiskId", "type": "str"}, - "replica_disk_type": {"key": "replicaDiskType", "type": "str"}, - "disk_encryption_set_id": {"key": "diskEncryptionSetId", "type": "str"}, - "target_disk_name": {"key": "targetDiskName", "type": "str"}, - } - - def __init__( - self, - *, - disk_id: Optional[str] = None, - seed_managed_disk_id: Optional[str] = None, - replica_disk_type: Optional[str] = None, - disk_encryption_set_id: Optional[str] = None, - target_disk_name: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword disk_id: The disk id. - :paramtype disk_id: str - :keyword seed_managed_disk_id: Seed managed disk Id. - :paramtype seed_managed_disk_id: str - :keyword replica_disk_type: The replica disk type. - :paramtype replica_disk_type: str - :keyword disk_encryption_set_id: The DiskEncryptionSet ARM ID. - :paramtype disk_encryption_set_id: str - :keyword target_disk_name: The target disk name. - :paramtype target_disk_name: str - """ - super().__init__(**kwargs) - self.disk_id = disk_id - self.seed_managed_disk_id = seed_managed_disk_id - self.replica_disk_type = replica_disk_type - self.disk_encryption_set_id = disk_encryption_set_id - self.target_disk_name = target_disk_name - - -class InMageAzureV2PolicyDetails(PolicyProviderSpecificDetails): - """InMage Azure v2 specific protection profile details. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: Gets the class type. Overridden in derived classes. Required. - :vartype instance_type: str - :ivar crash_consistent_frequency_in_minutes: The crash consistent snapshot frequency in - minutes. - :vartype crash_consistent_frequency_in_minutes: int - :ivar recovery_point_threshold_in_minutes: The recovery point threshold in minutes. - :vartype recovery_point_threshold_in_minutes: int - :ivar recovery_point_history: The duration in minutes until which the recovery points need to - be stored. - :vartype recovery_point_history: int - :ivar app_consistent_frequency_in_minutes: The app consistent snapshot frequency in minutes. - :vartype app_consistent_frequency_in_minutes: int - :ivar multi_vm_sync_status: A value indicating whether multi-VM sync has to be enabled. - :vartype multi_vm_sync_status: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "crash_consistent_frequency_in_minutes": {"key": "crashConsistentFrequencyInMinutes", "type": "int"}, - "recovery_point_threshold_in_minutes": {"key": "recoveryPointThresholdInMinutes", "type": "int"}, - "recovery_point_history": {"key": "recoveryPointHistory", "type": "int"}, - "app_consistent_frequency_in_minutes": {"key": "appConsistentFrequencyInMinutes", "type": "int"}, - "multi_vm_sync_status": {"key": "multiVmSyncStatus", "type": "str"}, - } - - def __init__( - self, - *, - crash_consistent_frequency_in_minutes: Optional[int] = None, - recovery_point_threshold_in_minutes: Optional[int] = None, - recovery_point_history: Optional[int] = None, - app_consistent_frequency_in_minutes: Optional[int] = None, - multi_vm_sync_status: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword crash_consistent_frequency_in_minutes: The crash consistent snapshot frequency in - minutes. - :paramtype crash_consistent_frequency_in_minutes: int - :keyword recovery_point_threshold_in_minutes: The recovery point threshold in minutes. - :paramtype recovery_point_threshold_in_minutes: int - :keyword recovery_point_history: The duration in minutes until which the recovery points need - to be stored. - :paramtype recovery_point_history: int - :keyword app_consistent_frequency_in_minutes: The app consistent snapshot frequency in minutes. - :paramtype app_consistent_frequency_in_minutes: int - :keyword multi_vm_sync_status: A value indicating whether multi-VM sync has to be enabled. - :paramtype multi_vm_sync_status: str - """ - super().__init__(**kwargs) - self.instance_type: str = "InMageAzureV2" - self.crash_consistent_frequency_in_minutes = crash_consistent_frequency_in_minutes - self.recovery_point_threshold_in_minutes = recovery_point_threshold_in_minutes - self.recovery_point_history = recovery_point_history - self.app_consistent_frequency_in_minutes = app_consistent_frequency_in_minutes - self.multi_vm_sync_status = multi_vm_sync_status - - -class InMageAzureV2PolicyInput(PolicyProviderSpecificInput): - """VMWare Azure specific policy Input. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - :ivar recovery_point_threshold_in_minutes: The recovery point threshold in minutes. - :vartype recovery_point_threshold_in_minutes: int - :ivar recovery_point_history: The duration in minutes until which the recovery points need to - be stored. - :vartype recovery_point_history: int - :ivar crash_consistent_frequency_in_minutes: The crash consistent snapshot frequency (in - minutes). - :vartype crash_consistent_frequency_in_minutes: int - :ivar app_consistent_frequency_in_minutes: The app consistent snapshot frequency (in minutes). - :vartype app_consistent_frequency_in_minutes: int - :ivar multi_vm_sync_status: A value indicating whether multi-VM sync has to be enabled. Value - should be 'Enabled' or 'Disabled'. Required. Known values are: "Enable" and "Disable". - :vartype multi_vm_sync_status: str or - ~azure.mgmt.recoveryservicessiterecovery.models.SetMultiVmSyncStatus - """ - - _validation = { - "instance_type": {"required": True}, - "multi_vm_sync_status": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "recovery_point_threshold_in_minutes": {"key": "recoveryPointThresholdInMinutes", "type": "int"}, - "recovery_point_history": {"key": "recoveryPointHistory", "type": "int"}, - "crash_consistent_frequency_in_minutes": {"key": "crashConsistentFrequencyInMinutes", "type": "int"}, - "app_consistent_frequency_in_minutes": {"key": "appConsistentFrequencyInMinutes", "type": "int"}, - "multi_vm_sync_status": {"key": "multiVmSyncStatus", "type": "str"}, - } - - def __init__( - self, - *, - multi_vm_sync_status: Union[str, "_models.SetMultiVmSyncStatus"], - recovery_point_threshold_in_minutes: Optional[int] = None, - recovery_point_history: Optional[int] = None, - crash_consistent_frequency_in_minutes: Optional[int] = None, - app_consistent_frequency_in_minutes: Optional[int] = None, - **kwargs: Any - ) -> None: - """ - :keyword recovery_point_threshold_in_minutes: The recovery point threshold in minutes. - :paramtype recovery_point_threshold_in_minutes: int - :keyword recovery_point_history: The duration in minutes until which the recovery points need - to be stored. - :paramtype recovery_point_history: int - :keyword crash_consistent_frequency_in_minutes: The crash consistent snapshot frequency (in - minutes). - :paramtype crash_consistent_frequency_in_minutes: int - :keyword app_consistent_frequency_in_minutes: The app consistent snapshot frequency (in - minutes). - :paramtype app_consistent_frequency_in_minutes: int - :keyword multi_vm_sync_status: A value indicating whether multi-VM sync has to be enabled. - Value should be 'Enabled' or 'Disabled'. Required. Known values are: "Enable" and "Disable". - :paramtype multi_vm_sync_status: str or - ~azure.mgmt.recoveryservicessiterecovery.models.SetMultiVmSyncStatus - """ - super().__init__(**kwargs) - self.instance_type: str = "InMageAzureV2" - self.recovery_point_threshold_in_minutes = recovery_point_threshold_in_minutes - self.recovery_point_history = recovery_point_history - self.crash_consistent_frequency_in_minutes = crash_consistent_frequency_in_minutes - self.app_consistent_frequency_in_minutes = app_consistent_frequency_in_minutes - self.multi_vm_sync_status = multi_vm_sync_status - - -class InMageAzureV2ProtectedDiskDetails(_serialization.Model): - """InMageAzureV2 protected disk details. - - :ivar disk_id: The disk id. - :vartype disk_id: str - :ivar disk_name: The disk name. - :vartype disk_name: str - :ivar protection_stage: The protection stage. - :vartype protection_stage: str - :ivar health_error_code: The health error code for the disk. - :vartype health_error_code: str - :ivar rpo_in_seconds: The RPO in seconds. - :vartype rpo_in_seconds: int - :ivar resync_required: A value indicating whether resync is required for this disk. - :vartype resync_required: str - :ivar resync_progress_percentage: The resync progress percentage. - :vartype resync_progress_percentage: int - :ivar resync_duration_in_seconds: The resync duration in seconds. - :vartype resync_duration_in_seconds: int - :ivar disk_capacity_in_bytes: The disk capacity in bytes. - :vartype disk_capacity_in_bytes: int - :ivar file_system_capacity_in_bytes: The disk file system capacity in bytes. - :vartype file_system_capacity_in_bytes: int - :ivar source_data_in_mega_bytes: The source data transit in MB. - :vartype source_data_in_mega_bytes: float - :ivar ps_data_in_mega_bytes: The PS data transit in MB. - :vartype ps_data_in_mega_bytes: float - :ivar target_data_in_mega_bytes: The target data transit in MB. - :vartype target_data_in_mega_bytes: float - :ivar disk_resized: A value indicating whether disk is resized. - :vartype disk_resized: str - :ivar last_rpo_calculated_time: The last RPO calculated time. - :vartype last_rpo_calculated_time: ~datetime.datetime - :ivar resync_processed_bytes: The resync processed bytes. - :vartype resync_processed_bytes: int - :ivar resync_total_transferred_bytes: The resync total transferred bytes. - :vartype resync_total_transferred_bytes: int - :ivar resync_last15_minutes_transferred_bytes: The resync last 15 minutes transferred bytes. - :vartype resync_last15_minutes_transferred_bytes: int - :ivar resync_last_data_transfer_time_utc: The last data transfer time in UTC. - :vartype resync_last_data_transfer_time_utc: ~datetime.datetime - :ivar resync_start_time: The resync start time. - :vartype resync_start_time: ~datetime.datetime - :ivar progress_health: The Progress Health. - :vartype progress_health: str - :ivar progress_status: The Progress Status. - :vartype progress_status: str - :ivar seconds_to_take_switch_provider: The seconds to take for switch provider. - :vartype seconds_to_take_switch_provider: int - """ - - _attribute_map = { - "disk_id": {"key": "diskId", "type": "str"}, - "disk_name": {"key": "diskName", "type": "str"}, - "protection_stage": {"key": "protectionStage", "type": "str"}, - "health_error_code": {"key": "healthErrorCode", "type": "str"}, - "rpo_in_seconds": {"key": "rpoInSeconds", "type": "int"}, - "resync_required": {"key": "resyncRequired", "type": "str"}, - "resync_progress_percentage": {"key": "resyncProgressPercentage", "type": "int"}, - "resync_duration_in_seconds": {"key": "resyncDurationInSeconds", "type": "int"}, - "disk_capacity_in_bytes": {"key": "diskCapacityInBytes", "type": "int"}, - "file_system_capacity_in_bytes": {"key": "fileSystemCapacityInBytes", "type": "int"}, - "source_data_in_mega_bytes": {"key": "sourceDataInMegaBytes", "type": "float"}, - "ps_data_in_mega_bytes": {"key": "psDataInMegaBytes", "type": "float"}, - "target_data_in_mega_bytes": {"key": "targetDataInMegaBytes", "type": "float"}, - "disk_resized": {"key": "diskResized", "type": "str"}, - "last_rpo_calculated_time": {"key": "lastRpoCalculatedTime", "type": "iso-8601"}, - "resync_processed_bytes": {"key": "resyncProcessedBytes", "type": "int"}, - "resync_total_transferred_bytes": {"key": "resyncTotalTransferredBytes", "type": "int"}, - "resync_last15_minutes_transferred_bytes": {"key": "resyncLast15MinutesTransferredBytes", "type": "int"}, - "resync_last_data_transfer_time_utc": {"key": "resyncLastDataTransferTimeUTC", "type": "iso-8601"}, - "resync_start_time": {"key": "resyncStartTime", "type": "iso-8601"}, - "progress_health": {"key": "progressHealth", "type": "str"}, - "progress_status": {"key": "progressStatus", "type": "str"}, - "seconds_to_take_switch_provider": {"key": "secondsToTakeSwitchProvider", "type": "int"}, - } - - def __init__( - self, - *, - disk_id: Optional[str] = None, - disk_name: Optional[str] = None, - protection_stage: Optional[str] = None, - health_error_code: Optional[str] = None, - rpo_in_seconds: Optional[int] = None, - resync_required: Optional[str] = None, - resync_progress_percentage: Optional[int] = None, - resync_duration_in_seconds: Optional[int] = None, - disk_capacity_in_bytes: Optional[int] = None, - file_system_capacity_in_bytes: Optional[int] = None, - source_data_in_mega_bytes: Optional[float] = None, - ps_data_in_mega_bytes: Optional[float] = None, - target_data_in_mega_bytes: Optional[float] = None, - disk_resized: Optional[str] = None, - last_rpo_calculated_time: Optional[datetime.datetime] = None, - resync_processed_bytes: Optional[int] = None, - resync_total_transferred_bytes: Optional[int] = None, - resync_last15_minutes_transferred_bytes: Optional[int] = None, - resync_last_data_transfer_time_utc: Optional[datetime.datetime] = None, - resync_start_time: Optional[datetime.datetime] = None, - progress_health: Optional[str] = None, - progress_status: Optional[str] = None, - seconds_to_take_switch_provider: Optional[int] = None, - **kwargs: Any - ) -> None: - """ - :keyword disk_id: The disk id. - :paramtype disk_id: str - :keyword disk_name: The disk name. - :paramtype disk_name: str - :keyword protection_stage: The protection stage. - :paramtype protection_stage: str - :keyword health_error_code: The health error code for the disk. - :paramtype health_error_code: str - :keyword rpo_in_seconds: The RPO in seconds. - :paramtype rpo_in_seconds: int - :keyword resync_required: A value indicating whether resync is required for this disk. - :paramtype resync_required: str - :keyword resync_progress_percentage: The resync progress percentage. - :paramtype resync_progress_percentage: int - :keyword resync_duration_in_seconds: The resync duration in seconds. - :paramtype resync_duration_in_seconds: int - :keyword disk_capacity_in_bytes: The disk capacity in bytes. - :paramtype disk_capacity_in_bytes: int - :keyword file_system_capacity_in_bytes: The disk file system capacity in bytes. - :paramtype file_system_capacity_in_bytes: int - :keyword source_data_in_mega_bytes: The source data transit in MB. - :paramtype source_data_in_mega_bytes: float - :keyword ps_data_in_mega_bytes: The PS data transit in MB. - :paramtype ps_data_in_mega_bytes: float - :keyword target_data_in_mega_bytes: The target data transit in MB. - :paramtype target_data_in_mega_bytes: float - :keyword disk_resized: A value indicating whether disk is resized. - :paramtype disk_resized: str - :keyword last_rpo_calculated_time: The last RPO calculated time. - :paramtype last_rpo_calculated_time: ~datetime.datetime - :keyword resync_processed_bytes: The resync processed bytes. - :paramtype resync_processed_bytes: int - :keyword resync_total_transferred_bytes: The resync total transferred bytes. - :paramtype resync_total_transferred_bytes: int - :keyword resync_last15_minutes_transferred_bytes: The resync last 15 minutes transferred bytes. - :paramtype resync_last15_minutes_transferred_bytes: int - :keyword resync_last_data_transfer_time_utc: The last data transfer time in UTC. - :paramtype resync_last_data_transfer_time_utc: ~datetime.datetime - :keyword resync_start_time: The resync start time. - :paramtype resync_start_time: ~datetime.datetime - :keyword progress_health: The Progress Health. - :paramtype progress_health: str - :keyword progress_status: The Progress Status. - :paramtype progress_status: str - :keyword seconds_to_take_switch_provider: The seconds to take for switch provider. - :paramtype seconds_to_take_switch_provider: int - """ - super().__init__(**kwargs) - self.disk_id = disk_id - self.disk_name = disk_name - self.protection_stage = protection_stage - self.health_error_code = health_error_code - self.rpo_in_seconds = rpo_in_seconds - self.resync_required = resync_required - self.resync_progress_percentage = resync_progress_percentage - self.resync_duration_in_seconds = resync_duration_in_seconds - self.disk_capacity_in_bytes = disk_capacity_in_bytes - self.file_system_capacity_in_bytes = file_system_capacity_in_bytes - self.source_data_in_mega_bytes = source_data_in_mega_bytes - self.ps_data_in_mega_bytes = ps_data_in_mega_bytes - self.target_data_in_mega_bytes = target_data_in_mega_bytes - self.disk_resized = disk_resized - self.last_rpo_calculated_time = last_rpo_calculated_time - self.resync_processed_bytes = resync_processed_bytes - self.resync_total_transferred_bytes = resync_total_transferred_bytes - self.resync_last15_minutes_transferred_bytes = resync_last15_minutes_transferred_bytes - self.resync_last_data_transfer_time_utc = resync_last_data_transfer_time_utc - self.resync_start_time = resync_start_time - self.progress_health = progress_health - self.progress_status = progress_status - self.seconds_to_take_switch_provider = seconds_to_take_switch_provider - - -class InMageAzureV2RecoveryPointDetails(ProviderSpecificRecoveryPointDetails): - """InMage Azure V2 provider specific recovery point details. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: Gets the provider type. Required. - :vartype instance_type: str - :ivar is_multi_vm_sync_point: A value indicating whether the recovery point is multi VM - consistent. - :vartype is_multi_vm_sync_point: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "is_multi_vm_sync_point": {"key": "isMultiVmSyncPoint", "type": "str"}, - } - - def __init__(self, *, is_multi_vm_sync_point: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword is_multi_vm_sync_point: A value indicating whether the recovery point is multi VM - consistent. - :paramtype is_multi_vm_sync_point: str - """ - super().__init__(**kwargs) - self.instance_type: str = "InMageAzureV2" - self.is_multi_vm_sync_point = is_multi_vm_sync_point - - -class InMageAzureV2ReplicationDetails(ReplicationProviderSpecificSettings): - """InMageAzureV2 provider specific settings. - - 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 instance_type: Gets the Instance type. Required. - :vartype instance_type: str - :ivar infrastructure_vm_id: The infrastructure VM Id. - :vartype infrastructure_vm_id: str - :ivar v_center_infrastructure_id: The vCenter infrastructure Id. - :vartype v_center_infrastructure_id: str - :ivar protection_stage: The protection stage. - :vartype protection_stage: str - :ivar vm_id: The virtual machine Id. - :vartype vm_id: str - :ivar vm_protection_state: The protection state for the vm. - :vartype vm_protection_state: str - :ivar vm_protection_state_description: The protection state description for the vm. - :vartype vm_protection_state_description: str - :ivar resync_progress_percentage: The resync progress percentage. - :vartype resync_progress_percentage: int - :ivar rpo_in_seconds: The RPO in seconds. - :vartype rpo_in_seconds: int - :ivar compressed_data_rate_in_mb: The compressed data change rate in MB. - :vartype compressed_data_rate_in_mb: float - :ivar uncompressed_data_rate_in_mb: The uncompressed data change rate in MB. - :vartype uncompressed_data_rate_in_mb: float - :ivar ip_address: The source IP address. - :vartype ip_address: str - :ivar agent_version: The agent version. - :vartype agent_version: str - :ivar agent_expiry_date: Agent expiry date. - :vartype agent_expiry_date: ~datetime.datetime - :ivar is_agent_update_required: A value indicating whether installed agent needs to be updated. - :vartype is_agent_update_required: str - :ivar is_reboot_after_update_required: A value indicating whether the source server requires a - restart after update. - :vartype is_reboot_after_update_required: str - :ivar last_heartbeat: The last heartbeat received from the source server. - :vartype last_heartbeat: ~datetime.datetime - :ivar process_server_id: The process server Id. - :vartype process_server_id: str - :ivar process_server_name: The process server name. - :vartype process_server_name: str - :ivar multi_vm_group_id: The multi vm group Id. - :vartype multi_vm_group_id: str - :ivar multi_vm_group_name: The multi vm group name. - :vartype multi_vm_group_name: str - :ivar multi_vm_sync_status: A value indicating whether multi vm sync is enabled or disabled. - :vartype multi_vm_sync_status: str - :ivar protected_disks: The list of protected disks. - :vartype protected_disks: - list[~azure.mgmt.recoveryservicessiterecovery.models.InMageAzureV2ProtectedDiskDetails] - :ivar disk_resized: A value indicating whether any disk is resized for this VM. - :vartype disk_resized: str - :ivar master_target_id: The master target Id. - :vartype master_target_id: str - :ivar source_vm_cpu_count: The CPU count of the VM on the primary side. - :vartype source_vm_cpu_count: int - :ivar source_vm_ram_size_in_mb: The RAM size of the VM on the primary side. - :vartype source_vm_ram_size_in_mb: int - :ivar os_type: The type of the OS on the VM. - :vartype os_type: str - :ivar vhd_name: The OS disk VHD name. - :vartype vhd_name: str - :ivar os_disk_id: The id of the disk containing the OS. - :vartype os_disk_id: str - :ivar azure_vm_disk_details: Azure VM Disk details. - :vartype azure_vm_disk_details: - list[~azure.mgmt.recoveryservicessiterecovery.models.AzureVmDiskDetails] - :ivar recovery_azure_vm_name: Recovery Azure given name. - :vartype recovery_azure_vm_name: str - :ivar recovery_azure_vm_size: The Recovery Azure VM size. - :vartype recovery_azure_vm_size: str - :ivar recovery_azure_storage_account: The recovery Azure storage account. - :vartype recovery_azure_storage_account: str - :ivar recovery_azure_log_storage_account_id: The ARM id of the log storage account used for - replication. This will be set to null if no log storage account was provided during enable - protection. - :vartype recovery_azure_log_storage_account_id: str - :ivar vm_nics: The PE Network details. - :vartype vm_nics: list[~azure.mgmt.recoveryservicessiterecovery.models.VMNicDetails] - :ivar selected_recovery_azure_network_id: The selected recovery azure network Id. - :vartype selected_recovery_azure_network_id: str - :ivar selected_tfo_azure_network_id: The test failover virtual network. - :vartype selected_tfo_azure_network_id: str - :ivar selected_source_nic_id: The selected source nic Id which will be used as the primary nic - during failover. - :vartype selected_source_nic_id: str - :ivar discovery_type: A value indicating the discovery type of the machine. Value can be - vCenter or physical. - :vartype discovery_type: str - :ivar enable_rdp_on_target_option: The selected option to enable RDP\\SSH on target vm after - failover. String value of SrsDataContract.EnableRDPOnTargetOption enum. - :vartype enable_rdp_on_target_option: str - :ivar datastores: The datastores of the on-premise machine. Value can be list of strings that - contain datastore names. - :vartype datastores: list[str] - :ivar target_vm_id: The ARM Id of the target Azure VM. This value will be null until the VM is - failed over. Only after failure it will be populated with the ARM Id of the Azure VM. - :vartype target_vm_id: str - :ivar recovery_azure_resource_group_id: The target resource group Id. - :vartype recovery_azure_resource_group_id: str - :ivar recovery_availability_set_id: The recovery availability set Id. - :vartype recovery_availability_set_id: str - :ivar target_availability_zone: The target availability zone. - :vartype target_availability_zone: str - :ivar target_proximity_placement_group_id: The target proximity placement group Id. - :vartype target_proximity_placement_group_id: str - :ivar use_managed_disks: A value indicating whether managed disks should be used during - failover. - :vartype use_managed_disks: str - :ivar license_type: License Type of the VM to be used. - :vartype license_type: str - :ivar sql_server_license_type: The SQL Server license type. - :vartype sql_server_license_type: str - :ivar validation_errors: The validation errors of the on-premise machine Value can be list of - validation errors. - :vartype validation_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] - :ivar last_rpo_calculated_time: The last RPO calculated time. - :vartype last_rpo_calculated_time: ~datetime.datetime - :ivar last_update_received_time: The last update time received from on-prem components. - :vartype last_update_received_time: ~datetime.datetime - :ivar replica_id: The replica id of the protected item. - :vartype replica_id: str - :ivar os_version: The OS Version of the protected item. - :vartype os_version: str - :ivar protected_managed_disks: The list of protected managed disks. - :vartype protected_managed_disks: - list[~azure.mgmt.recoveryservicessiterecovery.models.InMageAzureV2ManagedDiskDetails] - :ivar last_recovery_point_received: The last recovery point received time. - :vartype last_recovery_point_received: ~datetime.datetime - :ivar firmware_type: The firmware type of this protected item. - :vartype firmware_type: str - :ivar azure_vm_generation: The target generation for this protected item. - :vartype azure_vm_generation: str - :ivar is_additional_stats_available: A value indicating whether additional IR stats are - available or not. - :vartype is_additional_stats_available: bool - :ivar total_data_transferred: The total transferred data in bytes. - :vartype total_data_transferred: int - :ivar total_progress_health: The progress health. - :vartype total_progress_health: str - :ivar target_vm_tags: The target VM tags. - :vartype target_vm_tags: dict[str, str] - :ivar seed_managed_disk_tags: The tags for the seed managed disks. - :vartype seed_managed_disk_tags: dict[str, str] - :ivar target_managed_disk_tags: The tags for the target managed disks. - :vartype target_managed_disk_tags: dict[str, str] - :ivar target_nic_tags: The tags for the target NICs. - :vartype target_nic_tags: dict[str, str] - :ivar switch_provider_blocking_error_details: The switch provider blocking error information. - :vartype switch_provider_blocking_error_details: - list[~azure.mgmt.recoveryservicessiterecovery.models.InMageAzureV2SwitchProviderBlockingErrorDetails] - :ivar switch_provider_details: The switch provider blocking error information. - :vartype switch_provider_details: - ~azure.mgmt.recoveryservicessiterecovery.models.InMageAzureV2SwitchProviderDetails - :ivar supported_os_versions: A value indicating the inplace OS Upgrade version. - :vartype supported_os_versions: list[str] - :ivar all_available_os_upgrade_configurations: A value indicating all available inplace OS - Upgrade configurations. - :vartype all_available_os_upgrade_configurations: - list[~azure.mgmt.recoveryservicessiterecovery.models.OSUpgradeSupportedVersions] - :ivar os_name: The name of the OS on the VM. - :vartype os_name: str - """ - - _validation = { - "instance_type": {"required": True}, - "last_recovery_point_received": {"readonly": True}, - "os_name": {"readonly": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "infrastructure_vm_id": {"key": "infrastructureVmId", "type": "str"}, - "v_center_infrastructure_id": {"key": "vCenterInfrastructureId", "type": "str"}, - "protection_stage": {"key": "protectionStage", "type": "str"}, - "vm_id": {"key": "vmId", "type": "str"}, - "vm_protection_state": {"key": "vmProtectionState", "type": "str"}, - "vm_protection_state_description": {"key": "vmProtectionStateDescription", "type": "str"}, - "resync_progress_percentage": {"key": "resyncProgressPercentage", "type": "int"}, - "rpo_in_seconds": {"key": "rpoInSeconds", "type": "int"}, - "compressed_data_rate_in_mb": {"key": "compressedDataRateInMB", "type": "float"}, - "uncompressed_data_rate_in_mb": {"key": "uncompressedDataRateInMB", "type": "float"}, - "ip_address": {"key": "ipAddress", "type": "str"}, - "agent_version": {"key": "agentVersion", "type": "str"}, - "agent_expiry_date": {"key": "agentExpiryDate", "type": "iso-8601"}, - "is_agent_update_required": {"key": "isAgentUpdateRequired", "type": "str"}, - "is_reboot_after_update_required": {"key": "isRebootAfterUpdateRequired", "type": "str"}, - "last_heartbeat": {"key": "lastHeartbeat", "type": "iso-8601"}, - "process_server_id": {"key": "processServerId", "type": "str"}, - "process_server_name": {"key": "processServerName", "type": "str"}, - "multi_vm_group_id": {"key": "multiVmGroupId", "type": "str"}, - "multi_vm_group_name": {"key": "multiVmGroupName", "type": "str"}, - "multi_vm_sync_status": {"key": "multiVmSyncStatus", "type": "str"}, - "protected_disks": {"key": "protectedDisks", "type": "[InMageAzureV2ProtectedDiskDetails]"}, - "disk_resized": {"key": "diskResized", "type": "str"}, - "master_target_id": {"key": "masterTargetId", "type": "str"}, - "source_vm_cpu_count": {"key": "sourceVmCpuCount", "type": "int"}, - "source_vm_ram_size_in_mb": {"key": "sourceVmRamSizeInMB", "type": "int"}, - "os_type": {"key": "osType", "type": "str"}, - "vhd_name": {"key": "vhdName", "type": "str"}, - "os_disk_id": {"key": "osDiskId", "type": "str"}, - "azure_vm_disk_details": {"key": "azureVMDiskDetails", "type": "[AzureVmDiskDetails]"}, - "recovery_azure_vm_name": {"key": "recoveryAzureVMName", "type": "str"}, - "recovery_azure_vm_size": {"key": "recoveryAzureVMSize", "type": "str"}, - "recovery_azure_storage_account": {"key": "recoveryAzureStorageAccount", "type": "str"}, - "recovery_azure_log_storage_account_id": {"key": "recoveryAzureLogStorageAccountId", "type": "str"}, - "vm_nics": {"key": "vmNics", "type": "[VMNicDetails]"}, - "selected_recovery_azure_network_id": {"key": "selectedRecoveryAzureNetworkId", "type": "str"}, - "selected_tfo_azure_network_id": {"key": "selectedTfoAzureNetworkId", "type": "str"}, - "selected_source_nic_id": {"key": "selectedSourceNicId", "type": "str"}, - "discovery_type": {"key": "discoveryType", "type": "str"}, - "enable_rdp_on_target_option": {"key": "enableRdpOnTargetOption", "type": "str"}, - "datastores": {"key": "datastores", "type": "[str]"}, - "target_vm_id": {"key": "targetVmId", "type": "str"}, - "recovery_azure_resource_group_id": {"key": "recoveryAzureResourceGroupId", "type": "str"}, - "recovery_availability_set_id": {"key": "recoveryAvailabilitySetId", "type": "str"}, - "target_availability_zone": {"key": "targetAvailabilityZone", "type": "str"}, - "target_proximity_placement_group_id": {"key": "targetProximityPlacementGroupId", "type": "str"}, - "use_managed_disks": {"key": "useManagedDisks", "type": "str"}, - "license_type": {"key": "licenseType", "type": "str"}, - "sql_server_license_type": {"key": "sqlServerLicenseType", "type": "str"}, - "validation_errors": {"key": "validationErrors", "type": "[HealthError]"}, - "last_rpo_calculated_time": {"key": "lastRpoCalculatedTime", "type": "iso-8601"}, - "last_update_received_time": {"key": "lastUpdateReceivedTime", "type": "iso-8601"}, - "replica_id": {"key": "replicaId", "type": "str"}, - "os_version": {"key": "osVersion", "type": "str"}, - "protected_managed_disks": {"key": "protectedManagedDisks", "type": "[InMageAzureV2ManagedDiskDetails]"}, - "last_recovery_point_received": {"key": "lastRecoveryPointReceived", "type": "iso-8601"}, - "firmware_type": {"key": "firmwareType", "type": "str"}, - "azure_vm_generation": {"key": "azureVmGeneration", "type": "str"}, - "is_additional_stats_available": {"key": "isAdditionalStatsAvailable", "type": "bool"}, - "total_data_transferred": {"key": "totalDataTransferred", "type": "int"}, - "total_progress_health": {"key": "totalProgressHealth", "type": "str"}, - "target_vm_tags": {"key": "targetVmTags", "type": "{str}"}, - "seed_managed_disk_tags": {"key": "seedManagedDiskTags", "type": "{str}"}, - "target_managed_disk_tags": {"key": "targetManagedDiskTags", "type": "{str}"}, - "target_nic_tags": {"key": "targetNicTags", "type": "{str}"}, - "switch_provider_blocking_error_details": { - "key": "switchProviderBlockingErrorDetails", - "type": "[InMageAzureV2SwitchProviderBlockingErrorDetails]", - }, - "switch_provider_details": {"key": "switchProviderDetails", "type": "InMageAzureV2SwitchProviderDetails"}, - "supported_os_versions": {"key": "supportedOSVersions", "type": "[str]"}, - "all_available_os_upgrade_configurations": { - "key": "allAvailableOSUpgradeConfigurations", - "type": "[OSUpgradeSupportedVersions]", - }, - "os_name": {"key": "osName", "type": "str"}, - } - - def __init__( # pylint: disable=too-many-locals - self, - *, - infrastructure_vm_id: Optional[str] = None, - v_center_infrastructure_id: Optional[str] = None, - protection_stage: Optional[str] = None, - vm_id: Optional[str] = None, - vm_protection_state: Optional[str] = None, - vm_protection_state_description: Optional[str] = None, - resync_progress_percentage: Optional[int] = None, - rpo_in_seconds: Optional[int] = None, - compressed_data_rate_in_mb: Optional[float] = None, - uncompressed_data_rate_in_mb: Optional[float] = None, - ip_address: Optional[str] = None, - agent_version: Optional[str] = None, - agent_expiry_date: Optional[datetime.datetime] = None, - is_agent_update_required: Optional[str] = None, - is_reboot_after_update_required: Optional[str] = None, - last_heartbeat: Optional[datetime.datetime] = None, - process_server_id: Optional[str] = None, - process_server_name: Optional[str] = None, - multi_vm_group_id: Optional[str] = None, - multi_vm_group_name: Optional[str] = None, - multi_vm_sync_status: Optional[str] = None, - protected_disks: Optional[List["_models.InMageAzureV2ProtectedDiskDetails"]] = None, - disk_resized: Optional[str] = None, - master_target_id: Optional[str] = None, - source_vm_cpu_count: Optional[int] = None, - source_vm_ram_size_in_mb: Optional[int] = None, - os_type: Optional[str] = None, - vhd_name: Optional[str] = None, - os_disk_id: Optional[str] = None, - azure_vm_disk_details: Optional[List["_models.AzureVmDiskDetails"]] = None, - recovery_azure_vm_name: Optional[str] = None, - recovery_azure_vm_size: Optional[str] = None, - recovery_azure_storage_account: Optional[str] = None, - recovery_azure_log_storage_account_id: Optional[str] = None, - vm_nics: Optional[List["_models.VMNicDetails"]] = None, - selected_recovery_azure_network_id: Optional[str] = None, - selected_tfo_azure_network_id: Optional[str] = None, - selected_source_nic_id: Optional[str] = None, - discovery_type: Optional[str] = None, - enable_rdp_on_target_option: Optional[str] = None, - datastores: Optional[List[str]] = None, - target_vm_id: Optional[str] = None, - recovery_azure_resource_group_id: Optional[str] = None, - recovery_availability_set_id: Optional[str] = None, - target_availability_zone: Optional[str] = None, - target_proximity_placement_group_id: Optional[str] = None, - use_managed_disks: Optional[str] = None, - license_type: Optional[str] = None, - sql_server_license_type: Optional[str] = None, - validation_errors: Optional[List["_models.HealthError"]] = None, - last_rpo_calculated_time: Optional[datetime.datetime] = None, - last_update_received_time: Optional[datetime.datetime] = None, - replica_id: Optional[str] = None, - os_version: Optional[str] = None, - protected_managed_disks: Optional[List["_models.InMageAzureV2ManagedDiskDetails"]] = None, - firmware_type: Optional[str] = None, - azure_vm_generation: Optional[str] = None, - is_additional_stats_available: Optional[bool] = None, - total_data_transferred: Optional[int] = None, - total_progress_health: Optional[str] = None, - target_vm_tags: Optional[Dict[str, str]] = None, - seed_managed_disk_tags: Optional[Dict[str, str]] = None, - target_managed_disk_tags: Optional[Dict[str, str]] = None, - target_nic_tags: Optional[Dict[str, str]] = None, - switch_provider_blocking_error_details: Optional[ - List["_models.InMageAzureV2SwitchProviderBlockingErrorDetails"] - ] = None, - switch_provider_details: Optional["_models.InMageAzureV2SwitchProviderDetails"] = None, - supported_os_versions: Optional[List[str]] = None, - all_available_os_upgrade_configurations: Optional[List["_models.OSUpgradeSupportedVersions"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword infrastructure_vm_id: The infrastructure VM Id. - :paramtype infrastructure_vm_id: str - :keyword v_center_infrastructure_id: The vCenter infrastructure Id. - :paramtype v_center_infrastructure_id: str - :keyword protection_stage: The protection stage. - :paramtype protection_stage: str - :keyword vm_id: The virtual machine Id. - :paramtype vm_id: str - :keyword vm_protection_state: The protection state for the vm. - :paramtype vm_protection_state: str - :keyword vm_protection_state_description: The protection state description for the vm. - :paramtype vm_protection_state_description: str - :keyword resync_progress_percentage: The resync progress percentage. - :paramtype resync_progress_percentage: int - :keyword rpo_in_seconds: The RPO in seconds. - :paramtype rpo_in_seconds: int - :keyword compressed_data_rate_in_mb: The compressed data change rate in MB. - :paramtype compressed_data_rate_in_mb: float - :keyword uncompressed_data_rate_in_mb: The uncompressed data change rate in MB. - :paramtype uncompressed_data_rate_in_mb: float - :keyword ip_address: The source IP address. - :paramtype ip_address: str - :keyword agent_version: The agent version. - :paramtype agent_version: str - :keyword agent_expiry_date: Agent expiry date. - :paramtype agent_expiry_date: ~datetime.datetime - :keyword is_agent_update_required: A value indicating whether installed agent needs to be - updated. - :paramtype is_agent_update_required: str - :keyword is_reboot_after_update_required: A value indicating whether the source server requires - a restart after update. - :paramtype is_reboot_after_update_required: str - :keyword last_heartbeat: The last heartbeat received from the source server. - :paramtype last_heartbeat: ~datetime.datetime - :keyword process_server_id: The process server Id. - :paramtype process_server_id: str - :keyword process_server_name: The process server name. - :paramtype process_server_name: str - :keyword multi_vm_group_id: The multi vm group Id. - :paramtype multi_vm_group_id: str - :keyword multi_vm_group_name: The multi vm group name. - :paramtype multi_vm_group_name: str - :keyword multi_vm_sync_status: A value indicating whether multi vm sync is enabled or disabled. - :paramtype multi_vm_sync_status: str - :keyword protected_disks: The list of protected disks. - :paramtype protected_disks: - list[~azure.mgmt.recoveryservicessiterecovery.models.InMageAzureV2ProtectedDiskDetails] - :keyword disk_resized: A value indicating whether any disk is resized for this VM. - :paramtype disk_resized: str - :keyword master_target_id: The master target Id. - :paramtype master_target_id: str - :keyword source_vm_cpu_count: The CPU count of the VM on the primary side. - :paramtype source_vm_cpu_count: int - :keyword source_vm_ram_size_in_mb: The RAM size of the VM on the primary side. - :paramtype source_vm_ram_size_in_mb: int - :keyword os_type: The type of the OS on the VM. - :paramtype os_type: str - :keyword vhd_name: The OS disk VHD name. - :paramtype vhd_name: str - :keyword os_disk_id: The id of the disk containing the OS. - :paramtype os_disk_id: str - :keyword azure_vm_disk_details: Azure VM Disk details. - :paramtype azure_vm_disk_details: - list[~azure.mgmt.recoveryservicessiterecovery.models.AzureVmDiskDetails] - :keyword recovery_azure_vm_name: Recovery Azure given name. - :paramtype recovery_azure_vm_name: str - :keyword recovery_azure_vm_size: The Recovery Azure VM size. - :paramtype recovery_azure_vm_size: str - :keyword recovery_azure_storage_account: The recovery Azure storage account. - :paramtype recovery_azure_storage_account: str - :keyword recovery_azure_log_storage_account_id: The ARM id of the log storage account used for - replication. This will be set to null if no log storage account was provided during enable - protection. - :paramtype recovery_azure_log_storage_account_id: str - :keyword vm_nics: The PE Network details. - :paramtype vm_nics: list[~azure.mgmt.recoveryservicessiterecovery.models.VMNicDetails] - :keyword selected_recovery_azure_network_id: The selected recovery azure network Id. - :paramtype selected_recovery_azure_network_id: str - :keyword selected_tfo_azure_network_id: The test failover virtual network. - :paramtype selected_tfo_azure_network_id: str - :keyword selected_source_nic_id: The selected source nic Id which will be used as the primary - nic during failover. - :paramtype selected_source_nic_id: str - :keyword discovery_type: A value indicating the discovery type of the machine. Value can be - vCenter or physical. - :paramtype discovery_type: str - :keyword enable_rdp_on_target_option: The selected option to enable RDP\\SSH on target vm after - failover. String value of SrsDataContract.EnableRDPOnTargetOption enum. - :paramtype enable_rdp_on_target_option: str - :keyword datastores: The datastores of the on-premise machine. Value can be list of strings - that contain datastore names. - :paramtype datastores: list[str] - :keyword target_vm_id: The ARM Id of the target Azure VM. This value will be null until the VM - is failed over. Only after failure it will be populated with the ARM Id of the Azure VM. - :paramtype target_vm_id: str - :keyword recovery_azure_resource_group_id: The target resource group Id. - :paramtype recovery_azure_resource_group_id: str - :keyword recovery_availability_set_id: The recovery availability set Id. - :paramtype recovery_availability_set_id: str - :keyword target_availability_zone: The target availability zone. - :paramtype target_availability_zone: str - :keyword target_proximity_placement_group_id: The target proximity placement group Id. - :paramtype target_proximity_placement_group_id: str - :keyword use_managed_disks: A value indicating whether managed disks should be used during - failover. - :paramtype use_managed_disks: str - :keyword license_type: License Type of the VM to be used. - :paramtype license_type: str - :keyword sql_server_license_type: The SQL Server license type. - :paramtype sql_server_license_type: str - :keyword validation_errors: The validation errors of the on-premise machine Value can be list - of validation errors. - :paramtype validation_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] - :keyword last_rpo_calculated_time: The last RPO calculated time. - :paramtype last_rpo_calculated_time: ~datetime.datetime - :keyword last_update_received_time: The last update time received from on-prem components. - :paramtype last_update_received_time: ~datetime.datetime - :keyword replica_id: The replica id of the protected item. - :paramtype replica_id: str - :keyword os_version: The OS Version of the protected item. - :paramtype os_version: str - :keyword protected_managed_disks: The list of protected managed disks. - :paramtype protected_managed_disks: - list[~azure.mgmt.recoveryservicessiterecovery.models.InMageAzureV2ManagedDiskDetails] - :keyword firmware_type: The firmware type of this protected item. - :paramtype firmware_type: str - :keyword azure_vm_generation: The target generation for this protected item. - :paramtype azure_vm_generation: str - :keyword is_additional_stats_available: A value indicating whether additional IR stats are - available or not. - :paramtype is_additional_stats_available: bool - :keyword total_data_transferred: The total transferred data in bytes. - :paramtype total_data_transferred: int - :keyword total_progress_health: The progress health. - :paramtype total_progress_health: str - :keyword target_vm_tags: The target VM tags. - :paramtype target_vm_tags: dict[str, str] - :keyword seed_managed_disk_tags: The tags for the seed managed disks. - :paramtype seed_managed_disk_tags: dict[str, str] - :keyword target_managed_disk_tags: The tags for the target managed disks. - :paramtype target_managed_disk_tags: dict[str, str] - :keyword target_nic_tags: The tags for the target NICs. - :paramtype target_nic_tags: dict[str, str] - :keyword switch_provider_blocking_error_details: The switch provider blocking error - information. - :paramtype switch_provider_blocking_error_details: - list[~azure.mgmt.recoveryservicessiterecovery.models.InMageAzureV2SwitchProviderBlockingErrorDetails] - :keyword switch_provider_details: The switch provider blocking error information. - :paramtype switch_provider_details: - ~azure.mgmt.recoveryservicessiterecovery.models.InMageAzureV2SwitchProviderDetails - :keyword supported_os_versions: A value indicating the inplace OS Upgrade version. - :paramtype supported_os_versions: list[str] - :keyword all_available_os_upgrade_configurations: A value indicating all available inplace OS - Upgrade configurations. - :paramtype all_available_os_upgrade_configurations: - list[~azure.mgmt.recoveryservicessiterecovery.models.OSUpgradeSupportedVersions] - """ - super().__init__(**kwargs) - self.instance_type: str = "InMageAzureV2" - self.infrastructure_vm_id = infrastructure_vm_id - self.v_center_infrastructure_id = v_center_infrastructure_id - self.protection_stage = protection_stage - self.vm_id = vm_id - self.vm_protection_state = vm_protection_state - self.vm_protection_state_description = vm_protection_state_description - self.resync_progress_percentage = resync_progress_percentage - self.rpo_in_seconds = rpo_in_seconds - self.compressed_data_rate_in_mb = compressed_data_rate_in_mb - self.uncompressed_data_rate_in_mb = uncompressed_data_rate_in_mb - self.ip_address = ip_address - self.agent_version = agent_version - self.agent_expiry_date = agent_expiry_date - self.is_agent_update_required = is_agent_update_required - self.is_reboot_after_update_required = is_reboot_after_update_required - self.last_heartbeat = last_heartbeat - self.process_server_id = process_server_id - self.process_server_name = process_server_name - self.multi_vm_group_id = multi_vm_group_id - self.multi_vm_group_name = multi_vm_group_name - self.multi_vm_sync_status = multi_vm_sync_status - self.protected_disks = protected_disks - self.disk_resized = disk_resized - self.master_target_id = master_target_id - self.source_vm_cpu_count = source_vm_cpu_count - self.source_vm_ram_size_in_mb = source_vm_ram_size_in_mb - self.os_type = os_type - self.vhd_name = vhd_name - self.os_disk_id = os_disk_id - self.azure_vm_disk_details = azure_vm_disk_details - self.recovery_azure_vm_name = recovery_azure_vm_name - self.recovery_azure_vm_size = recovery_azure_vm_size - self.recovery_azure_storage_account = recovery_azure_storage_account - self.recovery_azure_log_storage_account_id = recovery_azure_log_storage_account_id - self.vm_nics = vm_nics - self.selected_recovery_azure_network_id = selected_recovery_azure_network_id - self.selected_tfo_azure_network_id = selected_tfo_azure_network_id - self.selected_source_nic_id = selected_source_nic_id - self.discovery_type = discovery_type - self.enable_rdp_on_target_option = enable_rdp_on_target_option - self.datastores = datastores - self.target_vm_id = target_vm_id - self.recovery_azure_resource_group_id = recovery_azure_resource_group_id - self.recovery_availability_set_id = recovery_availability_set_id - self.target_availability_zone = target_availability_zone - self.target_proximity_placement_group_id = target_proximity_placement_group_id - self.use_managed_disks = use_managed_disks - self.license_type = license_type - self.sql_server_license_type = sql_server_license_type - self.validation_errors = validation_errors - self.last_rpo_calculated_time = last_rpo_calculated_time - self.last_update_received_time = last_update_received_time - self.replica_id = replica_id - self.os_version = os_version - self.protected_managed_disks = protected_managed_disks - self.last_recovery_point_received: Optional[datetime.datetime] = None - self.firmware_type = firmware_type - self.azure_vm_generation = azure_vm_generation - self.is_additional_stats_available = is_additional_stats_available - self.total_data_transferred = total_data_transferred - self.total_progress_health = total_progress_health - self.target_vm_tags = target_vm_tags - self.seed_managed_disk_tags = seed_managed_disk_tags - self.target_managed_disk_tags = target_managed_disk_tags - self.target_nic_tags = target_nic_tags - self.switch_provider_blocking_error_details = switch_provider_blocking_error_details - self.switch_provider_details = switch_provider_details - self.supported_os_versions = supported_os_versions - self.all_available_os_upgrade_configurations = all_available_os_upgrade_configurations - self.os_name: Optional[str] = None - - -class InMageAzureV2ReprotectInput(ReverseReplicationProviderSpecificInput): - """InMageAzureV2 specific provider input. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - :ivar master_target_id: The Master target Id. - :vartype master_target_id: str - :ivar process_server_id: The Process Server Id. - :vartype process_server_id: str - :ivar storage_account_id: The storage account id. - :vartype storage_account_id: str - :ivar run_as_account_id: The CS account Id. - :vartype run_as_account_id: str - :ivar policy_id: The Policy Id. - :vartype policy_id: str - :ivar log_storage_account_id: The storage account to be used for logging during replication. - :vartype log_storage_account_id: str - :ivar disks_to_include: The disks to include list. - :vartype disks_to_include: list[str] - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "master_target_id": {"key": "masterTargetId", "type": "str"}, - "process_server_id": {"key": "processServerId", "type": "str"}, - "storage_account_id": {"key": "storageAccountId", "type": "str"}, - "run_as_account_id": {"key": "runAsAccountId", "type": "str"}, - "policy_id": {"key": "policyId", "type": "str"}, - "log_storage_account_id": {"key": "logStorageAccountId", "type": "str"}, - "disks_to_include": {"key": "disksToInclude", "type": "[str]"}, - } - - def __init__( - self, - *, - master_target_id: Optional[str] = None, - process_server_id: Optional[str] = None, - storage_account_id: Optional[str] = None, - run_as_account_id: Optional[str] = None, - policy_id: Optional[str] = None, - log_storage_account_id: Optional[str] = None, - disks_to_include: Optional[List[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword master_target_id: The Master target Id. - :paramtype master_target_id: str - :keyword process_server_id: The Process Server Id. - :paramtype process_server_id: str - :keyword storage_account_id: The storage account id. - :paramtype storage_account_id: str - :keyword run_as_account_id: The CS account Id. - :paramtype run_as_account_id: str - :keyword policy_id: The Policy Id. - :paramtype policy_id: str - :keyword log_storage_account_id: The storage account to be used for logging during replication. - :paramtype log_storage_account_id: str - :keyword disks_to_include: The disks to include list. - :paramtype disks_to_include: list[str] - """ - super().__init__(**kwargs) - self.instance_type: str = "InMageAzureV2" - self.master_target_id = master_target_id - self.process_server_id = process_server_id - self.storage_account_id = storage_account_id - self.run_as_account_id = run_as_account_id - self.policy_id = policy_id - self.log_storage_account_id = log_storage_account_id - self.disks_to_include = disks_to_include - - -class InMageAzureV2SwitchProviderBlockingErrorDetails(_serialization.Model): # pylint: disable=name-too-long - """InMageAzureV2 switch provider blocking error details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar error_code: The error code. - :vartype error_code: str - :ivar error_message: The error message. - :vartype error_message: str - :ivar possible_causes: The possible causes. - :vartype possible_causes: str - :ivar recommended_action: The recommended action. - :vartype recommended_action: str - :ivar error_message_parameters: The error message parameters. - :vartype error_message_parameters: dict[str, str] - :ivar error_tags: The error tags. - :vartype error_tags: dict[str, str] - """ - - _validation = { - "error_code": {"readonly": True}, - "error_message": {"readonly": True}, - "possible_causes": {"readonly": True}, - "recommended_action": {"readonly": True}, - "error_message_parameters": {"readonly": True}, - "error_tags": {"readonly": True}, - } - - _attribute_map = { - "error_code": {"key": "errorCode", "type": "str"}, - "error_message": {"key": "errorMessage", "type": "str"}, - "possible_causes": {"key": "possibleCauses", "type": "str"}, - "recommended_action": {"key": "recommendedAction", "type": "str"}, - "error_message_parameters": {"key": "errorMessageParameters", "type": "{str}"}, - "error_tags": {"key": "errorTags", "type": "{str}"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.error_code: Optional[str] = None - self.error_message: Optional[str] = None - self.possible_causes: Optional[str] = None - self.recommended_action: Optional[str] = None - self.error_message_parameters: Optional[Dict[str, str]] = None - self.error_tags: Optional[Dict[str, str]] = None - - -class InMageAzureV2SwitchProviderDetails(_serialization.Model): - """InMageAzureV2 switch provider details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar target_vault_id: The target vault Id. - :vartype target_vault_id: str - :ivar target_resource_id: The target resource Id. - :vartype target_resource_id: str - :ivar target_fabric_id: The target fabric Id. - :vartype target_fabric_id: str - :ivar target_appliance_id: The target appliance Id. - :vartype target_appliance_id: str - """ - - _validation = { - "target_vault_id": {"readonly": True}, - "target_resource_id": {"readonly": True}, - "target_fabric_id": {"readonly": True}, - "target_appliance_id": {"readonly": True}, - } - - _attribute_map = { - "target_vault_id": {"key": "targetVaultId", "type": "str"}, - "target_resource_id": {"key": "targetResourceId", "type": "str"}, - "target_fabric_id": {"key": "targetFabricId", "type": "str"}, - "target_appliance_id": {"key": "targetApplianceId", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.target_vault_id: Optional[str] = None - self.target_resource_id: Optional[str] = None - self.target_fabric_id: Optional[str] = None - self.target_appliance_id: Optional[str] = None - - -class SwitchProviderSpecificInput(_serialization.Model): - """Provider specific switch provider input. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - InMageAzureV2SwitchProviderInput - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - } - - _subtype_map = {"instance_type": {"InMageAzureV2": "InMageAzureV2SwitchProviderInput"}} - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.instance_type: Optional[str] = None - - -class InMageAzureV2SwitchProviderInput(SwitchProviderSpecificInput): - """Provider specific input for InMageAzureV2 switch provider. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - :ivar target_vault_id: The target vault Id. Required. - :vartype target_vault_id: str - :ivar target_fabric_id: The target fabric Id. Required. - :vartype target_fabric_id: str - :ivar target_appliance_id: The target appliance Id. Required. - :vartype target_appliance_id: str - """ - - _validation = { - "instance_type": {"required": True}, - "target_vault_id": {"required": True}, - "target_fabric_id": {"required": True}, - "target_appliance_id": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "target_vault_id": {"key": "targetVaultID", "type": "str"}, - "target_fabric_id": {"key": "targetFabricID", "type": "str"}, - "target_appliance_id": {"key": "targetApplianceID", "type": "str"}, - } - - def __init__(self, *, target_vault_id: str, target_fabric_id: str, target_appliance_id: str, **kwargs: Any) -> None: - """ - :keyword target_vault_id: The target vault Id. Required. - :paramtype target_vault_id: str - :keyword target_fabric_id: The target fabric Id. Required. - :paramtype target_fabric_id: str - :keyword target_appliance_id: The target appliance Id. Required. - :paramtype target_appliance_id: str - """ - super().__init__(**kwargs) - self.instance_type: str = "InMageAzureV2" - self.target_vault_id = target_vault_id - self.target_fabric_id = target_fabric_id - self.target_appliance_id = target_appliance_id - - -class InMageAzureV2TestFailoverInput(TestFailoverProviderSpecificInput): - """InMageAzureV2 provider specific input for test failover. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - :ivar recovery_point_id: The recovery point id to be passed to test failover to a particular - recovery point. In case of latest recovery point, null should be passed. - :vartype recovery_point_id: str - :ivar os_upgrade_version: A value indicating the inplace OS Upgrade version. - :vartype os_upgrade_version: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "recovery_point_id": {"key": "recoveryPointId", "type": "str"}, - "os_upgrade_version": {"key": "osUpgradeVersion", "type": "str"}, - } - - def __init__( - self, *, recovery_point_id: Optional[str] = None, os_upgrade_version: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword recovery_point_id: The recovery point id to be passed to test failover to a particular - recovery point. In case of latest recovery point, null should be passed. - :paramtype recovery_point_id: str - :keyword os_upgrade_version: A value indicating the inplace OS Upgrade version. - :paramtype os_upgrade_version: str - """ - super().__init__(**kwargs) - self.instance_type: str = "InMageAzureV2" - self.recovery_point_id = recovery_point_id - self.os_upgrade_version = os_upgrade_version - - -class InMageAzureV2UnplannedFailoverInput(UnplannedFailoverProviderSpecificInput): - """InMageAzureV2 provider specific input for unplanned failover. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - :ivar recovery_point_id: The recovery point id to be passed to failover to a particular - recovery point. In case of latest recovery point, null should be passed. - :vartype recovery_point_id: str - :ivar os_upgrade_version: A value indicating the inplace OS Upgrade version. - :vartype os_upgrade_version: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "recovery_point_id": {"key": "recoveryPointId", "type": "str"}, - "os_upgrade_version": {"key": "osUpgradeVersion", "type": "str"}, - } - - def __init__( - self, *, recovery_point_id: Optional[str] = None, os_upgrade_version: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword recovery_point_id: The recovery point id to be passed to failover to a particular - recovery point. In case of latest recovery point, null should be passed. - :paramtype recovery_point_id: str - :keyword os_upgrade_version: A value indicating the inplace OS Upgrade version. - :paramtype os_upgrade_version: str - """ - super().__init__(**kwargs) - self.instance_type: str = "InMageAzureV2" - self.recovery_point_id = recovery_point_id - self.os_upgrade_version = os_upgrade_version - - -class InMageAzureV2UpdateReplicationProtectedItemInput( - UpdateReplicationProtectedItemProviderInput -): # pylint: disable=name-too-long - """InMage Azure V2 input to update replication protected item. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - :ivar recovery_azure_v1_resource_group_id: The recovery Azure resource group Id for classic - deployment. - :vartype recovery_azure_v1_resource_group_id: str - :ivar recovery_azure_v2_resource_group_id: The recovery Azure resource group Id for resource - manager deployment. - :vartype recovery_azure_v2_resource_group_id: str - :ivar use_managed_disks: A value indicating whether managed disks should be used during - failover. - :vartype use_managed_disks: str - :ivar target_proximity_placement_group_id: The target proximity placement group Id. - :vartype target_proximity_placement_group_id: str - :ivar target_availability_zone: The target availability zone. - :vartype target_availability_zone: str - :ivar target_vm_tags: The target VM tags. - :vartype target_vm_tags: dict[str, str] - :ivar target_managed_disk_tags: The tags for the target managed disks. - :vartype target_managed_disk_tags: dict[str, str] - :ivar target_nic_tags: The tags for the target NICs. - :vartype target_nic_tags: dict[str, str] - :ivar sql_server_license_type: The SQL Server license type. Known values are: "NotSpecified", - "NoLicenseType", "PAYG", and "AHUB". - :vartype sql_server_license_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.SqlServerLicenseType - :ivar vm_disks: The list of disk update properties. - :vartype vm_disks: list[~azure.mgmt.recoveryservicessiterecovery.models.UpdateDiskInput] - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "recovery_azure_v1_resource_group_id": {"key": "recoveryAzureV1ResourceGroupId", "type": "str"}, - "recovery_azure_v2_resource_group_id": {"key": "recoveryAzureV2ResourceGroupId", "type": "str"}, - "use_managed_disks": {"key": "useManagedDisks", "type": "str"}, - "target_proximity_placement_group_id": {"key": "targetProximityPlacementGroupId", "type": "str"}, - "target_availability_zone": {"key": "targetAvailabilityZone", "type": "str"}, - "target_vm_tags": {"key": "targetVmTags", "type": "{str}"}, - "target_managed_disk_tags": {"key": "targetManagedDiskTags", "type": "{str}"}, - "target_nic_tags": {"key": "targetNicTags", "type": "{str}"}, - "sql_server_license_type": {"key": "sqlServerLicenseType", "type": "str"}, - "vm_disks": {"key": "vmDisks", "type": "[UpdateDiskInput]"}, - } - - def __init__( - self, - *, - recovery_azure_v1_resource_group_id: Optional[str] = None, - recovery_azure_v2_resource_group_id: Optional[str] = None, - use_managed_disks: Optional[str] = None, - target_proximity_placement_group_id: Optional[str] = None, - target_availability_zone: Optional[str] = None, - target_vm_tags: Optional[Dict[str, str]] = None, - target_managed_disk_tags: Optional[Dict[str, str]] = None, - target_nic_tags: Optional[Dict[str, str]] = None, - sql_server_license_type: Optional[Union[str, "_models.SqlServerLicenseType"]] = None, - vm_disks: Optional[List["_models.UpdateDiskInput"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword recovery_azure_v1_resource_group_id: The recovery Azure resource group Id for classic - deployment. - :paramtype recovery_azure_v1_resource_group_id: str - :keyword recovery_azure_v2_resource_group_id: The recovery Azure resource group Id for resource - manager deployment. - :paramtype recovery_azure_v2_resource_group_id: str - :keyword use_managed_disks: A value indicating whether managed disks should be used during - failover. - :paramtype use_managed_disks: str - :keyword target_proximity_placement_group_id: The target proximity placement group Id. - :paramtype target_proximity_placement_group_id: str - :keyword target_availability_zone: The target availability zone. - :paramtype target_availability_zone: str - :keyword target_vm_tags: The target VM tags. - :paramtype target_vm_tags: dict[str, str] - :keyword target_managed_disk_tags: The tags for the target managed disks. - :paramtype target_managed_disk_tags: dict[str, str] - :keyword target_nic_tags: The tags for the target NICs. - :paramtype target_nic_tags: dict[str, str] - :keyword sql_server_license_type: The SQL Server license type. Known values are: - "NotSpecified", "NoLicenseType", "PAYG", and "AHUB". - :paramtype sql_server_license_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.SqlServerLicenseType - :keyword vm_disks: The list of disk update properties. - :paramtype vm_disks: list[~azure.mgmt.recoveryservicessiterecovery.models.UpdateDiskInput] - """ - super().__init__(**kwargs) - self.instance_type: str = "InMageAzureV2" - self.recovery_azure_v1_resource_group_id = recovery_azure_v1_resource_group_id - self.recovery_azure_v2_resource_group_id = recovery_azure_v2_resource_group_id - self.use_managed_disks = use_managed_disks - self.target_proximity_placement_group_id = target_proximity_placement_group_id - self.target_availability_zone = target_availability_zone - self.target_vm_tags = target_vm_tags - self.target_managed_disk_tags = target_managed_disk_tags - self.target_nic_tags = target_nic_tags - self.sql_server_license_type = sql_server_license_type - self.vm_disks = vm_disks - - -class InMageBasePolicyDetails(PolicyProviderSpecificDetails): - """Base class for the policies of providers using InMage replication. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: Gets the class type. Overridden in derived classes. Required. - :vartype instance_type: str - :ivar recovery_point_threshold_in_minutes: The recovery point threshold in minutes. - :vartype recovery_point_threshold_in_minutes: int - :ivar recovery_point_history: The duration in minutes until which the recovery points need to - be stored. - :vartype recovery_point_history: int - :ivar app_consistent_frequency_in_minutes: The app consistent snapshot frequency in minutes. - :vartype app_consistent_frequency_in_minutes: int - :ivar multi_vm_sync_status: A value indicating whether multi-VM sync has to be enabled. - :vartype multi_vm_sync_status: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "recovery_point_threshold_in_minutes": {"key": "recoveryPointThresholdInMinutes", "type": "int"}, - "recovery_point_history": {"key": "recoveryPointHistory", "type": "int"}, - "app_consistent_frequency_in_minutes": {"key": "appConsistentFrequencyInMinutes", "type": "int"}, - "multi_vm_sync_status": {"key": "multiVmSyncStatus", "type": "str"}, - } - - def __init__( - self, - *, - recovery_point_threshold_in_minutes: Optional[int] = None, - recovery_point_history: Optional[int] = None, - app_consistent_frequency_in_minutes: Optional[int] = None, - multi_vm_sync_status: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword recovery_point_threshold_in_minutes: The recovery point threshold in minutes. - :paramtype recovery_point_threshold_in_minutes: int - :keyword recovery_point_history: The duration in minutes until which the recovery points need - to be stored. - :paramtype recovery_point_history: int - :keyword app_consistent_frequency_in_minutes: The app consistent snapshot frequency in minutes. - :paramtype app_consistent_frequency_in_minutes: int - :keyword multi_vm_sync_status: A value indicating whether multi-VM sync has to be enabled. - :paramtype multi_vm_sync_status: str - """ - super().__init__(**kwargs) - self.instance_type: str = "InMageBasePolicyDetails" - self.recovery_point_threshold_in_minutes = recovery_point_threshold_in_minutes - self.recovery_point_history = recovery_point_history - self.app_consistent_frequency_in_minutes = app_consistent_frequency_in_minutes - self.multi_vm_sync_status = multi_vm_sync_status - - -class InMageDisableProtectionProviderSpecificInput( - DisableProtectionProviderSpecificInput -): # pylint: disable=name-too-long - """InMage disable protection provider specific input. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - :ivar replica_vm_deletion_status: A value indicating whether the replica VM should be destroyed - or retained. Values from Delete and Retain. - :vartype replica_vm_deletion_status: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "replica_vm_deletion_status": {"key": "replicaVmDeletionStatus", "type": "str"}, - } - - def __init__(self, *, replica_vm_deletion_status: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword replica_vm_deletion_status: A value indicating whether the replica VM should be - destroyed or retained. Values from Delete and Retain. - :paramtype replica_vm_deletion_status: str - """ - super().__init__(**kwargs) - self.instance_type: str = "InMage" - self.replica_vm_deletion_status = replica_vm_deletion_status - - -class InMageDiskDetails(_serialization.Model): - """VMware/Physical specific Disk Details. - - :ivar disk_id: The disk Id. - :vartype disk_id: str - :ivar disk_name: The disk name. - :vartype disk_name: str - :ivar disk_size_in_mb: The disk size in MB. - :vartype disk_size_in_mb: str - :ivar disk_type: Whether disk is system disk or data disk. - :vartype disk_type: str - :ivar disk_configuration: Whether disk is dynamic disk or basic disk. - :vartype disk_configuration: str - :ivar volume_list: Volumes of the disk. - :vartype volume_list: list[~azure.mgmt.recoveryservicessiterecovery.models.DiskVolumeDetails] - """ - - _attribute_map = { - "disk_id": {"key": "diskId", "type": "str"}, - "disk_name": {"key": "diskName", "type": "str"}, - "disk_size_in_mb": {"key": "diskSizeInMB", "type": "str"}, - "disk_type": {"key": "diskType", "type": "str"}, - "disk_configuration": {"key": "diskConfiguration", "type": "str"}, - "volume_list": {"key": "volumeList", "type": "[DiskVolumeDetails]"}, - } - - def __init__( - self, - *, - disk_id: Optional[str] = None, - disk_name: Optional[str] = None, - disk_size_in_mb: Optional[str] = None, - disk_type: Optional[str] = None, - disk_configuration: Optional[str] = None, - volume_list: Optional[List["_models.DiskVolumeDetails"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword disk_id: The disk Id. - :paramtype disk_id: str - :keyword disk_name: The disk name. - :paramtype disk_name: str - :keyword disk_size_in_mb: The disk size in MB. - :paramtype disk_size_in_mb: str - :keyword disk_type: Whether disk is system disk or data disk. - :paramtype disk_type: str - :keyword disk_configuration: Whether disk is dynamic disk or basic disk. - :paramtype disk_configuration: str - :keyword volume_list: Volumes of the disk. - :paramtype volume_list: list[~azure.mgmt.recoveryservicessiterecovery.models.DiskVolumeDetails] - """ - super().__init__(**kwargs) - self.disk_id = disk_id - self.disk_name = disk_name - self.disk_size_in_mb = disk_size_in_mb - self.disk_type = disk_type - self.disk_configuration = disk_configuration - self.volume_list = volume_list - - -class InMageDiskExclusionInput(_serialization.Model): - """DiskExclusionInput when doing enable protection of virtual machine in InMage provider. - - :ivar volume_options: The volume label based option for disk exclusion. - :vartype volume_options: - list[~azure.mgmt.recoveryservicessiterecovery.models.InMageVolumeExclusionOptions] - :ivar disk_signature_options: The guest disk signature based option for disk exclusion. - :vartype disk_signature_options: - list[~azure.mgmt.recoveryservicessiterecovery.models.InMageDiskSignatureExclusionOptions] - """ - - _attribute_map = { - "volume_options": {"key": "volumeOptions", "type": "[InMageVolumeExclusionOptions]"}, - "disk_signature_options": {"key": "diskSignatureOptions", "type": "[InMageDiskSignatureExclusionOptions]"}, - } - - def __init__( - self, - *, - volume_options: Optional[List["_models.InMageVolumeExclusionOptions"]] = None, - disk_signature_options: Optional[List["_models.InMageDiskSignatureExclusionOptions"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword volume_options: The volume label based option for disk exclusion. - :paramtype volume_options: - list[~azure.mgmt.recoveryservicessiterecovery.models.InMageVolumeExclusionOptions] - :keyword disk_signature_options: The guest disk signature based option for disk exclusion. - :paramtype disk_signature_options: - list[~azure.mgmt.recoveryservicessiterecovery.models.InMageDiskSignatureExclusionOptions] - """ - super().__init__(**kwargs) - self.volume_options = volume_options - self.disk_signature_options = disk_signature_options - - -class InMageDiskSignatureExclusionOptions(_serialization.Model): - """Guest disk signature based disk exclusion option when doing enable protection of virtual - machine in InMage provider. - - :ivar disk_signature: The guest signature of disk to be excluded from replication. - :vartype disk_signature: str - """ - - _attribute_map = { - "disk_signature": {"key": "diskSignature", "type": "str"}, - } - - def __init__(self, *, disk_signature: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword disk_signature: The guest signature of disk to be excluded from replication. - :paramtype disk_signature: str - """ - super().__init__(**kwargs) - self.disk_signature = disk_signature - - -class InMageEnableProtectionInput(EnableProtectionProviderSpecificInput): - """VMware Azure specific enable protection input. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - :ivar vm_friendly_name: The VM Name. - :vartype vm_friendly_name: str - :ivar master_target_id: The Master Target Id. Required. - :vartype master_target_id: str - :ivar process_server_id: The Process Server Id. Required. - :vartype process_server_id: str - :ivar retention_drive: The retention drive to use on the MT. Required. - :vartype retention_drive: str - :ivar run_as_account_id: The CS account Id. - :vartype run_as_account_id: str - :ivar multi_vm_group_id: The multi VM group Id. Required. - :vartype multi_vm_group_id: str - :ivar multi_vm_group_name: The multi VM group name. Required. - :vartype multi_vm_group_name: str - :ivar datastore_name: The target datastore name. - :vartype datastore_name: str - :ivar disk_exclusion_input: The enable disk exclusion input. - :vartype disk_exclusion_input: - ~azure.mgmt.recoveryservicessiterecovery.models.InMageDiskExclusionInput - :ivar disks_to_include: The disks to include list. - :vartype disks_to_include: list[str] - """ - - _validation = { - "instance_type": {"required": True}, - "master_target_id": {"required": True}, - "process_server_id": {"required": True}, - "retention_drive": {"required": True}, - "multi_vm_group_id": {"required": True}, - "multi_vm_group_name": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "vm_friendly_name": {"key": "vmFriendlyName", "type": "str"}, - "master_target_id": {"key": "masterTargetId", "type": "str"}, - "process_server_id": {"key": "processServerId", "type": "str"}, - "retention_drive": {"key": "retentionDrive", "type": "str"}, - "run_as_account_id": {"key": "runAsAccountId", "type": "str"}, - "multi_vm_group_id": {"key": "multiVmGroupId", "type": "str"}, - "multi_vm_group_name": {"key": "multiVmGroupName", "type": "str"}, - "datastore_name": {"key": "datastoreName", "type": "str"}, - "disk_exclusion_input": {"key": "diskExclusionInput", "type": "InMageDiskExclusionInput"}, - "disks_to_include": {"key": "disksToInclude", "type": "[str]"}, - } - - def __init__( - self, - *, - master_target_id: str, - process_server_id: str, - retention_drive: str, - multi_vm_group_id: str, - multi_vm_group_name: str, - vm_friendly_name: Optional[str] = None, - run_as_account_id: Optional[str] = None, - datastore_name: Optional[str] = None, - disk_exclusion_input: Optional["_models.InMageDiskExclusionInput"] = None, - disks_to_include: Optional[List[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword vm_friendly_name: The VM Name. - :paramtype vm_friendly_name: str - :keyword master_target_id: The Master Target Id. Required. - :paramtype master_target_id: str - :keyword process_server_id: The Process Server Id. Required. - :paramtype process_server_id: str - :keyword retention_drive: The retention drive to use on the MT. Required. - :paramtype retention_drive: str - :keyword run_as_account_id: The CS account Id. - :paramtype run_as_account_id: str - :keyword multi_vm_group_id: The multi VM group Id. Required. - :paramtype multi_vm_group_id: str - :keyword multi_vm_group_name: The multi VM group name. Required. - :paramtype multi_vm_group_name: str - :keyword datastore_name: The target datastore name. - :paramtype datastore_name: str - :keyword disk_exclusion_input: The enable disk exclusion input. - :paramtype disk_exclusion_input: - ~azure.mgmt.recoveryservicessiterecovery.models.InMageDiskExclusionInput - :keyword disks_to_include: The disks to include list. - :paramtype disks_to_include: list[str] - """ - super().__init__(**kwargs) - self.instance_type: str = "InMage" - self.vm_friendly_name = vm_friendly_name - self.master_target_id = master_target_id - self.process_server_id = process_server_id - self.retention_drive = retention_drive - self.run_as_account_id = run_as_account_id - self.multi_vm_group_id = multi_vm_group_id - self.multi_vm_group_name = multi_vm_group_name - self.datastore_name = datastore_name - self.disk_exclusion_input = disk_exclusion_input - self.disks_to_include = disks_to_include - - -class InMageFabricSwitchProviderBlockingErrorDetails(_serialization.Model): # pylint: disable=name-too-long - """InMageFabric switch provider blocking error details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar error_code: The error code. - :vartype error_code: str - :ivar error_message: The error message. - :vartype error_message: str - :ivar possible_causes: The possible causes. - :vartype possible_causes: str - :ivar recommended_action: The recommended action. - :vartype recommended_action: str - :ivar error_message_parameters: The error message parameters. - :vartype error_message_parameters: dict[str, str] - :ivar error_tags: The error tags. - :vartype error_tags: dict[str, str] - """ - - _validation = { - "error_code": {"readonly": True}, - "error_message": {"readonly": True}, - "possible_causes": {"readonly": True}, - "recommended_action": {"readonly": True}, - "error_message_parameters": {"readonly": True}, - "error_tags": {"readonly": True}, - } - - _attribute_map = { - "error_code": {"key": "errorCode", "type": "str"}, - "error_message": {"key": "errorMessage", "type": "str"}, - "possible_causes": {"key": "possibleCauses", "type": "str"}, - "recommended_action": {"key": "recommendedAction", "type": "str"}, - "error_message_parameters": {"key": "errorMessageParameters", "type": "{str}"}, - "error_tags": {"key": "errorTags", "type": "{str}"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.error_code: Optional[str] = None - self.error_message: Optional[str] = None - self.possible_causes: Optional[str] = None - self.recommended_action: Optional[str] = None - self.error_message_parameters: Optional[Dict[str, str]] = None - self.error_tags: Optional[Dict[str, str]] = None - - -class InMagePolicyDetails(PolicyProviderSpecificDetails): - """InMage specific protection profile details. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: Gets the class type. Overridden in derived classes. Required. - :vartype instance_type: str - :ivar recovery_point_threshold_in_minutes: The recovery point threshold in minutes. - :vartype recovery_point_threshold_in_minutes: int - :ivar recovery_point_history: The duration in minutes until which the recovery points need to - be stored. - :vartype recovery_point_history: int - :ivar app_consistent_frequency_in_minutes: The app consistent snapshot frequency in minutes. - :vartype app_consistent_frequency_in_minutes: int - :ivar multi_vm_sync_status: A value indicating whether multi-VM sync has to be enabled. - :vartype multi_vm_sync_status: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "recovery_point_threshold_in_minutes": {"key": "recoveryPointThresholdInMinutes", "type": "int"}, - "recovery_point_history": {"key": "recoveryPointHistory", "type": "int"}, - "app_consistent_frequency_in_minutes": {"key": "appConsistentFrequencyInMinutes", "type": "int"}, - "multi_vm_sync_status": {"key": "multiVmSyncStatus", "type": "str"}, - } - - def __init__( - self, - *, - recovery_point_threshold_in_minutes: Optional[int] = None, - recovery_point_history: Optional[int] = None, - app_consistent_frequency_in_minutes: Optional[int] = None, - multi_vm_sync_status: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword recovery_point_threshold_in_minutes: The recovery point threshold in minutes. - :paramtype recovery_point_threshold_in_minutes: int - :keyword recovery_point_history: The duration in minutes until which the recovery points need - to be stored. - :paramtype recovery_point_history: int - :keyword app_consistent_frequency_in_minutes: The app consistent snapshot frequency in minutes. - :paramtype app_consistent_frequency_in_minutes: int - :keyword multi_vm_sync_status: A value indicating whether multi-VM sync has to be enabled. - :paramtype multi_vm_sync_status: str - """ - super().__init__(**kwargs) - self.instance_type: str = "InMage" - self.recovery_point_threshold_in_minutes = recovery_point_threshold_in_minutes - self.recovery_point_history = recovery_point_history - self.app_consistent_frequency_in_minutes = app_consistent_frequency_in_minutes - self.multi_vm_sync_status = multi_vm_sync_status - - -class InMagePolicyInput(PolicyProviderSpecificInput): - """VMWare Azure specific protection profile Input. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - :ivar recovery_point_threshold_in_minutes: The recovery point threshold in minutes. - :vartype recovery_point_threshold_in_minutes: int - :ivar recovery_point_history: The duration in minutes until which the recovery points need to - be stored. - :vartype recovery_point_history: int - :ivar app_consistent_frequency_in_minutes: The app consistent snapshot frequency (in minutes). - :vartype app_consistent_frequency_in_minutes: int - :ivar multi_vm_sync_status: A value indicating whether multi-VM sync has to be enabled. Value - should be 'Enabled' or 'Disabled'. Required. Known values are: "Enable" and "Disable". - :vartype multi_vm_sync_status: str or - ~azure.mgmt.recoveryservicessiterecovery.models.SetMultiVmSyncStatus - """ - - _validation = { - "instance_type": {"required": True}, - "multi_vm_sync_status": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "recovery_point_threshold_in_minutes": {"key": "recoveryPointThresholdInMinutes", "type": "int"}, - "recovery_point_history": {"key": "recoveryPointHistory", "type": "int"}, - "app_consistent_frequency_in_minutes": {"key": "appConsistentFrequencyInMinutes", "type": "int"}, - "multi_vm_sync_status": {"key": "multiVmSyncStatus", "type": "str"}, - } - - def __init__( - self, - *, - multi_vm_sync_status: Union[str, "_models.SetMultiVmSyncStatus"], - recovery_point_threshold_in_minutes: Optional[int] = None, - recovery_point_history: Optional[int] = None, - app_consistent_frequency_in_minutes: Optional[int] = None, - **kwargs: Any - ) -> None: - """ - :keyword recovery_point_threshold_in_minutes: The recovery point threshold in minutes. - :paramtype recovery_point_threshold_in_minutes: int - :keyword recovery_point_history: The duration in minutes until which the recovery points need - to be stored. - :paramtype recovery_point_history: int - :keyword app_consistent_frequency_in_minutes: The app consistent snapshot frequency (in - minutes). - :paramtype app_consistent_frequency_in_minutes: int - :keyword multi_vm_sync_status: A value indicating whether multi-VM sync has to be enabled. - Value should be 'Enabled' or 'Disabled'. Required. Known values are: "Enable" and "Disable". - :paramtype multi_vm_sync_status: str or - ~azure.mgmt.recoveryservicessiterecovery.models.SetMultiVmSyncStatus - """ - super().__init__(**kwargs) - self.instance_type: str = "InMage" - self.recovery_point_threshold_in_minutes = recovery_point_threshold_in_minutes - self.recovery_point_history = recovery_point_history - self.app_consistent_frequency_in_minutes = app_consistent_frequency_in_minutes - self.multi_vm_sync_status = multi_vm_sync_status - - -class InMageProtectedDiskDetails(_serialization.Model): - """InMage protected disk details. - - :ivar disk_id: The disk id. - :vartype disk_id: str - :ivar disk_name: The disk name. - :vartype disk_name: str - :ivar protection_stage: The protection stage. - :vartype protection_stage: str - :ivar health_error_code: The health error code for the disk. - :vartype health_error_code: str - :ivar rpo_in_seconds: The RPO in seconds. - :vartype rpo_in_seconds: int - :ivar resync_required: A value indicating whether resync is required for this disk. - :vartype resync_required: str - :ivar resync_progress_percentage: The resync progress percentage. - :vartype resync_progress_percentage: int - :ivar resync_duration_in_seconds: The resync duration in seconds. - :vartype resync_duration_in_seconds: int - :ivar disk_capacity_in_bytes: The disk capacity in bytes. - :vartype disk_capacity_in_bytes: int - :ivar file_system_capacity_in_bytes: The file system capacity in bytes. - :vartype file_system_capacity_in_bytes: int - :ivar source_data_in_mb: The source data transit in MB. - :vartype source_data_in_mb: float - :ivar ps_data_in_mb: The PS data transit in MB. - :vartype ps_data_in_mb: float - :ivar target_data_in_mb: The target data transit in MB. - :vartype target_data_in_mb: float - :ivar disk_resized: A value indicating whether disk is resized. - :vartype disk_resized: str - :ivar last_rpo_calculated_time: The last RPO calculated time. - :vartype last_rpo_calculated_time: ~datetime.datetime - :ivar resync_processed_bytes: The resync processed bytes. - :vartype resync_processed_bytes: int - :ivar resync_total_transferred_bytes: The resync total transferred bytes. - :vartype resync_total_transferred_bytes: int - :ivar resync_last15_minutes_transferred_bytes: The resync last 15 minutes transferred bytes. - :vartype resync_last15_minutes_transferred_bytes: int - :ivar resync_last_data_transfer_time_utc: The last data transfer time in UTC. - :vartype resync_last_data_transfer_time_utc: ~datetime.datetime - :ivar resync_start_time: The resync start time. - :vartype resync_start_time: ~datetime.datetime - :ivar progress_health: The Progress Health. - :vartype progress_health: str - :ivar progress_status: The Progress Status. - :vartype progress_status: str - """ - - _attribute_map = { - "disk_id": {"key": "diskId", "type": "str"}, - "disk_name": {"key": "diskName", "type": "str"}, - "protection_stage": {"key": "protectionStage", "type": "str"}, - "health_error_code": {"key": "healthErrorCode", "type": "str"}, - "rpo_in_seconds": {"key": "rpoInSeconds", "type": "int"}, - "resync_required": {"key": "resyncRequired", "type": "str"}, - "resync_progress_percentage": {"key": "resyncProgressPercentage", "type": "int"}, - "resync_duration_in_seconds": {"key": "resyncDurationInSeconds", "type": "int"}, - "disk_capacity_in_bytes": {"key": "diskCapacityInBytes", "type": "int"}, - "file_system_capacity_in_bytes": {"key": "fileSystemCapacityInBytes", "type": "int"}, - "source_data_in_mb": {"key": "sourceDataInMB", "type": "float"}, - "ps_data_in_mb": {"key": "psDataInMB", "type": "float"}, - "target_data_in_mb": {"key": "targetDataInMB", "type": "float"}, - "disk_resized": {"key": "diskResized", "type": "str"}, - "last_rpo_calculated_time": {"key": "lastRpoCalculatedTime", "type": "iso-8601"}, - "resync_processed_bytes": {"key": "resyncProcessedBytes", "type": "int"}, - "resync_total_transferred_bytes": {"key": "resyncTotalTransferredBytes", "type": "int"}, - "resync_last15_minutes_transferred_bytes": {"key": "resyncLast15MinutesTransferredBytes", "type": "int"}, - "resync_last_data_transfer_time_utc": {"key": "resyncLastDataTransferTimeUTC", "type": "iso-8601"}, - "resync_start_time": {"key": "resyncStartTime", "type": "iso-8601"}, - "progress_health": {"key": "progressHealth", "type": "str"}, - "progress_status": {"key": "progressStatus", "type": "str"}, - } - - def __init__( - self, - *, - disk_id: Optional[str] = None, - disk_name: Optional[str] = None, - protection_stage: Optional[str] = None, - health_error_code: Optional[str] = None, - rpo_in_seconds: Optional[int] = None, - resync_required: Optional[str] = None, - resync_progress_percentage: Optional[int] = None, - resync_duration_in_seconds: Optional[int] = None, - disk_capacity_in_bytes: Optional[int] = None, - file_system_capacity_in_bytes: Optional[int] = None, - source_data_in_mb: Optional[float] = None, - ps_data_in_mb: Optional[float] = None, - target_data_in_mb: Optional[float] = None, - disk_resized: Optional[str] = None, - last_rpo_calculated_time: Optional[datetime.datetime] = None, - resync_processed_bytes: Optional[int] = None, - resync_total_transferred_bytes: Optional[int] = None, - resync_last15_minutes_transferred_bytes: Optional[int] = None, - resync_last_data_transfer_time_utc: Optional[datetime.datetime] = None, - resync_start_time: Optional[datetime.datetime] = None, - progress_health: Optional[str] = None, - progress_status: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword disk_id: The disk id. - :paramtype disk_id: str - :keyword disk_name: The disk name. - :paramtype disk_name: str - :keyword protection_stage: The protection stage. - :paramtype protection_stage: str - :keyword health_error_code: The health error code for the disk. - :paramtype health_error_code: str - :keyword rpo_in_seconds: The RPO in seconds. - :paramtype rpo_in_seconds: int - :keyword resync_required: A value indicating whether resync is required for this disk. - :paramtype resync_required: str - :keyword resync_progress_percentage: The resync progress percentage. - :paramtype resync_progress_percentage: int - :keyword resync_duration_in_seconds: The resync duration in seconds. - :paramtype resync_duration_in_seconds: int - :keyword disk_capacity_in_bytes: The disk capacity in bytes. - :paramtype disk_capacity_in_bytes: int - :keyword file_system_capacity_in_bytes: The file system capacity in bytes. - :paramtype file_system_capacity_in_bytes: int - :keyword source_data_in_mb: The source data transit in MB. - :paramtype source_data_in_mb: float - :keyword ps_data_in_mb: The PS data transit in MB. - :paramtype ps_data_in_mb: float - :keyword target_data_in_mb: The target data transit in MB. - :paramtype target_data_in_mb: float - :keyword disk_resized: A value indicating whether disk is resized. - :paramtype disk_resized: str - :keyword last_rpo_calculated_time: The last RPO calculated time. - :paramtype last_rpo_calculated_time: ~datetime.datetime - :keyword resync_processed_bytes: The resync processed bytes. - :paramtype resync_processed_bytes: int - :keyword resync_total_transferred_bytes: The resync total transferred bytes. - :paramtype resync_total_transferred_bytes: int - :keyword resync_last15_minutes_transferred_bytes: The resync last 15 minutes transferred bytes. - :paramtype resync_last15_minutes_transferred_bytes: int - :keyword resync_last_data_transfer_time_utc: The last data transfer time in UTC. - :paramtype resync_last_data_transfer_time_utc: ~datetime.datetime - :keyword resync_start_time: The resync start time. - :paramtype resync_start_time: ~datetime.datetime - :keyword progress_health: The Progress Health. - :paramtype progress_health: str - :keyword progress_status: The Progress Status. - :paramtype progress_status: str - """ - super().__init__(**kwargs) - self.disk_id = disk_id - self.disk_name = disk_name - self.protection_stage = protection_stage - self.health_error_code = health_error_code - self.rpo_in_seconds = rpo_in_seconds - self.resync_required = resync_required - self.resync_progress_percentage = resync_progress_percentage - self.resync_duration_in_seconds = resync_duration_in_seconds - self.disk_capacity_in_bytes = disk_capacity_in_bytes - self.file_system_capacity_in_bytes = file_system_capacity_in_bytes - self.source_data_in_mb = source_data_in_mb - self.ps_data_in_mb = ps_data_in_mb - self.target_data_in_mb = target_data_in_mb - self.disk_resized = disk_resized - self.last_rpo_calculated_time = last_rpo_calculated_time - self.resync_processed_bytes = resync_processed_bytes - self.resync_total_transferred_bytes = resync_total_transferred_bytes - self.resync_last15_minutes_transferred_bytes = resync_last15_minutes_transferred_bytes - self.resync_last_data_transfer_time_utc = resync_last_data_transfer_time_utc - self.resync_start_time = resync_start_time - self.progress_health = progress_health - self.progress_status = progress_status - - -class InMageRcmAddDisksInput(AddDisksProviderSpecificInput): - """InMageRcm add disk(s) input. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - :ivar disks: The list of disk details. Required. - :vartype disks: list[~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmDiskInput] - """ - - _validation = { - "instance_type": {"required": True}, - "disks": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "disks": {"key": "disks", "type": "[InMageRcmDiskInput]"}, - } - - def __init__(self, *, disks: List["_models.InMageRcmDiskInput"], **kwargs: Any) -> None: - """ - :keyword disks: The list of disk details. Required. - :paramtype disks: list[~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmDiskInput] - """ - super().__init__(**kwargs) - self.instance_type: str = "InMageRcm" - self.disks = disks - - -class InMageRcmAgentUpgradeBlockingErrorDetails(_serialization.Model): # pylint: disable=name-too-long - """InMageRcm source agent upgrade blocking error details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar error_code: The error code. - :vartype error_code: str - :ivar error_message: The error message. - :vartype error_message: str - :ivar possible_causes: The possible causes. - :vartype possible_causes: str - :ivar recommended_action: The recommended action. - :vartype recommended_action: str - :ivar error_message_parameters: The error message parameters. - :vartype error_message_parameters: dict[str, str] - :ivar error_tags: The error tags. - :vartype error_tags: dict[str, str] - """ - - _validation = { - "error_code": {"readonly": True}, - "error_message": {"readonly": True}, - "possible_causes": {"readonly": True}, - "recommended_action": {"readonly": True}, - "error_message_parameters": {"readonly": True}, - "error_tags": {"readonly": True}, - } - - _attribute_map = { - "error_code": {"key": "errorCode", "type": "str"}, - "error_message": {"key": "errorMessage", "type": "str"}, - "possible_causes": {"key": "possibleCauses", "type": "str"}, - "recommended_action": {"key": "recommendedAction", "type": "str"}, - "error_message_parameters": {"key": "errorMessageParameters", "type": "{str}"}, - "error_tags": {"key": "errorTags", "type": "{str}"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.error_code: Optional[str] = None - self.error_message: Optional[str] = None - self.possible_causes: Optional[str] = None - self.recommended_action: Optional[str] = None - self.error_message_parameters: Optional[Dict[str, str]] = None - self.error_tags: Optional[Dict[str, str]] = None - - -class InMageRcmApplianceDetails(_serialization.Model): - """InMageRcm appliance details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The appliance Id. - :vartype id: str - :ivar name: The appliance name. - :vartype name: str - :ivar fabric_arm_id: The fabric ARM Id. - :vartype fabric_arm_id: str - :ivar process_server: The process server. - :vartype process_server: ~azure.mgmt.recoveryservicessiterecovery.models.ProcessServerDetails - :ivar rcm_proxy: The of RCM proxy. - :vartype rcm_proxy: ~azure.mgmt.recoveryservicessiterecovery.models.RcmProxyDetails - :ivar push_installer: The push installer. - :vartype push_installer: ~azure.mgmt.recoveryservicessiterecovery.models.PushInstallerDetails - :ivar replication_agent: The replication agent. - :vartype replication_agent: - ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationAgentDetails - :ivar reprotect_agent: The reprotect agent. - :vartype reprotect_agent: ~azure.mgmt.recoveryservicessiterecovery.models.ReprotectAgentDetails - :ivar mars_agent: The Mars agent. - :vartype mars_agent: ~azure.mgmt.recoveryservicessiterecovery.models.MarsAgentDetails - :ivar dra: The DRA. - :vartype dra: ~azure.mgmt.recoveryservicessiterecovery.models.DraDetails - :ivar switch_provider_blocking_error_details: The switch provider blocking error information. - :vartype switch_provider_blocking_error_details: - list[~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmFabricSwitchProviderBlockingErrorDetails] - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "fabric_arm_id": {"readonly": True}, - "process_server": {"readonly": True}, - "rcm_proxy": {"readonly": True}, - "push_installer": {"readonly": True}, - "replication_agent": {"readonly": True}, - "reprotect_agent": {"readonly": True}, - "mars_agent": {"readonly": True}, - "dra": {"readonly": True}, - "switch_provider_blocking_error_details": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "fabric_arm_id": {"key": "fabricArmId", "type": "str"}, - "process_server": {"key": "processServer", "type": "ProcessServerDetails"}, - "rcm_proxy": {"key": "rcmProxy", "type": "RcmProxyDetails"}, - "push_installer": {"key": "pushInstaller", "type": "PushInstallerDetails"}, - "replication_agent": {"key": "replicationAgent", "type": "ReplicationAgentDetails"}, - "reprotect_agent": {"key": "reprotectAgent", "type": "ReprotectAgentDetails"}, - "mars_agent": {"key": "marsAgent", "type": "MarsAgentDetails"}, - "dra": {"key": "dra", "type": "DraDetails"}, - "switch_provider_blocking_error_details": { - "key": "switchProviderBlockingErrorDetails", - "type": "[InMageRcmFabricSwitchProviderBlockingErrorDetails]", - }, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.id: Optional[str] = None - self.name: Optional[str] = None - self.fabric_arm_id: Optional[str] = None - self.process_server: Optional["_models.ProcessServerDetails"] = None - self.rcm_proxy: Optional["_models.RcmProxyDetails"] = None - self.push_installer: Optional["_models.PushInstallerDetails"] = None - self.replication_agent: Optional["_models.ReplicationAgentDetails"] = None - self.reprotect_agent: Optional["_models.ReprotectAgentDetails"] = None - self.mars_agent: Optional["_models.MarsAgentDetails"] = None - self.dra: Optional["_models.DraDetails"] = None - self.switch_provider_blocking_error_details: Optional[ - List["_models.InMageRcmFabricSwitchProviderBlockingErrorDetails"] - ] = None - - -class InMageRcmApplianceSpecificDetails(ApplianceSpecificDetails): - """InMageRcm appliance specific details. - - 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 instance_type: Gets the class type. Overridden in derived classes. Required. - :vartype instance_type: str - :ivar appliances: The list of appliances. - :vartype appliances: - list[~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmApplianceDetails] - """ - - _validation = { - "instance_type": {"required": True}, - "appliances": {"readonly": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "appliances": {"key": "appliances", "type": "[InMageRcmApplianceDetails]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.instance_type: str = "InMageRcm" - self.appliances: Optional[List["_models.InMageRcmApplianceDetails"]] = None - - -class InMageRcmApplyRecoveryPointInput(ApplyRecoveryPointProviderSpecificInput): - """ApplyRecoveryPoint input specific to InMageRcm provider. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - :ivar recovery_point_id: The recovery point Id. Required. - :vartype recovery_point_id: str - """ - - _validation = { - "instance_type": {"required": True}, - "recovery_point_id": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "recovery_point_id": {"key": "recoveryPointId", "type": "str"}, - } - - def __init__(self, *, recovery_point_id: str, **kwargs: Any) -> None: - """ - :keyword recovery_point_id: The recovery point Id. Required. - :paramtype recovery_point_id: str - """ - super().__init__(**kwargs) - self.instance_type: str = "InMageRcm" - self.recovery_point_id = recovery_point_id - - -class InMageRcmDiscoveredProtectedVmDetails(_serialization.Model): - """InMageRcm discovered protected VM details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar v_center_id: The VCenter Id. - :vartype v_center_id: str - :ivar v_center_fqdn: The VCenter fqdn. - :vartype v_center_fqdn: str - :ivar datastores: The list of datastores. - :vartype datastores: list[str] - :ivar ip_addresses: The list of IP addresses. - :vartype ip_addresses: list[str] - :ivar vmware_tools_status: The VMware tools status. - :vartype vmware_tools_status: str - :ivar power_status: The VM power status. - :vartype power_status: str - :ivar vm_fqdn: The VM fqdn. - :vartype vm_fqdn: str - :ivar os_name: The VM's OS name. - :vartype os_name: str - :ivar created_timestamp: The SDS created timestamp. - :vartype created_timestamp: ~datetime.datetime - :ivar updated_timestamp: The SDS updated timestamp. - :vartype updated_timestamp: ~datetime.datetime - :ivar is_deleted: A value indicating whether the VM is deleted. - :vartype is_deleted: bool - :ivar last_discovery_time_in_utc: The last time when SDS information discovered in SRS. - :vartype last_discovery_time_in_utc: ~datetime.datetime - """ - - _validation = { - "v_center_id": {"readonly": True}, - "v_center_fqdn": {"readonly": True}, - "datastores": {"readonly": True}, - "ip_addresses": {"readonly": True}, - "vmware_tools_status": {"readonly": True}, - "power_status": {"readonly": True}, - "vm_fqdn": {"readonly": True}, - "os_name": {"readonly": True}, - "created_timestamp": {"readonly": True}, - "updated_timestamp": {"readonly": True}, - "is_deleted": {"readonly": True}, - "last_discovery_time_in_utc": {"readonly": True}, - } - - _attribute_map = { - "v_center_id": {"key": "vCenterId", "type": "str"}, - "v_center_fqdn": {"key": "vCenterFqdn", "type": "str"}, - "datastores": {"key": "datastores", "type": "[str]"}, - "ip_addresses": {"key": "ipAddresses", "type": "[str]"}, - "vmware_tools_status": {"key": "vmwareToolsStatus", "type": "str"}, - "power_status": {"key": "powerStatus", "type": "str"}, - "vm_fqdn": {"key": "vmFqdn", "type": "str"}, - "os_name": {"key": "osName", "type": "str"}, - "created_timestamp": {"key": "createdTimestamp", "type": "iso-8601"}, - "updated_timestamp": {"key": "updatedTimestamp", "type": "iso-8601"}, - "is_deleted": {"key": "isDeleted", "type": "bool"}, - "last_discovery_time_in_utc": {"key": "lastDiscoveryTimeInUtc", "type": "iso-8601"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.v_center_id: Optional[str] = None - self.v_center_fqdn: Optional[str] = None - self.datastores: Optional[List[str]] = None - self.ip_addresses: Optional[List[str]] = None - self.vmware_tools_status: Optional[str] = None - self.power_status: Optional[str] = None - self.vm_fqdn: Optional[str] = None - self.os_name: Optional[str] = None - self.created_timestamp: Optional[datetime.datetime] = None - self.updated_timestamp: Optional[datetime.datetime] = None - self.is_deleted: Optional[bool] = None - self.last_discovery_time_in_utc: Optional[datetime.datetime] = None - - -class InMageRcmDiskInput(_serialization.Model): - """InMageRcm disk input. - - All required parameters must be populated in order to send to server. - - :ivar disk_id: The disk Id. Required. - :vartype disk_id: str - :ivar log_storage_account_id: The log storage account ARM Id. Required. - :vartype log_storage_account_id: str - :ivar disk_type: The disk type. Required. Known values are: "Standard_LRS", "Premium_LRS", - "StandardSSD_LRS", "PremiumV2_LRS", "UltraSSD_LRS", "StandardSSD_ZRS", and "Premium_ZRS". - :vartype disk_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.DiskAccountType - :ivar disk_encryption_set_id: The DiskEncryptionSet ARM Id. - :vartype disk_encryption_set_id: str - :ivar sector_size_in_bytes: The logical sector size (in bytes), 512 by default. - :vartype sector_size_in_bytes: int - """ - - _validation = { - "disk_id": {"required": True}, - "log_storage_account_id": {"required": True}, - "disk_type": {"required": True}, - } - - _attribute_map = { - "disk_id": {"key": "diskId", "type": "str"}, - "log_storage_account_id": {"key": "logStorageAccountId", "type": "str"}, - "disk_type": {"key": "diskType", "type": "str"}, - "disk_encryption_set_id": {"key": "diskEncryptionSetId", "type": "str"}, - "sector_size_in_bytes": {"key": "sectorSizeInBytes", "type": "int"}, - } - - def __init__( - self, - *, - disk_id: str, - log_storage_account_id: str, - disk_type: Union[str, "_models.DiskAccountType"], - disk_encryption_set_id: Optional[str] = None, - sector_size_in_bytes: Optional[int] = None, - **kwargs: Any - ) -> None: - """ - :keyword disk_id: The disk Id. Required. - :paramtype disk_id: str - :keyword log_storage_account_id: The log storage account ARM Id. Required. - :paramtype log_storage_account_id: str - :keyword disk_type: The disk type. Required. Known values are: "Standard_LRS", "Premium_LRS", - "StandardSSD_LRS", "PremiumV2_LRS", "UltraSSD_LRS", "StandardSSD_ZRS", and "Premium_ZRS". - :paramtype disk_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.DiskAccountType - :keyword disk_encryption_set_id: The DiskEncryptionSet ARM Id. - :paramtype disk_encryption_set_id: str - :keyword sector_size_in_bytes: The logical sector size (in bytes), 512 by default. - :paramtype sector_size_in_bytes: int - """ - super().__init__(**kwargs) - self.disk_id = disk_id - self.log_storage_account_id = log_storage_account_id - self.disk_type = disk_type - self.disk_encryption_set_id = disk_encryption_set_id - self.sector_size_in_bytes = sector_size_in_bytes - - -class InMageRcmDisksDefaultInput(_serialization.Model): - """InMageRcm disk input. - - All required parameters must be populated in order to send to server. - - :ivar log_storage_account_id: The log storage account ARM Id. Required. - :vartype log_storage_account_id: str - :ivar disk_type: The disk type. Required. Known values are: "Standard_LRS", "Premium_LRS", - "StandardSSD_LRS", "PremiumV2_LRS", "UltraSSD_LRS", "StandardSSD_ZRS", and "Premium_ZRS". - :vartype disk_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.DiskAccountType - :ivar disk_encryption_set_id: The DiskEncryptionSet ARM Id. - :vartype disk_encryption_set_id: str - :ivar sector_size_in_bytes: The logical sector size (in bytes), 512 by default. - :vartype sector_size_in_bytes: int - """ - - _validation = { - "log_storage_account_id": {"required": True}, - "disk_type": {"required": True}, - } - - _attribute_map = { - "log_storage_account_id": {"key": "logStorageAccountId", "type": "str"}, - "disk_type": {"key": "diskType", "type": "str"}, - "disk_encryption_set_id": {"key": "diskEncryptionSetId", "type": "str"}, - "sector_size_in_bytes": {"key": "sectorSizeInBytes", "type": "int"}, - } - - def __init__( - self, - *, - log_storage_account_id: str, - disk_type: Union[str, "_models.DiskAccountType"], - disk_encryption_set_id: Optional[str] = None, - sector_size_in_bytes: Optional[int] = None, - **kwargs: Any - ) -> None: - """ - :keyword log_storage_account_id: The log storage account ARM Id. Required. - :paramtype log_storage_account_id: str - :keyword disk_type: The disk type. Required. Known values are: "Standard_LRS", "Premium_LRS", - "StandardSSD_LRS", "PremiumV2_LRS", "UltraSSD_LRS", "StandardSSD_ZRS", and "Premium_ZRS". - :paramtype disk_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.DiskAccountType - :keyword disk_encryption_set_id: The DiskEncryptionSet ARM Id. - :paramtype disk_encryption_set_id: str - :keyword sector_size_in_bytes: The logical sector size (in bytes), 512 by default. - :paramtype sector_size_in_bytes: int - """ - super().__init__(**kwargs) - self.log_storage_account_id = log_storage_account_id - self.disk_type = disk_type - self.disk_encryption_set_id = disk_encryption_set_id - self.sector_size_in_bytes = sector_size_in_bytes - - -class InMageRcmEnableProtectionInput(EnableProtectionProviderSpecificInput): - """InMageRcm specific enable protection input. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - :ivar fabric_discovery_machine_id: The ARM Id of discovered machine. Required. - :vartype fabric_discovery_machine_id: str - :ivar disks_to_include: The disks to include list. - :vartype disks_to_include: - list[~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmDiskInput] - :ivar disks_default: The default disk input. - :vartype disks_default: - ~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmDisksDefaultInput - :ivar target_resource_group_id: The target resource group ARM Id. Required. - :vartype target_resource_group_id: str - :ivar target_network_id: The selected target network ARM Id. - :vartype target_network_id: str - :ivar test_network_id: The selected test network ARM Id. - :vartype test_network_id: str - :ivar target_subnet_name: The selected target subnet name. - :vartype target_subnet_name: str - :ivar test_subnet_name: The selected test subnet name. - :vartype test_subnet_name: str - :ivar target_vm_name: The target VM name. - :vartype target_vm_name: str - :ivar target_vm_size: The target VM size. - :vartype target_vm_size: str - :ivar license_type: The license type. Known values are: "NotSpecified", "NoLicenseType", and - "WindowsServer". - :vartype license_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.LicenseType - :ivar target_availability_set_id: The target availability set ARM Id. - :vartype target_availability_set_id: str - :ivar target_availability_zone: The target availability zone. - :vartype target_availability_zone: str - :ivar target_proximity_placement_group_id: The target proximity placement group Id. - :vartype target_proximity_placement_group_id: str - :ivar target_boot_diagnostics_storage_account_id: The target boot diagnostics storage account - ARM Id. - :vartype target_boot_diagnostics_storage_account_id: str - :ivar run_as_account_id: The run-as account Id. - :vartype run_as_account_id: str - :ivar process_server_id: The process server Id. Required. - :vartype process_server_id: str - :ivar multi_vm_group_name: The multi VM group name. - :vartype multi_vm_group_name: str - :ivar sql_server_license_type: The SQL Server license type. Known values are: "NotSpecified", - "NoLicenseType", "PAYG", and "AHUB". - :vartype sql_server_license_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.SqlServerLicenseType - :ivar linux_license_type: The license type for Linux VM's. Known values are: "NotSpecified", - "NoLicenseType", and "LinuxServer". - :vartype linux_license_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.LinuxLicenseType - :ivar target_vm_tags: The target VM tags. - :vartype target_vm_tags: - list[~azure.mgmt.recoveryservicessiterecovery.models.UserCreatedResourceTag] - :ivar seed_managed_disk_tags: The tags for the seed managed disks. - :vartype seed_managed_disk_tags: - list[~azure.mgmt.recoveryservicessiterecovery.models.UserCreatedResourceTag] - :ivar target_managed_disk_tags: The tags for the target managed disks. - :vartype target_managed_disk_tags: - list[~azure.mgmt.recoveryservicessiterecovery.models.UserCreatedResourceTag] - :ivar target_nic_tags: The tags for the target NICs. - :vartype target_nic_tags: - list[~azure.mgmt.recoveryservicessiterecovery.models.UserCreatedResourceTag] - :ivar user_selected_os_name: The OS name selected by user. - :vartype user_selected_os_name: str - :ivar target_vm_security_profile: The target VM security profile. - :vartype target_vm_security_profile: - ~azure.mgmt.recoveryservicessiterecovery.models.SecurityProfileProperties - """ - - _validation = { - "instance_type": {"required": True}, - "fabric_discovery_machine_id": {"required": True}, - "target_resource_group_id": {"required": True}, - "process_server_id": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "fabric_discovery_machine_id": {"key": "fabricDiscoveryMachineId", "type": "str"}, - "disks_to_include": {"key": "disksToInclude", "type": "[InMageRcmDiskInput]"}, - "disks_default": {"key": "disksDefault", "type": "InMageRcmDisksDefaultInput"}, - "target_resource_group_id": {"key": "targetResourceGroupId", "type": "str"}, - "target_network_id": {"key": "targetNetworkId", "type": "str"}, - "test_network_id": {"key": "testNetworkId", "type": "str"}, - "target_subnet_name": {"key": "targetSubnetName", "type": "str"}, - "test_subnet_name": {"key": "testSubnetName", "type": "str"}, - "target_vm_name": {"key": "targetVmName", "type": "str"}, - "target_vm_size": {"key": "targetVmSize", "type": "str"}, - "license_type": {"key": "licenseType", "type": "str"}, - "target_availability_set_id": {"key": "targetAvailabilitySetId", "type": "str"}, - "target_availability_zone": {"key": "targetAvailabilityZone", "type": "str"}, - "target_proximity_placement_group_id": {"key": "targetProximityPlacementGroupId", "type": "str"}, - "target_boot_diagnostics_storage_account_id": {"key": "targetBootDiagnosticsStorageAccountId", "type": "str"}, - "run_as_account_id": {"key": "runAsAccountId", "type": "str"}, - "process_server_id": {"key": "processServerId", "type": "str"}, - "multi_vm_group_name": {"key": "multiVmGroupName", "type": "str"}, - "sql_server_license_type": {"key": "sqlServerLicenseType", "type": "str"}, - "linux_license_type": {"key": "linuxLicenseType", "type": "str"}, - "target_vm_tags": {"key": "targetVmTags", "type": "[UserCreatedResourceTag]"}, - "seed_managed_disk_tags": {"key": "seedManagedDiskTags", "type": "[UserCreatedResourceTag]"}, - "target_managed_disk_tags": {"key": "targetManagedDiskTags", "type": "[UserCreatedResourceTag]"}, - "target_nic_tags": {"key": "targetNicTags", "type": "[UserCreatedResourceTag]"}, - "user_selected_os_name": {"key": "userSelectedOSName", "type": "str"}, - "target_vm_security_profile": {"key": "targetVmSecurityProfile", "type": "SecurityProfileProperties"}, - } - - def __init__( # pylint: disable=too-many-locals - self, - *, - fabric_discovery_machine_id: str, - target_resource_group_id: str, - process_server_id: str, - disks_to_include: Optional[List["_models.InMageRcmDiskInput"]] = None, - disks_default: Optional["_models.InMageRcmDisksDefaultInput"] = None, - target_network_id: Optional[str] = None, - test_network_id: Optional[str] = None, - target_subnet_name: Optional[str] = None, - test_subnet_name: Optional[str] = None, - target_vm_name: Optional[str] = None, - target_vm_size: Optional[str] = None, - license_type: Optional[Union[str, "_models.LicenseType"]] = None, - target_availability_set_id: Optional[str] = None, - target_availability_zone: Optional[str] = None, - target_proximity_placement_group_id: Optional[str] = None, - target_boot_diagnostics_storage_account_id: Optional[str] = None, - run_as_account_id: Optional[str] = None, - multi_vm_group_name: Optional[str] = None, - sql_server_license_type: Optional[Union[str, "_models.SqlServerLicenseType"]] = None, - linux_license_type: Optional[Union[str, "_models.LinuxLicenseType"]] = None, - target_vm_tags: Optional[List["_models.UserCreatedResourceTag"]] = None, - seed_managed_disk_tags: Optional[List["_models.UserCreatedResourceTag"]] = None, - target_managed_disk_tags: Optional[List["_models.UserCreatedResourceTag"]] = None, - target_nic_tags: Optional[List["_models.UserCreatedResourceTag"]] = None, - user_selected_os_name: Optional[str] = None, - target_vm_security_profile: Optional["_models.SecurityProfileProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword fabric_discovery_machine_id: The ARM Id of discovered machine. Required. - :paramtype fabric_discovery_machine_id: str - :keyword disks_to_include: The disks to include list. - :paramtype disks_to_include: - list[~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmDiskInput] - :keyword disks_default: The default disk input. - :paramtype disks_default: - ~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmDisksDefaultInput - :keyword target_resource_group_id: The target resource group ARM Id. Required. - :paramtype target_resource_group_id: str - :keyword target_network_id: The selected target network ARM Id. - :paramtype target_network_id: str - :keyword test_network_id: The selected test network ARM Id. - :paramtype test_network_id: str - :keyword target_subnet_name: The selected target subnet name. - :paramtype target_subnet_name: str - :keyword test_subnet_name: The selected test subnet name. - :paramtype test_subnet_name: str - :keyword target_vm_name: The target VM name. - :paramtype target_vm_name: str - :keyword target_vm_size: The target VM size. - :paramtype target_vm_size: str - :keyword license_type: The license type. Known values are: "NotSpecified", "NoLicenseType", and - "WindowsServer". - :paramtype license_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.LicenseType - :keyword target_availability_set_id: The target availability set ARM Id. - :paramtype target_availability_set_id: str - :keyword target_availability_zone: The target availability zone. - :paramtype target_availability_zone: str - :keyword target_proximity_placement_group_id: The target proximity placement group Id. - :paramtype target_proximity_placement_group_id: str - :keyword target_boot_diagnostics_storage_account_id: The target boot diagnostics storage - account ARM Id. - :paramtype target_boot_diagnostics_storage_account_id: str - :keyword run_as_account_id: The run-as account Id. - :paramtype run_as_account_id: str - :keyword process_server_id: The process server Id. Required. - :paramtype process_server_id: str - :keyword multi_vm_group_name: The multi VM group name. - :paramtype multi_vm_group_name: str - :keyword sql_server_license_type: The SQL Server license type. Known values are: - "NotSpecified", "NoLicenseType", "PAYG", and "AHUB". - :paramtype sql_server_license_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.SqlServerLicenseType - :keyword linux_license_type: The license type for Linux VM's. Known values are: "NotSpecified", - "NoLicenseType", and "LinuxServer". - :paramtype linux_license_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.LinuxLicenseType - :keyword target_vm_tags: The target VM tags. - :paramtype target_vm_tags: - list[~azure.mgmt.recoveryservicessiterecovery.models.UserCreatedResourceTag] - :keyword seed_managed_disk_tags: The tags for the seed managed disks. - :paramtype seed_managed_disk_tags: - list[~azure.mgmt.recoveryservicessiterecovery.models.UserCreatedResourceTag] - :keyword target_managed_disk_tags: The tags for the target managed disks. - :paramtype target_managed_disk_tags: - list[~azure.mgmt.recoveryservicessiterecovery.models.UserCreatedResourceTag] - :keyword target_nic_tags: The tags for the target NICs. - :paramtype target_nic_tags: - list[~azure.mgmt.recoveryservicessiterecovery.models.UserCreatedResourceTag] - :keyword user_selected_os_name: The OS name selected by user. - :paramtype user_selected_os_name: str - :keyword target_vm_security_profile: The target VM security profile. - :paramtype target_vm_security_profile: - ~azure.mgmt.recoveryservicessiterecovery.models.SecurityProfileProperties - """ - super().__init__(**kwargs) - self.instance_type: str = "InMageRcm" - self.fabric_discovery_machine_id = fabric_discovery_machine_id - self.disks_to_include = disks_to_include - self.disks_default = disks_default - self.target_resource_group_id = target_resource_group_id - self.target_network_id = target_network_id - self.test_network_id = test_network_id - self.target_subnet_name = target_subnet_name - self.test_subnet_name = test_subnet_name - self.target_vm_name = target_vm_name - self.target_vm_size = target_vm_size - self.license_type = license_type - self.target_availability_set_id = target_availability_set_id - self.target_availability_zone = target_availability_zone - self.target_proximity_placement_group_id = target_proximity_placement_group_id - self.target_boot_diagnostics_storage_account_id = target_boot_diagnostics_storage_account_id - self.run_as_account_id = run_as_account_id - self.process_server_id = process_server_id - self.multi_vm_group_name = multi_vm_group_name - self.sql_server_license_type = sql_server_license_type - self.linux_license_type = linux_license_type - self.target_vm_tags = target_vm_tags - self.seed_managed_disk_tags = seed_managed_disk_tags - self.target_managed_disk_tags = target_managed_disk_tags - self.target_nic_tags = target_nic_tags - self.user_selected_os_name = user_selected_os_name - self.target_vm_security_profile = target_vm_security_profile - - -class InMageRcmEventDetails(EventProviderSpecificDetails): - """Event details for InMageRcm provider. - - 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 instance_type: Gets the class type. Overridden in derived classes. Required. - :vartype instance_type: str - :ivar protected_item_name: The protected item name. - :vartype protected_item_name: str - :ivar vm_name: The protected item name. - :vartype vm_name: str - :ivar latest_agent_version: The latest agent version. - :vartype latest_agent_version: str - :ivar job_id: The job Id. - :vartype job_id: str - :ivar fabric_name: The fabric name. - :vartype fabric_name: str - :ivar appliance_name: The appliance name. - :vartype appliance_name: str - :ivar server_type: The server type. - :vartype server_type: str - :ivar component_display_name: The component display name. - :vartype component_display_name: str - """ - - _validation = { - "instance_type": {"required": True}, - "protected_item_name": {"readonly": True}, - "vm_name": {"readonly": True}, - "latest_agent_version": {"readonly": True}, - "job_id": {"readonly": True}, - "fabric_name": {"readonly": True}, - "appliance_name": {"readonly": True}, - "server_type": {"readonly": True}, - "component_display_name": {"readonly": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "protected_item_name": {"key": "protectedItemName", "type": "str"}, - "vm_name": {"key": "vmName", "type": "str"}, - "latest_agent_version": {"key": "latestAgentVersion", "type": "str"}, - "job_id": {"key": "jobId", "type": "str"}, - "fabric_name": {"key": "fabricName", "type": "str"}, - "appliance_name": {"key": "applianceName", "type": "str"}, - "server_type": {"key": "serverType", "type": "str"}, - "component_display_name": {"key": "componentDisplayName", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.instance_type: str = "InMageRcm" - self.protected_item_name: Optional[str] = None - self.vm_name: Optional[str] = None - self.latest_agent_version: Optional[str] = None - self.job_id: Optional[str] = None - self.fabric_name: Optional[str] = None - self.appliance_name: Optional[str] = None - self.server_type: Optional[str] = None - self.component_display_name: Optional[str] = None - - -class InMageRcmFabricCreationInput(FabricSpecificCreationInput): - """InMageRcm fabric provider specific settings. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: Gets the class type. Required. - :vartype instance_type: str - :ivar vmware_site_id: The ARM Id of the VMware site. Required. - :vartype vmware_site_id: str - :ivar physical_site_id: The ARM Id of the physical site. Required. - :vartype physical_site_id: str - :ivar source_agent_identity: The identity provider input for source agent authentication. - Required. - :vartype source_agent_identity: - ~azure.mgmt.recoveryservicessiterecovery.models.IdentityProviderInput - """ - - _validation = { - "instance_type": {"required": True}, - "vmware_site_id": {"required": True}, - "physical_site_id": {"required": True}, - "source_agent_identity": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "vmware_site_id": {"key": "vmwareSiteId", "type": "str"}, - "physical_site_id": {"key": "physicalSiteId", "type": "str"}, - "source_agent_identity": {"key": "sourceAgentIdentity", "type": "IdentityProviderInput"}, - } - - def __init__( - self, - *, - vmware_site_id: str, - physical_site_id: str, - source_agent_identity: "_models.IdentityProviderInput", - **kwargs: Any - ) -> None: - """ - :keyword vmware_site_id: The ARM Id of the VMware site. Required. - :paramtype vmware_site_id: str - :keyword physical_site_id: The ARM Id of the physical site. Required. - :paramtype physical_site_id: str - :keyword source_agent_identity: The identity provider input for source agent authentication. - Required. - :paramtype source_agent_identity: - ~azure.mgmt.recoveryservicessiterecovery.models.IdentityProviderInput - """ - super().__init__(**kwargs) - self.instance_type: str = "InMageRcm" - self.vmware_site_id = vmware_site_id - self.physical_site_id = physical_site_id - self.source_agent_identity = source_agent_identity - - -class InMageRcmFabricSpecificDetails(FabricSpecificDetails): - """InMageRcm fabric specific details. - - 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 instance_type: Gets the class type. Overridden in derived classes. Required. - :vartype instance_type: str - :ivar vmware_site_id: The ARM Id of the VMware site. - :vartype vmware_site_id: str - :ivar physical_site_id: The ARM Id of the physical site. - :vartype physical_site_id: str - :ivar service_endpoint: The service endpoint. - :vartype service_endpoint: str - :ivar service_resource_id: The service resource Id. - :vartype service_resource_id: str - :ivar service_container_id: The service container Id. - :vartype service_container_id: str - :ivar data_plane_uri: The data plane Uri. - :vartype data_plane_uri: str - :ivar control_plane_uri: The control plane Uri. - :vartype control_plane_uri: str - :ivar source_agent_identity_details: The source agent identity details. - :vartype source_agent_identity_details: - ~azure.mgmt.recoveryservicessiterecovery.models.IdentityProviderDetails - :ivar process_servers: The list of process servers. - :vartype process_servers: - list[~azure.mgmt.recoveryservicessiterecovery.models.ProcessServerDetails] - :ivar rcm_proxies: The list of RCM proxies. - :vartype rcm_proxies: list[~azure.mgmt.recoveryservicessiterecovery.models.RcmProxyDetails] - :ivar push_installers: The list of push installers. - :vartype push_installers: - list[~azure.mgmt.recoveryservicessiterecovery.models.PushInstallerDetails] - :ivar replication_agents: The list of replication agents. - :vartype replication_agents: - list[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationAgentDetails] - :ivar reprotect_agents: The list of reprotect agents. - :vartype reprotect_agents: - list[~azure.mgmt.recoveryservicessiterecovery.models.ReprotectAgentDetails] - :ivar mars_agents: The list of Mars agents. - :vartype mars_agents: list[~azure.mgmt.recoveryservicessiterecovery.models.MarsAgentDetails] - :ivar dras: The list of DRAs. - :vartype dras: list[~azure.mgmt.recoveryservicessiterecovery.models.DraDetails] - :ivar agent_details: The list of agent details. - :vartype agent_details: list[~azure.mgmt.recoveryservicessiterecovery.models.AgentDetails] - """ - - _validation = { - "instance_type": {"required": True}, - "vmware_site_id": {"readonly": True}, - "physical_site_id": {"readonly": True}, - "service_endpoint": {"readonly": True}, - "service_resource_id": {"readonly": True}, - "service_container_id": {"readonly": True}, - "data_plane_uri": {"readonly": True}, - "control_plane_uri": {"readonly": True}, - "process_servers": {"readonly": True}, - "rcm_proxies": {"readonly": True}, - "push_installers": {"readonly": True}, - "replication_agents": {"readonly": True}, - "reprotect_agents": {"readonly": True}, - "mars_agents": {"readonly": True}, - "dras": {"readonly": True}, - "agent_details": {"readonly": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "vmware_site_id": {"key": "vmwareSiteId", "type": "str"}, - "physical_site_id": {"key": "physicalSiteId", "type": "str"}, - "service_endpoint": {"key": "serviceEndpoint", "type": "str"}, - "service_resource_id": {"key": "serviceResourceId", "type": "str"}, - "service_container_id": {"key": "serviceContainerId", "type": "str"}, - "data_plane_uri": {"key": "dataPlaneUri", "type": "str"}, - "control_plane_uri": {"key": "controlPlaneUri", "type": "str"}, - "source_agent_identity_details": {"key": "sourceAgentIdentityDetails", "type": "IdentityProviderDetails"}, - "process_servers": {"key": "processServers", "type": "[ProcessServerDetails]"}, - "rcm_proxies": {"key": "rcmProxies", "type": "[RcmProxyDetails]"}, - "push_installers": {"key": "pushInstallers", "type": "[PushInstallerDetails]"}, - "replication_agents": {"key": "replicationAgents", "type": "[ReplicationAgentDetails]"}, - "reprotect_agents": {"key": "reprotectAgents", "type": "[ReprotectAgentDetails]"}, - "mars_agents": {"key": "marsAgents", "type": "[MarsAgentDetails]"}, - "dras": {"key": "dras", "type": "[DraDetails]"}, - "agent_details": {"key": "agentDetails", "type": "[AgentDetails]"}, - } - - def __init__( - self, *, source_agent_identity_details: Optional["_models.IdentityProviderDetails"] = None, **kwargs: Any - ) -> None: - """ - :keyword source_agent_identity_details: The source agent identity details. - :paramtype source_agent_identity_details: - ~azure.mgmt.recoveryservicessiterecovery.models.IdentityProviderDetails - """ - super().__init__(**kwargs) - self.instance_type: str = "InMageRcm" - self.vmware_site_id: Optional[str] = None - self.physical_site_id: Optional[str] = None - self.service_endpoint: Optional[str] = None - self.service_resource_id: Optional[str] = None - self.service_container_id: Optional[str] = None - self.data_plane_uri: Optional[str] = None - self.control_plane_uri: Optional[str] = None - self.source_agent_identity_details = source_agent_identity_details - self.process_servers: Optional[List["_models.ProcessServerDetails"]] = None - self.rcm_proxies: Optional[List["_models.RcmProxyDetails"]] = None - self.push_installers: Optional[List["_models.PushInstallerDetails"]] = None - self.replication_agents: Optional[List["_models.ReplicationAgentDetails"]] = None - self.reprotect_agents: Optional[List["_models.ReprotectAgentDetails"]] = None - self.mars_agents: Optional[List["_models.MarsAgentDetails"]] = None - self.dras: Optional[List["_models.DraDetails"]] = None - self.agent_details: Optional[List["_models.AgentDetails"]] = None - - -class InMageRcmFabricSwitchProviderBlockingErrorDetails(_serialization.Model): # pylint: disable=name-too-long - """InMageRcmFabric switch provider blocking error details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar error_code: The error code. - :vartype error_code: str - :ivar error_message: The error message. - :vartype error_message: str - :ivar possible_causes: The possible causes. - :vartype possible_causes: str - :ivar recommended_action: The recommended action. - :vartype recommended_action: str - :ivar error_message_parameters: The error message parameters. - :vartype error_message_parameters: dict[str, str] - :ivar error_tags: The error tags. - :vartype error_tags: dict[str, str] - """ - - _validation = { - "error_code": {"readonly": True}, - "error_message": {"readonly": True}, - "possible_causes": {"readonly": True}, - "recommended_action": {"readonly": True}, - "error_message_parameters": {"readonly": True}, - "error_tags": {"readonly": True}, - } - - _attribute_map = { - "error_code": {"key": "errorCode", "type": "str"}, - "error_message": {"key": "errorMessage", "type": "str"}, - "possible_causes": {"key": "possibleCauses", "type": "str"}, - "recommended_action": {"key": "recommendedAction", "type": "str"}, - "error_message_parameters": {"key": "errorMessageParameters", "type": "{str}"}, - "error_tags": {"key": "errorTags", "type": "{str}"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.error_code: Optional[str] = None - self.error_message: Optional[str] = None - self.possible_causes: Optional[str] = None - self.recommended_action: Optional[str] = None - self.error_message_parameters: Optional[Dict[str, str]] = None - self.error_tags: Optional[Dict[str, str]] = None - - -class InMageRcmFailbackDiscoveredProtectedVmDetails(_serialization.Model): # pylint: disable=name-too-long - """InMageRcmFailback discovered VM details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar v_center_id: The VCenter Id. - :vartype v_center_id: str - :ivar v_center_fqdn: The VCenter fqdn. - :vartype v_center_fqdn: str - :ivar datastores: The list of datastores. - :vartype datastores: list[str] - :ivar ip_addresses: The list of IP addresses. - :vartype ip_addresses: list[str] - :ivar vmware_tools_status: The VMware tools status. - :vartype vmware_tools_status: str - :ivar power_status: The VM power status. - :vartype power_status: str - :ivar vm_fqdn: The VM fqdn. - :vartype vm_fqdn: str - :ivar os_name: The VM's OS name. - :vartype os_name: str - :ivar created_timestamp: The SDS created timestamp. - :vartype created_timestamp: ~datetime.datetime - :ivar updated_timestamp: The SDS updated timestamp. - :vartype updated_timestamp: ~datetime.datetime - :ivar is_deleted: A value indicating whether the VM is deleted. - :vartype is_deleted: bool - :ivar last_discovery_time_in_utc: The last time when SDS information discovered in SRS. - :vartype last_discovery_time_in_utc: ~datetime.datetime - """ - - _validation = { - "v_center_id": {"readonly": True}, - "v_center_fqdn": {"readonly": True}, - "datastores": {"readonly": True}, - "ip_addresses": {"readonly": True}, - "vmware_tools_status": {"readonly": True}, - "power_status": {"readonly": True}, - "vm_fqdn": {"readonly": True}, - "os_name": {"readonly": True}, - "created_timestamp": {"readonly": True}, - "updated_timestamp": {"readonly": True}, - "is_deleted": {"readonly": True}, - "last_discovery_time_in_utc": {"readonly": True}, - } - - _attribute_map = { - "v_center_id": {"key": "vCenterId", "type": "str"}, - "v_center_fqdn": {"key": "vCenterFqdn", "type": "str"}, - "datastores": {"key": "datastores", "type": "[str]"}, - "ip_addresses": {"key": "ipAddresses", "type": "[str]"}, - "vmware_tools_status": {"key": "vmwareToolsStatus", "type": "str"}, - "power_status": {"key": "powerStatus", "type": "str"}, - "vm_fqdn": {"key": "vmFqdn", "type": "str"}, - "os_name": {"key": "osName", "type": "str"}, - "created_timestamp": {"key": "createdTimestamp", "type": "iso-8601"}, - "updated_timestamp": {"key": "updatedTimestamp", "type": "iso-8601"}, - "is_deleted": {"key": "isDeleted", "type": "bool"}, - "last_discovery_time_in_utc": {"key": "lastDiscoveryTimeInUtc", "type": "iso-8601"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.v_center_id: Optional[str] = None - self.v_center_fqdn: Optional[str] = None - self.datastores: Optional[List[str]] = None - self.ip_addresses: Optional[List[str]] = None - self.vmware_tools_status: Optional[str] = None - self.power_status: Optional[str] = None - self.vm_fqdn: Optional[str] = None - self.os_name: Optional[str] = None - self.created_timestamp: Optional[datetime.datetime] = None - self.updated_timestamp: Optional[datetime.datetime] = None - self.is_deleted: Optional[bool] = None - self.last_discovery_time_in_utc: Optional[datetime.datetime] = None - - -class InMageRcmFailbackEventDetails(EventProviderSpecificDetails): - """Event details for InMageRcmFailback provider. - - 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 instance_type: Gets the class type. Overridden in derived classes. Required. - :vartype instance_type: str - :ivar protected_item_name: The protected item name. - :vartype protected_item_name: str - :ivar vm_name: The protected item name. - :vartype vm_name: str - :ivar appliance_name: The appliance name. - :vartype appliance_name: str - :ivar server_type: The server type. - :vartype server_type: str - :ivar component_display_name: The component display name. - :vartype component_display_name: str - """ - - _validation = { - "instance_type": {"required": True}, - "protected_item_name": {"readonly": True}, - "vm_name": {"readonly": True}, - "appliance_name": {"readonly": True}, - "server_type": {"readonly": True}, - "component_display_name": {"readonly": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "protected_item_name": {"key": "protectedItemName", "type": "str"}, - "vm_name": {"key": "vmName", "type": "str"}, - "appliance_name": {"key": "applianceName", "type": "str"}, - "server_type": {"key": "serverType", "type": "str"}, - "component_display_name": {"key": "componentDisplayName", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.instance_type: str = "InMageRcmFailback" - self.protected_item_name: Optional[str] = None - self.vm_name: Optional[str] = None - self.appliance_name: Optional[str] = None - self.server_type: Optional[str] = None - self.component_display_name: Optional[str] = None - - -class InMageRcmFailbackMobilityAgentDetails(_serialization.Model): - """InMageRcmFailback mobility agent details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar version: The agent version. - :vartype version: str - :ivar latest_version: The latest agent version available. - :vartype latest_version: str - :ivar driver_version: The driver version. - :vartype driver_version: str - :ivar latest_upgradable_version_without_reboot: The latest upgradeable version available - without reboot. - :vartype latest_upgradable_version_without_reboot: str - :ivar agent_version_expiry_date: The agent version expiry date. - :vartype agent_version_expiry_date: ~datetime.datetime - :ivar driver_version_expiry_date: The driver version expiry date. - :vartype driver_version_expiry_date: ~datetime.datetime - :ivar last_heartbeat_utc: The time of the last heartbeat received from the agent. - :vartype last_heartbeat_utc: ~datetime.datetime - :ivar reasons_blocking_upgrade: The whether update is possible or not. - :vartype reasons_blocking_upgrade: list[str or - ~azure.mgmt.recoveryservicessiterecovery.models.AgentUpgradeBlockedReason] - :ivar is_upgradeable: A value indicating whether agent is upgradeable or not. - :vartype is_upgradeable: str - """ - - _validation = { - "version": {"readonly": True}, - "latest_version": {"readonly": True}, - "driver_version": {"readonly": True}, - "latest_upgradable_version_without_reboot": {"readonly": True}, - "agent_version_expiry_date": {"readonly": True}, - "driver_version_expiry_date": {"readonly": True}, - "last_heartbeat_utc": {"readonly": True}, - "reasons_blocking_upgrade": {"readonly": True}, - "is_upgradeable": {"readonly": True}, - } - - _attribute_map = { - "version": {"key": "version", "type": "str"}, - "latest_version": {"key": "latestVersion", "type": "str"}, - "driver_version": {"key": "driverVersion", "type": "str"}, - "latest_upgradable_version_without_reboot": {"key": "latestUpgradableVersionWithoutReboot", "type": "str"}, - "agent_version_expiry_date": {"key": "agentVersionExpiryDate", "type": "iso-8601"}, - "driver_version_expiry_date": {"key": "driverVersionExpiryDate", "type": "iso-8601"}, - "last_heartbeat_utc": {"key": "lastHeartbeatUtc", "type": "iso-8601"}, - "reasons_blocking_upgrade": {"key": "reasonsBlockingUpgrade", "type": "[str]"}, - "is_upgradeable": {"key": "isUpgradeable", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.version: Optional[str] = None - self.latest_version: Optional[str] = None - self.driver_version: Optional[str] = None - self.latest_upgradable_version_without_reboot: Optional[str] = None - self.agent_version_expiry_date: Optional[datetime.datetime] = None - self.driver_version_expiry_date: Optional[datetime.datetime] = None - self.last_heartbeat_utc: Optional[datetime.datetime] = None - self.reasons_blocking_upgrade: Optional[List[Union[str, "_models.AgentUpgradeBlockedReason"]]] = None - self.is_upgradeable: Optional[str] = None - - -class InMageRcmFailbackNicDetails(_serialization.Model): - """InMageRcmFailback NIC details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar mac_address: The mac address. - :vartype mac_address: str - :ivar network_name: The network name. - :vartype network_name: str - :ivar adapter_type: The adapter type. - :vartype adapter_type: str - :ivar source_ip_address: The IP address. - :vartype source_ip_address: str - """ - - _validation = { - "mac_address": {"readonly": True}, - "network_name": {"readonly": True}, - "adapter_type": {"readonly": True}, - "source_ip_address": {"readonly": True}, - } - - _attribute_map = { - "mac_address": {"key": "macAddress", "type": "str"}, - "network_name": {"key": "networkName", "type": "str"}, - "adapter_type": {"key": "adapterType", "type": "str"}, - "source_ip_address": {"key": "sourceIpAddress", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.mac_address: Optional[str] = None - self.network_name: Optional[str] = None - self.adapter_type: Optional[str] = None - self.source_ip_address: Optional[str] = None - - -class InMageRcmFailbackPlannedFailoverProviderInput( - PlannedFailoverProviderSpecificFailoverInput -): # pylint: disable=name-too-long - """Provider specific input for InMageRcmFailback failover. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - :ivar recovery_point_type: The recovery point type. Required. Known values are: - "ApplicationConsistent" and "CrashConsistent". - :vartype recovery_point_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmFailbackRecoveryPointType - """ - - _validation = { - "instance_type": {"required": True}, - "recovery_point_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "recovery_point_type": {"key": "recoveryPointType", "type": "str"}, - } - - def __init__( - self, *, recovery_point_type: Union[str, "_models.InMageRcmFailbackRecoveryPointType"], **kwargs: Any - ) -> None: - """ - :keyword recovery_point_type: The recovery point type. Required. Known values are: - "ApplicationConsistent" and "CrashConsistent". - :paramtype recovery_point_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmFailbackRecoveryPointType - """ - super().__init__(**kwargs) - self.instance_type: str = "InMageRcmFailback" - self.recovery_point_type = recovery_point_type - - -class InMageRcmFailbackPolicyCreationInput(PolicyProviderSpecificInput): - """InMageRcmFailback policy creation input. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - :ivar crash_consistent_frequency_in_minutes: The crash consistent snapshot frequency (in - minutes). - :vartype crash_consistent_frequency_in_minutes: int - :ivar app_consistent_frequency_in_minutes: The app consistent snapshot frequency (in minutes). - :vartype app_consistent_frequency_in_minutes: int - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "crash_consistent_frequency_in_minutes": {"key": "crashConsistentFrequencyInMinutes", "type": "int"}, - "app_consistent_frequency_in_minutes": {"key": "appConsistentFrequencyInMinutes", "type": "int"}, - } - - def __init__( - self, - *, - crash_consistent_frequency_in_minutes: Optional[int] = None, - app_consistent_frequency_in_minutes: Optional[int] = None, - **kwargs: Any - ) -> None: - """ - :keyword crash_consistent_frequency_in_minutes: The crash consistent snapshot frequency (in - minutes). - :paramtype crash_consistent_frequency_in_minutes: int - :keyword app_consistent_frequency_in_minutes: The app consistent snapshot frequency (in - minutes). - :paramtype app_consistent_frequency_in_minutes: int - """ - super().__init__(**kwargs) - self.instance_type: str = "InMageRcmFailback" - self.crash_consistent_frequency_in_minutes = crash_consistent_frequency_in_minutes - self.app_consistent_frequency_in_minutes = app_consistent_frequency_in_minutes - - -class InMageRcmFailbackPolicyDetails(PolicyProviderSpecificDetails): - """InMageRcm failback specific policy details. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: Gets the class type. Overridden in derived classes. Required. - :vartype instance_type: str - :ivar app_consistent_frequency_in_minutes: The app consistent snapshot frequency in minutes. - :vartype app_consistent_frequency_in_minutes: int - :ivar crash_consistent_frequency_in_minutes: The crash consistent snapshot frequency in - minutes. - :vartype crash_consistent_frequency_in_minutes: int - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "app_consistent_frequency_in_minutes": {"key": "appConsistentFrequencyInMinutes", "type": "int"}, - "crash_consistent_frequency_in_minutes": {"key": "crashConsistentFrequencyInMinutes", "type": "int"}, - } - - def __init__( - self, - *, - app_consistent_frequency_in_minutes: Optional[int] = None, - crash_consistent_frequency_in_minutes: Optional[int] = None, - **kwargs: Any - ) -> None: - """ - :keyword app_consistent_frequency_in_minutes: The app consistent snapshot frequency in minutes. - :paramtype app_consistent_frequency_in_minutes: int - :keyword crash_consistent_frequency_in_minutes: The crash consistent snapshot frequency in - minutes. - :paramtype crash_consistent_frequency_in_minutes: int - """ - super().__init__(**kwargs) - self.instance_type: str = "InMageRcmFailback" - self.app_consistent_frequency_in_minutes = app_consistent_frequency_in_minutes - self.crash_consistent_frequency_in_minutes = crash_consistent_frequency_in_minutes - - -class InMageRcmFailbackProtectedDiskDetails(_serialization.Model): - """InMageRcmFailback protected disk details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar disk_id: The disk Id (reported by source agent). - :vartype disk_id: str - :ivar disk_name: The disk name. - :vartype disk_name: str - :ivar is_os_disk: A value indicating whether the disk is the OS disk. - :vartype is_os_disk: str - :ivar capacity_in_bytes: The disk capacity in bytes. - :vartype capacity_in_bytes: int - :ivar disk_uuid: The disk Uuid (reported by vCenter). - :vartype disk_uuid: str - :ivar data_pending_in_log_data_store_in_mb: The data pending in log data store in MB. - :vartype data_pending_in_log_data_store_in_mb: float - :ivar data_pending_at_source_agent_in_mb: The data pending at source agent in MB. - :vartype data_pending_at_source_agent_in_mb: float - :ivar is_initial_replication_complete: A value indicating whether initial replication is - complete or not. - :vartype is_initial_replication_complete: str - :ivar ir_details: The initial replication details. - :vartype ir_details: - ~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmFailbackSyncDetails - :ivar resync_details: The resync details. - :vartype resync_details: - ~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmFailbackSyncDetails - :ivar last_sync_time: The last sync time. - :vartype last_sync_time: ~datetime.datetime - """ - - _validation = { - "disk_id": {"readonly": True}, - "disk_name": {"readonly": True}, - "is_os_disk": {"readonly": True}, - "capacity_in_bytes": {"readonly": True}, - "disk_uuid": {"readonly": True}, - "data_pending_in_log_data_store_in_mb": {"readonly": True}, - "data_pending_at_source_agent_in_mb": {"readonly": True}, - "is_initial_replication_complete": {"readonly": True}, - "last_sync_time": {"readonly": True}, - } - - _attribute_map = { - "disk_id": {"key": "diskId", "type": "str"}, - "disk_name": {"key": "diskName", "type": "str"}, - "is_os_disk": {"key": "isOSDisk", "type": "str"}, - "capacity_in_bytes": {"key": "capacityInBytes", "type": "int"}, - "disk_uuid": {"key": "diskUuid", "type": "str"}, - "data_pending_in_log_data_store_in_mb": {"key": "dataPendingInLogDataStoreInMB", "type": "float"}, - "data_pending_at_source_agent_in_mb": {"key": "dataPendingAtSourceAgentInMB", "type": "float"}, - "is_initial_replication_complete": {"key": "isInitialReplicationComplete", "type": "str"}, - "ir_details": {"key": "irDetails", "type": "InMageRcmFailbackSyncDetails"}, - "resync_details": {"key": "resyncDetails", "type": "InMageRcmFailbackSyncDetails"}, - "last_sync_time": {"key": "lastSyncTime", "type": "iso-8601"}, - } - - def __init__( - self, - *, - ir_details: Optional["_models.InMageRcmFailbackSyncDetails"] = None, - resync_details: Optional["_models.InMageRcmFailbackSyncDetails"] = None, - **kwargs: Any - ) -> None: - """ - :keyword ir_details: The initial replication details. - :paramtype ir_details: - ~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmFailbackSyncDetails - :keyword resync_details: The resync details. - :paramtype resync_details: - ~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmFailbackSyncDetails - """ - super().__init__(**kwargs) - self.disk_id: Optional[str] = None - self.disk_name: Optional[str] = None - self.is_os_disk: Optional[str] = None - self.capacity_in_bytes: Optional[int] = None - self.disk_uuid: Optional[str] = None - self.data_pending_in_log_data_store_in_mb: Optional[float] = None - self.data_pending_at_source_agent_in_mb: Optional[float] = None - self.is_initial_replication_complete: Optional[str] = None - self.ir_details = ir_details - self.resync_details = resync_details - self.last_sync_time: Optional[datetime.datetime] = None - - -class InMageRcmFailbackReplicationDetails(ReplicationProviderSpecificSettings): - """InMageRcmFailback provider specific details. - - 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 instance_type: Gets the Instance type. Required. - :vartype instance_type: str - :ivar internal_identifier: The virtual machine internal identifier. - :vartype internal_identifier: str - :ivar azure_virtual_machine_id: The ARM Id of the azure VM. - :vartype azure_virtual_machine_id: str - :ivar multi_vm_group_name: The multi VM group name. - :vartype multi_vm_group_name: str - :ivar reprotect_agent_id: The reprotect agent Id. - :vartype reprotect_agent_id: str - :ivar reprotect_agent_name: The reprotect agent name. - :vartype reprotect_agent_name: str - :ivar os_type: The type of the OS on the VM. - :vartype os_type: str - :ivar log_storage_account_id: The log storage account ARM Id. - :vartype log_storage_account_id: str - :ivar targetv_center_id: The target vCenter Id. - :vartype targetv_center_id: str - :ivar target_data_store_name: The target datastore name. - :vartype target_data_store_name: str - :ivar target_vm_name: The target VM name. - :vartype target_vm_name: str - :ivar initial_replication_progress_percentage: The initial replication progress percentage. - :vartype initial_replication_progress_percentage: int - :ivar initial_replication_processed_bytes: The initial replication processed bytes. This - includes sum of total bytes transferred and matched bytes on all selected disks in source VM. - :vartype initial_replication_processed_bytes: int - :ivar initial_replication_transferred_bytes: The initial replication transferred bytes from - source VM to target for all selected disks on source VM. - :vartype initial_replication_transferred_bytes: int - :ivar initial_replication_progress_health: The initial replication progress health. Known - values are: "None", "InProgress", "SlowProgress", and "NoProgress". - :vartype initial_replication_progress_health: str or - ~azure.mgmt.recoveryservicessiterecovery.models.VmReplicationProgressHealth - :ivar resync_progress_percentage: The resync progress percentage. - :vartype resync_progress_percentage: int - :ivar resync_processed_bytes: The resync processed bytes. This includes sum of total bytes - transferred and matched bytes on all selected disks in source VM. - :vartype resync_processed_bytes: int - :ivar resync_transferred_bytes: The resync transferred bytes from source VM to target for all - selected disks on source VM. - :vartype resync_transferred_bytes: int - :ivar resync_progress_health: The resync progress health. Known values are: "None", - "InProgress", "SlowProgress", and "NoProgress". - :vartype resync_progress_health: str or - ~azure.mgmt.recoveryservicessiterecovery.models.VmReplicationProgressHealth - :ivar resync_required: A value indicating whether resync is required. - :vartype resync_required: str - :ivar resync_state: The resync state. Known values are: "None", "PreparedForResynchronization", - and "StartedResynchronization". - :vartype resync_state: str or ~azure.mgmt.recoveryservicessiterecovery.models.ResyncState - :ivar protected_disks: The list of protected disks. - :vartype protected_disks: - list[~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmFailbackProtectedDiskDetails] - :ivar mobility_agent_details: The mobility agent information. - :vartype mobility_agent_details: - ~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmFailbackMobilityAgentDetails - :ivar vm_nics: The network details. - :vartype vm_nics: - list[~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmFailbackNicDetails] - :ivar last_planned_failover_start_time: The last planned failover start time. - :vartype last_planned_failover_start_time: ~datetime.datetime - :ivar last_planned_failover_status: The last planned failover status. Known values are: - "Succeeded", "Failed", "Cancelled", and "Unknown". - :vartype last_planned_failover_status: str or - ~azure.mgmt.recoveryservicessiterecovery.models.PlannedFailoverStatus - :ivar discovered_vm_details: The discovered VM information. - :vartype discovered_vm_details: - ~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmFailbackDiscoveredProtectedVmDetails - :ivar last_used_policy_id: The policy Id used by the forward replication. - :vartype last_used_policy_id: str - :ivar last_used_policy_friendly_name: The policy friendly name used by the forward replication. - :vartype last_used_policy_friendly_name: str - :ivar is_agent_registration_successful_after_failover: A value indicating whether agent - registration was successful after failover. - :vartype is_agent_registration_successful_after_failover: bool - """ - - _validation = { - "instance_type": {"required": True}, - "internal_identifier": {"readonly": True}, - "azure_virtual_machine_id": {"readonly": True}, - "multi_vm_group_name": {"readonly": True}, - "reprotect_agent_id": {"readonly": True}, - "reprotect_agent_name": {"readonly": True}, - "os_type": {"readonly": True}, - "log_storage_account_id": {"readonly": True}, - "targetv_center_id": {"readonly": True}, - "target_data_store_name": {"readonly": True}, - "target_vm_name": {"readonly": True}, - "initial_replication_progress_percentage": {"readonly": True}, - "initial_replication_processed_bytes": {"readonly": True}, - "initial_replication_transferred_bytes": {"readonly": True}, - "initial_replication_progress_health": {"readonly": True}, - "resync_progress_percentage": {"readonly": True}, - "resync_processed_bytes": {"readonly": True}, - "resync_transferred_bytes": {"readonly": True}, - "resync_progress_health": {"readonly": True}, - "resync_required": {"readonly": True}, - "resync_state": {"readonly": True}, - "last_planned_failover_start_time": {"readonly": True}, - "last_planned_failover_status": {"readonly": True}, - "last_used_policy_id": {"readonly": True}, - "last_used_policy_friendly_name": {"readonly": True}, - "is_agent_registration_successful_after_failover": {"readonly": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "internal_identifier": {"key": "internalIdentifier", "type": "str"}, - "azure_virtual_machine_id": {"key": "azureVirtualMachineId", "type": "str"}, - "multi_vm_group_name": {"key": "multiVmGroupName", "type": "str"}, - "reprotect_agent_id": {"key": "reprotectAgentId", "type": "str"}, - "reprotect_agent_name": {"key": "reprotectAgentName", "type": "str"}, - "os_type": {"key": "osType", "type": "str"}, - "log_storage_account_id": {"key": "logStorageAccountId", "type": "str"}, - "targetv_center_id": {"key": "targetvCenterId", "type": "str"}, - "target_data_store_name": {"key": "targetDataStoreName", "type": "str"}, - "target_vm_name": {"key": "targetVmName", "type": "str"}, - "initial_replication_progress_percentage": {"key": "initialReplicationProgressPercentage", "type": "int"}, - "initial_replication_processed_bytes": {"key": "initialReplicationProcessedBytes", "type": "int"}, - "initial_replication_transferred_bytes": {"key": "initialReplicationTransferredBytes", "type": "int"}, - "initial_replication_progress_health": {"key": "initialReplicationProgressHealth", "type": "str"}, - "resync_progress_percentage": {"key": "resyncProgressPercentage", "type": "int"}, - "resync_processed_bytes": {"key": "resyncProcessedBytes", "type": "int"}, - "resync_transferred_bytes": {"key": "resyncTransferredBytes", "type": "int"}, - "resync_progress_health": {"key": "resyncProgressHealth", "type": "str"}, - "resync_required": {"key": "resyncRequired", "type": "str"}, - "resync_state": {"key": "resyncState", "type": "str"}, - "protected_disks": {"key": "protectedDisks", "type": "[InMageRcmFailbackProtectedDiskDetails]"}, - "mobility_agent_details": {"key": "mobilityAgentDetails", "type": "InMageRcmFailbackMobilityAgentDetails"}, - "vm_nics": {"key": "vmNics", "type": "[InMageRcmFailbackNicDetails]"}, - "last_planned_failover_start_time": {"key": "lastPlannedFailoverStartTime", "type": "iso-8601"}, - "last_planned_failover_status": {"key": "lastPlannedFailoverStatus", "type": "str"}, - "discovered_vm_details": { - "key": "discoveredVmDetails", - "type": "InMageRcmFailbackDiscoveredProtectedVmDetails", - }, - "last_used_policy_id": {"key": "lastUsedPolicyId", "type": "str"}, - "last_used_policy_friendly_name": {"key": "lastUsedPolicyFriendlyName", "type": "str"}, - "is_agent_registration_successful_after_failover": { - "key": "isAgentRegistrationSuccessfulAfterFailover", - "type": "bool", - }, - } - - def __init__( # pylint: disable=too-many-locals - self, - *, - protected_disks: Optional[List["_models.InMageRcmFailbackProtectedDiskDetails"]] = None, - mobility_agent_details: Optional["_models.InMageRcmFailbackMobilityAgentDetails"] = None, - vm_nics: Optional[List["_models.InMageRcmFailbackNicDetails"]] = None, - discovered_vm_details: Optional["_models.InMageRcmFailbackDiscoveredProtectedVmDetails"] = None, - **kwargs: Any - ) -> None: - """ - :keyword protected_disks: The list of protected disks. - :paramtype protected_disks: - list[~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmFailbackProtectedDiskDetails] - :keyword mobility_agent_details: The mobility agent information. - :paramtype mobility_agent_details: - ~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmFailbackMobilityAgentDetails - :keyword vm_nics: The network details. - :paramtype vm_nics: - list[~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmFailbackNicDetails] - :keyword discovered_vm_details: The discovered VM information. - :paramtype discovered_vm_details: - ~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmFailbackDiscoveredProtectedVmDetails - """ - super().__init__(**kwargs) - self.instance_type: str = "InMageRcmFailback" - self.internal_identifier: Optional[str] = None - self.azure_virtual_machine_id: Optional[str] = None - self.multi_vm_group_name: Optional[str] = None - self.reprotect_agent_id: Optional[str] = None - self.reprotect_agent_name: Optional[str] = None - self.os_type: Optional[str] = None - self.log_storage_account_id: Optional[str] = None - self.targetv_center_id: Optional[str] = None - self.target_data_store_name: Optional[str] = None - self.target_vm_name: Optional[str] = None - self.initial_replication_progress_percentage: Optional[int] = None - self.initial_replication_processed_bytes: Optional[int] = None - self.initial_replication_transferred_bytes: Optional[int] = None - self.initial_replication_progress_health: Optional[Union[str, "_models.VmReplicationProgressHealth"]] = None - self.resync_progress_percentage: Optional[int] = None - self.resync_processed_bytes: Optional[int] = None - self.resync_transferred_bytes: Optional[int] = None - self.resync_progress_health: Optional[Union[str, "_models.VmReplicationProgressHealth"]] = None - self.resync_required: Optional[str] = None - self.resync_state: Optional[Union[str, "_models.ResyncState"]] = None - self.protected_disks = protected_disks - self.mobility_agent_details = mobility_agent_details - self.vm_nics = vm_nics - self.last_planned_failover_start_time: Optional[datetime.datetime] = None - self.last_planned_failover_status: Optional[Union[str, "_models.PlannedFailoverStatus"]] = None - self.discovered_vm_details = discovered_vm_details - self.last_used_policy_id: Optional[str] = None - self.last_used_policy_friendly_name: Optional[str] = None - self.is_agent_registration_successful_after_failover: Optional[bool] = None - - -class InMageRcmFailbackReprotectInput(ReverseReplicationProviderSpecificInput): - """InMageRcmFailback specific provider input. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - :ivar process_server_id: The process server Id. Required. - :vartype process_server_id: str - :ivar run_as_account_id: The run as account Id. - :vartype run_as_account_id: str - :ivar policy_id: The Policy Id. Required. - :vartype policy_id: str - """ - - _validation = { - "instance_type": {"required": True}, - "process_server_id": {"required": True}, - "policy_id": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "process_server_id": {"key": "processServerId", "type": "str"}, - "run_as_account_id": {"key": "runAsAccountId", "type": "str"}, - "policy_id": {"key": "policyId", "type": "str"}, - } - - def __init__( - self, *, process_server_id: str, policy_id: str, run_as_account_id: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword process_server_id: The process server Id. Required. - :paramtype process_server_id: str - :keyword run_as_account_id: The run as account Id. - :paramtype run_as_account_id: str - :keyword policy_id: The Policy Id. Required. - :paramtype policy_id: str - """ - super().__init__(**kwargs) - self.instance_type: str = "InMageRcmFailback" - self.process_server_id = process_server_id - self.run_as_account_id = run_as_account_id - self.policy_id = policy_id - - -class InMageRcmFailbackSyncDetails(_serialization.Model): - """InMageRcmFailback disk level sync details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar progress_health: The progress health. Known values are: "None", "InProgress", - "SlowProgress", "NoProgress", and "Queued". - :vartype progress_health: str or - ~azure.mgmt.recoveryservicessiterecovery.models.DiskReplicationProgressHealth - :ivar transferred_bytes: The transferred bytes from source VM to azure for the disk. - :vartype transferred_bytes: int - :ivar last15_minutes_transferred_bytes: The bytes transferred in last 15 minutes from source VM - to target. - :vartype last15_minutes_transferred_bytes: int - :ivar last_data_transfer_time_utc: The time of the last data transfer from source VM to target. - :vartype last_data_transfer_time_utc: str - :ivar processed_bytes: The total processed bytes. This includes bytes that are transferred from - source VM to target and matched bytes. - :vartype processed_bytes: int - :ivar start_time: The start time. - :vartype start_time: str - :ivar last_refresh_time: The last refresh time. - :vartype last_refresh_time: str - :ivar progress_percentage: Progress in percentage. Progress percentage is calculated based on - processed bytes. - :vartype progress_percentage: int - """ - - _validation = { - "progress_health": {"readonly": True}, - "transferred_bytes": {"readonly": True}, - "last15_minutes_transferred_bytes": {"readonly": True}, - "last_data_transfer_time_utc": {"readonly": True}, - "processed_bytes": {"readonly": True}, - "start_time": {"readonly": True}, - "last_refresh_time": {"readonly": True}, - "progress_percentage": {"readonly": True}, - } - - _attribute_map = { - "progress_health": {"key": "progressHealth", "type": "str"}, - "transferred_bytes": {"key": "transferredBytes", "type": "int"}, - "last15_minutes_transferred_bytes": {"key": "last15MinutesTransferredBytes", "type": "int"}, - "last_data_transfer_time_utc": {"key": "lastDataTransferTimeUtc", "type": "str"}, - "processed_bytes": {"key": "processedBytes", "type": "int"}, - "start_time": {"key": "startTime", "type": "str"}, - "last_refresh_time": {"key": "lastRefreshTime", "type": "str"}, - "progress_percentage": {"key": "progressPercentage", "type": "int"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.progress_health: Optional[Union[str, "_models.DiskReplicationProgressHealth"]] = None - self.transferred_bytes: Optional[int] = None - self.last15_minutes_transferred_bytes: Optional[int] = None - self.last_data_transfer_time_utc: Optional[str] = None - self.processed_bytes: Optional[int] = None - self.start_time: Optional[str] = None - self.last_refresh_time: Optional[str] = None - self.progress_percentage: Optional[int] = None - - -class InMageRcmLastAgentUpgradeErrorDetails(_serialization.Model): - """InMageRcm last source agent upgrade error details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar error_code: The error code. - :vartype error_code: str - :ivar error_message: The error message. - :vartype error_message: str - :ivar possible_causes: The possible causes. - :vartype possible_causes: str - :ivar recommended_action: The recommended action. - :vartype recommended_action: str - :ivar error_message_parameters: The error message parameters. - :vartype error_message_parameters: dict[str, str] - :ivar error_tags: The error tags. - :vartype error_tags: dict[str, str] - """ - - _validation = { - "error_code": {"readonly": True}, - "error_message": {"readonly": True}, - "possible_causes": {"readonly": True}, - "recommended_action": {"readonly": True}, - "error_message_parameters": {"readonly": True}, - "error_tags": {"readonly": True}, - } - - _attribute_map = { - "error_code": {"key": "errorCode", "type": "str"}, - "error_message": {"key": "errorMessage", "type": "str"}, - "possible_causes": {"key": "possibleCauses", "type": "str"}, - "recommended_action": {"key": "recommendedAction", "type": "str"}, - "error_message_parameters": {"key": "errorMessageParameters", "type": "{str}"}, - "error_tags": {"key": "errorTags", "type": "{str}"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.error_code: Optional[str] = None - self.error_message: Optional[str] = None - self.possible_causes: Optional[str] = None - self.recommended_action: Optional[str] = None - self.error_message_parameters: Optional[Dict[str, str]] = None - self.error_tags: Optional[Dict[str, str]] = None - - -class InMageRcmMobilityAgentDetails(_serialization.Model): - """InMageRcm mobility agent details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar version: The agent version. - :vartype version: str - :ivar latest_version: The latest agent version available. - :vartype latest_version: str - :ivar latest_agent_release_date: The latest agent version release date. - :vartype latest_agent_release_date: str - :ivar driver_version: The driver version. - :vartype driver_version: str - :ivar latest_upgradable_version_without_reboot: The latest upgradeable version available - without reboot. - :vartype latest_upgradable_version_without_reboot: str - :ivar agent_version_expiry_date: The agent version expiry date. - :vartype agent_version_expiry_date: ~datetime.datetime - :ivar driver_version_expiry_date: The driver version expiry date. - :vartype driver_version_expiry_date: ~datetime.datetime - :ivar last_heartbeat_utc: The time of the last heartbeat received from the agent. - :vartype last_heartbeat_utc: ~datetime.datetime - :ivar reasons_blocking_upgrade: The whether update is possible or not. - :vartype reasons_blocking_upgrade: list[str or - ~azure.mgmt.recoveryservicessiterecovery.models.AgentUpgradeBlockedReason] - :ivar is_upgradeable: A value indicating whether agent is upgradeable or not. - :vartype is_upgradeable: str - """ - - _validation = { - "version": {"readonly": True}, - "latest_version": {"readonly": True}, - "latest_agent_release_date": {"readonly": True}, - "driver_version": {"readonly": True}, - "latest_upgradable_version_without_reboot": {"readonly": True}, - "agent_version_expiry_date": {"readonly": True}, - "driver_version_expiry_date": {"readonly": True}, - "last_heartbeat_utc": {"readonly": True}, - "reasons_blocking_upgrade": {"readonly": True}, - "is_upgradeable": {"readonly": True}, - } - - _attribute_map = { - "version": {"key": "version", "type": "str"}, - "latest_version": {"key": "latestVersion", "type": "str"}, - "latest_agent_release_date": {"key": "latestAgentReleaseDate", "type": "str"}, - "driver_version": {"key": "driverVersion", "type": "str"}, - "latest_upgradable_version_without_reboot": {"key": "latestUpgradableVersionWithoutReboot", "type": "str"}, - "agent_version_expiry_date": {"key": "agentVersionExpiryDate", "type": "iso-8601"}, - "driver_version_expiry_date": {"key": "driverVersionExpiryDate", "type": "iso-8601"}, - "last_heartbeat_utc": {"key": "lastHeartbeatUtc", "type": "iso-8601"}, - "reasons_blocking_upgrade": {"key": "reasonsBlockingUpgrade", "type": "[str]"}, - "is_upgradeable": {"key": "isUpgradeable", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.version: Optional[str] = None - self.latest_version: Optional[str] = None - self.latest_agent_release_date: Optional[str] = None - self.driver_version: Optional[str] = None - self.latest_upgradable_version_without_reboot: Optional[str] = None - self.agent_version_expiry_date: Optional[datetime.datetime] = None - self.driver_version_expiry_date: Optional[datetime.datetime] = None - self.last_heartbeat_utc: Optional[datetime.datetime] = None - self.reasons_blocking_upgrade: Optional[List[Union[str, "_models.AgentUpgradeBlockedReason"]]] = None - self.is_upgradeable: Optional[str] = None - - -class InMageRcmNicDetails(_serialization.Model): - """InMageRcm NIC details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar nic_id: The NIC Id. - :vartype nic_id: str - :ivar is_primary_nic: A value indicating whether this is the primary NIC. - :vartype is_primary_nic: str - :ivar is_selected_for_failover: A value indicating whether this NIC is selected for failover. - :vartype is_selected_for_failover: str - :ivar source_ip_address: The source IP address. - :vartype source_ip_address: str - :ivar source_ip_address_type: The source IP address type. Known values are: "Dynamic" and - "Static". - :vartype source_ip_address_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.EthernetAddressType - :ivar source_network_id: Source network Id. - :vartype source_network_id: str - :ivar source_subnet_name: Source subnet name. - :vartype source_subnet_name: str - :ivar target_ip_address: The target IP address. - :vartype target_ip_address: str - :ivar target_ip_address_type: The target IP address type. Known values are: "Dynamic" and - "Static". - :vartype target_ip_address_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.EthernetAddressType - :ivar target_subnet_name: Target subnet name. - :vartype target_subnet_name: str - :ivar test_subnet_name: Test subnet name. - :vartype test_subnet_name: str - :ivar test_ip_address: The test IP address. - :vartype test_ip_address: str - :ivar test_ip_address_type: The test IP address type. Known values are: "Dynamic" and "Static". - :vartype test_ip_address_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.EthernetAddressType - :ivar target_nic_name: The target NIC name. - :vartype target_nic_name: str - """ - - _validation = { - "nic_id": {"readonly": True}, - "source_ip_address": {"readonly": True}, - "source_ip_address_type": {"readonly": True}, - "source_network_id": {"readonly": True}, - "source_subnet_name": {"readonly": True}, - } - - _attribute_map = { - "nic_id": {"key": "nicId", "type": "str"}, - "is_primary_nic": {"key": "isPrimaryNic", "type": "str"}, - "is_selected_for_failover": {"key": "isSelectedForFailover", "type": "str"}, - "source_ip_address": {"key": "sourceIPAddress", "type": "str"}, - "source_ip_address_type": {"key": "sourceIPAddressType", "type": "str"}, - "source_network_id": {"key": "sourceNetworkId", "type": "str"}, - "source_subnet_name": {"key": "sourceSubnetName", "type": "str"}, - "target_ip_address": {"key": "targetIPAddress", "type": "str"}, - "target_ip_address_type": {"key": "targetIPAddressType", "type": "str"}, - "target_subnet_name": {"key": "targetSubnetName", "type": "str"}, - "test_subnet_name": {"key": "testSubnetName", "type": "str"}, - "test_ip_address": {"key": "testIPAddress", "type": "str"}, - "test_ip_address_type": {"key": "testIPAddressType", "type": "str"}, - "target_nic_name": {"key": "targetNicName", "type": "str"}, - } - - def __init__( - self, - *, - is_primary_nic: Optional[str] = None, - is_selected_for_failover: Optional[str] = None, - target_ip_address: Optional[str] = None, - target_ip_address_type: Optional[Union[str, "_models.EthernetAddressType"]] = None, - target_subnet_name: Optional[str] = None, - test_subnet_name: Optional[str] = None, - test_ip_address: Optional[str] = None, - test_ip_address_type: Optional[Union[str, "_models.EthernetAddressType"]] = None, - target_nic_name: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword is_primary_nic: A value indicating whether this is the primary NIC. - :paramtype is_primary_nic: str - :keyword is_selected_for_failover: A value indicating whether this NIC is selected for - failover. - :paramtype is_selected_for_failover: str - :keyword target_ip_address: The target IP address. - :paramtype target_ip_address: str - :keyword target_ip_address_type: The target IP address type. Known values are: "Dynamic" and - "Static". - :paramtype target_ip_address_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.EthernetAddressType - :keyword target_subnet_name: Target subnet name. - :paramtype target_subnet_name: str - :keyword test_subnet_name: Test subnet name. - :paramtype test_subnet_name: str - :keyword test_ip_address: The test IP address. - :paramtype test_ip_address: str - :keyword test_ip_address_type: The test IP address type. Known values are: "Dynamic" and - "Static". - :paramtype test_ip_address_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.EthernetAddressType - :keyword target_nic_name: The target NIC name. - :paramtype target_nic_name: str - """ - super().__init__(**kwargs) - self.nic_id: Optional[str] = None - self.is_primary_nic = is_primary_nic - self.is_selected_for_failover = is_selected_for_failover - self.source_ip_address: Optional[str] = None - self.source_ip_address_type: Optional[Union[str, "_models.EthernetAddressType"]] = None - self.source_network_id: Optional[str] = None - self.source_subnet_name: Optional[str] = None - self.target_ip_address = target_ip_address - self.target_ip_address_type = target_ip_address_type - self.target_subnet_name = target_subnet_name - self.test_subnet_name = test_subnet_name - self.test_ip_address = test_ip_address - self.test_ip_address_type = test_ip_address_type - self.target_nic_name = target_nic_name - - -class InMageRcmNicInput(_serialization.Model): - """InMageRcm NIC input. - - All required parameters must be populated in order to send to server. - - :ivar nic_id: The NIC Id. Required. - :vartype nic_id: str - :ivar is_primary_nic: A value indicating whether this is the primary NIC. Required. - :vartype is_primary_nic: str - :ivar is_selected_for_failover: A value indicating whether this NIC is selected for failover. - :vartype is_selected_for_failover: str - :ivar target_subnet_name: Target subnet name. - :vartype target_subnet_name: str - :ivar target_static_ip_address: The target static IP address. - :vartype target_static_ip_address: str - :ivar test_subnet_name: The test subnet name. - :vartype test_subnet_name: str - :ivar test_static_ip_address: The test static IP address. - :vartype test_static_ip_address: str - :ivar target_nic_name: The target NIC name. - :vartype target_nic_name: str - """ - - _validation = { - "nic_id": {"required": True}, - "is_primary_nic": {"required": True}, - } - - _attribute_map = { - "nic_id": {"key": "nicId", "type": "str"}, - "is_primary_nic": {"key": "isPrimaryNic", "type": "str"}, - "is_selected_for_failover": {"key": "isSelectedForFailover", "type": "str"}, - "target_subnet_name": {"key": "targetSubnetName", "type": "str"}, - "target_static_ip_address": {"key": "targetStaticIPAddress", "type": "str"}, - "test_subnet_name": {"key": "testSubnetName", "type": "str"}, - "test_static_ip_address": {"key": "testStaticIPAddress", "type": "str"}, - "target_nic_name": {"key": "targetNicName", "type": "str"}, - } - - def __init__( - self, - *, - nic_id: str, - is_primary_nic: str, - is_selected_for_failover: Optional[str] = None, - target_subnet_name: Optional[str] = None, - target_static_ip_address: Optional[str] = None, - test_subnet_name: Optional[str] = None, - test_static_ip_address: Optional[str] = None, - target_nic_name: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword nic_id: The NIC Id. Required. - :paramtype nic_id: str - :keyword is_primary_nic: A value indicating whether this is the primary NIC. Required. - :paramtype is_primary_nic: str - :keyword is_selected_for_failover: A value indicating whether this NIC is selected for - failover. - :paramtype is_selected_for_failover: str - :keyword target_subnet_name: Target subnet name. - :paramtype target_subnet_name: str - :keyword target_static_ip_address: The target static IP address. - :paramtype target_static_ip_address: str - :keyword test_subnet_name: The test subnet name. - :paramtype test_subnet_name: str - :keyword test_static_ip_address: The test static IP address. - :paramtype test_static_ip_address: str - :keyword target_nic_name: The target NIC name. - :paramtype target_nic_name: str - """ - super().__init__(**kwargs) - self.nic_id = nic_id - self.is_primary_nic = is_primary_nic - self.is_selected_for_failover = is_selected_for_failover - self.target_subnet_name = target_subnet_name - self.target_static_ip_address = target_static_ip_address - self.test_subnet_name = test_subnet_name - self.test_static_ip_address = test_static_ip_address - self.target_nic_name = target_nic_name - - -class InMageRcmPolicyCreationInput(PolicyProviderSpecificInput): - """InMageRcm policy creation input. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - :ivar recovery_point_history_in_minutes: The duration in minutes until which the recovery - points need to be stored. - :vartype recovery_point_history_in_minutes: int - :ivar crash_consistent_frequency_in_minutes: The crash consistent snapshot frequency (in - minutes). - :vartype crash_consistent_frequency_in_minutes: int - :ivar app_consistent_frequency_in_minutes: The app consistent snapshot frequency (in minutes). - :vartype app_consistent_frequency_in_minutes: int - :ivar enable_multi_vm_sync: A value indicating whether multi-VM sync has to be enabled. - :vartype enable_multi_vm_sync: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "recovery_point_history_in_minutes": {"key": "recoveryPointHistoryInMinutes", "type": "int"}, - "crash_consistent_frequency_in_minutes": {"key": "crashConsistentFrequencyInMinutes", "type": "int"}, - "app_consistent_frequency_in_minutes": {"key": "appConsistentFrequencyInMinutes", "type": "int"}, - "enable_multi_vm_sync": {"key": "enableMultiVmSync", "type": "str"}, - } - - def __init__( - self, - *, - recovery_point_history_in_minutes: Optional[int] = None, - crash_consistent_frequency_in_minutes: Optional[int] = None, - app_consistent_frequency_in_minutes: Optional[int] = None, - enable_multi_vm_sync: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword recovery_point_history_in_minutes: The duration in minutes until which the recovery - points need to be stored. - :paramtype recovery_point_history_in_minutes: int - :keyword crash_consistent_frequency_in_minutes: The crash consistent snapshot frequency (in - minutes). - :paramtype crash_consistent_frequency_in_minutes: int - :keyword app_consistent_frequency_in_minutes: The app consistent snapshot frequency (in - minutes). - :paramtype app_consistent_frequency_in_minutes: int - :keyword enable_multi_vm_sync: A value indicating whether multi-VM sync has to be enabled. - :paramtype enable_multi_vm_sync: str - """ - super().__init__(**kwargs) - self.instance_type: str = "InMageRcm" - self.recovery_point_history_in_minutes = recovery_point_history_in_minutes - self.crash_consistent_frequency_in_minutes = crash_consistent_frequency_in_minutes - self.app_consistent_frequency_in_minutes = app_consistent_frequency_in_minutes - self.enable_multi_vm_sync = enable_multi_vm_sync - - -class InMageRcmPolicyDetails(PolicyProviderSpecificDetails): - """InMageRcm specific policy details. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: Gets the class type. Overridden in derived classes. Required. - :vartype instance_type: str - :ivar recovery_point_history_in_minutes: The duration in minutes until which the recovery - points need to be stored. - :vartype recovery_point_history_in_minutes: int - :ivar app_consistent_frequency_in_minutes: The app consistent snapshot frequency in minutes. - :vartype app_consistent_frequency_in_minutes: int - :ivar crash_consistent_frequency_in_minutes: The crash consistent snapshot frequency in - minutes. - :vartype crash_consistent_frequency_in_minutes: int - :ivar enable_multi_vm_sync: A value indicating whether multi-VM sync has to be enabled. - :vartype enable_multi_vm_sync: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "recovery_point_history_in_minutes": {"key": "recoveryPointHistoryInMinutes", "type": "int"}, - "app_consistent_frequency_in_minutes": {"key": "appConsistentFrequencyInMinutes", "type": "int"}, - "crash_consistent_frequency_in_minutes": {"key": "crashConsistentFrequencyInMinutes", "type": "int"}, - "enable_multi_vm_sync": {"key": "enableMultiVmSync", "type": "str"}, - } - - def __init__( - self, - *, - recovery_point_history_in_minutes: Optional[int] = None, - app_consistent_frequency_in_minutes: Optional[int] = None, - crash_consistent_frequency_in_minutes: Optional[int] = None, - enable_multi_vm_sync: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword recovery_point_history_in_minutes: The duration in minutes until which the recovery - points need to be stored. - :paramtype recovery_point_history_in_minutes: int - :keyword app_consistent_frequency_in_minutes: The app consistent snapshot frequency in minutes. - :paramtype app_consistent_frequency_in_minutes: int - :keyword crash_consistent_frequency_in_minutes: The crash consistent snapshot frequency in - minutes. - :paramtype crash_consistent_frequency_in_minutes: int - :keyword enable_multi_vm_sync: A value indicating whether multi-VM sync has to be enabled. - :paramtype enable_multi_vm_sync: str - """ - super().__init__(**kwargs) - self.instance_type: str = "InMageRcm" - self.recovery_point_history_in_minutes = recovery_point_history_in_minutes - self.app_consistent_frequency_in_minutes = app_consistent_frequency_in_minutes - self.crash_consistent_frequency_in_minutes = crash_consistent_frequency_in_minutes - self.enable_multi_vm_sync = enable_multi_vm_sync - - -class InMageRcmProtectedDiskDetails(_serialization.Model): - """InMageRcm protected disk details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar disk_id: The disk Id. - :vartype disk_id: str - :ivar disk_name: The disk name. - :vartype disk_name: str - :ivar is_os_disk: A value indicating whether the disk is the OS disk. - :vartype is_os_disk: str - :ivar capacity_in_bytes: The disk capacity in bytes. - :vartype capacity_in_bytes: int - :ivar disk_state: The disk state. Known values are: "Unavailable", "InitialReplicationPending", - "InitialReplicationFailed", and "Protected". - :vartype disk_state: str or ~azure.mgmt.recoveryservicessiterecovery.models.DiskState - :ivar log_storage_account_id: The log storage account ARM Id. - :vartype log_storage_account_id: str - :ivar disk_encryption_set_id: The DiskEncryptionSet ARM Id. - :vartype disk_encryption_set_id: str - :ivar seed_managed_disk_id: The ARM Id of the seed managed disk. - :vartype seed_managed_disk_id: str - :ivar seed_blob_uri: The uri of the seed blob. - :vartype seed_blob_uri: str - :ivar target_managed_disk_id: The ARM Id of the target managed disk. - :vartype target_managed_disk_id: str - :ivar disk_type: The disk type. Known values are: "Standard_LRS", "Premium_LRS", - "StandardSSD_LRS", "PremiumV2_LRS", "UltraSSD_LRS", "StandardSSD_ZRS", and "Premium_ZRS". - :vartype disk_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.DiskAccountType - :ivar data_pending_in_log_data_store_in_mb: The data pending in log data store in MB. - :vartype data_pending_in_log_data_store_in_mb: float - :ivar data_pending_at_source_agent_in_mb: The data pending at source agent in MB. - :vartype data_pending_at_source_agent_in_mb: float - :ivar is_initial_replication_complete: A value indicating whether initial replication is - complete or not. - :vartype is_initial_replication_complete: str - :ivar ir_details: The initial replication details. - :vartype ir_details: ~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmSyncDetails - :ivar resync_details: The resync details. - :vartype resync_details: ~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmSyncDetails - :ivar custom_target_disk_name: The custom target Azure disk name. - :vartype custom_target_disk_name: str - :ivar sector_size_in_bytes: The logical sector size (in bytes), 512 by default. - :vartype sector_size_in_bytes: int - """ - - _validation = { - "disk_id": {"readonly": True}, - "disk_name": {"readonly": True}, - "is_os_disk": {"readonly": True}, - "capacity_in_bytes": {"readonly": True}, - "disk_state": {"readonly": True}, - "log_storage_account_id": {"readonly": True}, - "disk_encryption_set_id": {"readonly": True}, - "seed_managed_disk_id": {"readonly": True}, - "seed_blob_uri": {"readonly": True}, - "target_managed_disk_id": {"readonly": True}, - "data_pending_in_log_data_store_in_mb": {"readonly": True}, - "data_pending_at_source_agent_in_mb": {"readonly": True}, - "is_initial_replication_complete": {"readonly": True}, - } - - _attribute_map = { - "disk_id": {"key": "diskId", "type": "str"}, - "disk_name": {"key": "diskName", "type": "str"}, - "is_os_disk": {"key": "isOSDisk", "type": "str"}, - "capacity_in_bytes": {"key": "capacityInBytes", "type": "int"}, - "disk_state": {"key": "diskState", "type": "str"}, - "log_storage_account_id": {"key": "logStorageAccountId", "type": "str"}, - "disk_encryption_set_id": {"key": "diskEncryptionSetId", "type": "str"}, - "seed_managed_disk_id": {"key": "seedManagedDiskId", "type": "str"}, - "seed_blob_uri": {"key": "seedBlobUri", "type": "str"}, - "target_managed_disk_id": {"key": "targetManagedDiskId", "type": "str"}, - "disk_type": {"key": "diskType", "type": "str"}, - "data_pending_in_log_data_store_in_mb": {"key": "dataPendingInLogDataStoreInMB", "type": "float"}, - "data_pending_at_source_agent_in_mb": {"key": "dataPendingAtSourceAgentInMB", "type": "float"}, - "is_initial_replication_complete": {"key": "isInitialReplicationComplete", "type": "str"}, - "ir_details": {"key": "irDetails", "type": "InMageRcmSyncDetails"}, - "resync_details": {"key": "resyncDetails", "type": "InMageRcmSyncDetails"}, - "custom_target_disk_name": {"key": "customTargetDiskName", "type": "str"}, - "sector_size_in_bytes": {"key": "sectorSizeInBytes", "type": "int"}, - } - - def __init__( - self, - *, - disk_type: Optional[Union[str, "_models.DiskAccountType"]] = None, - ir_details: Optional["_models.InMageRcmSyncDetails"] = None, - resync_details: Optional["_models.InMageRcmSyncDetails"] = None, - custom_target_disk_name: Optional[str] = None, - sector_size_in_bytes: Optional[int] = None, - **kwargs: Any - ) -> None: - """ - :keyword disk_type: The disk type. Known values are: "Standard_LRS", "Premium_LRS", - "StandardSSD_LRS", "PremiumV2_LRS", "UltraSSD_LRS", "StandardSSD_ZRS", and "Premium_ZRS". - :paramtype disk_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.DiskAccountType - :keyword ir_details: The initial replication details. - :paramtype ir_details: ~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmSyncDetails - :keyword resync_details: The resync details. - :paramtype resync_details: ~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmSyncDetails - :keyword custom_target_disk_name: The custom target Azure disk name. - :paramtype custom_target_disk_name: str - :keyword sector_size_in_bytes: The logical sector size (in bytes), 512 by default. - :paramtype sector_size_in_bytes: int - """ - super().__init__(**kwargs) - self.disk_id: Optional[str] = None - self.disk_name: Optional[str] = None - self.is_os_disk: Optional[str] = None - self.capacity_in_bytes: Optional[int] = None - self.disk_state: Optional[Union[str, "_models.DiskState"]] = None - self.log_storage_account_id: Optional[str] = None - self.disk_encryption_set_id: Optional[str] = None - self.seed_managed_disk_id: Optional[str] = None - self.seed_blob_uri: Optional[str] = None - self.target_managed_disk_id: Optional[str] = None - self.disk_type = disk_type - self.data_pending_in_log_data_store_in_mb: Optional[float] = None - self.data_pending_at_source_agent_in_mb: Optional[float] = None - self.is_initial_replication_complete: Optional[str] = None - self.ir_details = ir_details - self.resync_details = resync_details - self.custom_target_disk_name = custom_target_disk_name - self.sector_size_in_bytes = sector_size_in_bytes - - -class InMageRcmProtectionContainerMappingDetails( - ProtectionContainerMappingProviderSpecificDetails -): # pylint: disable=name-too-long - """InMageRcm provider specific container mapping details. - - 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 instance_type: Gets the class type. Overridden in derived classes. Required. - :vartype instance_type: str - :ivar enable_agent_auto_upgrade: A value indicating whether the flag for enable agent auto - upgrade. - :vartype enable_agent_auto_upgrade: str - """ - - _validation = { - "instance_type": {"required": True}, - "enable_agent_auto_upgrade": {"readonly": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "enable_agent_auto_upgrade": {"key": "enableAgentAutoUpgrade", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.instance_type: str = "InMageRcm" - self.enable_agent_auto_upgrade: Optional[str] = None - - -class InMageRcmRecoveryPointDetails(ProviderSpecificRecoveryPointDetails): - """InMageRcm provider specific recovery point details. - - 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 instance_type: Gets the provider type. Required. - :vartype instance_type: str - :ivar is_multi_vm_sync_point: A value indicating whether the recovery point is multi VM - consistent. - :vartype is_multi_vm_sync_point: str - """ - - _validation = { - "instance_type": {"required": True}, - "is_multi_vm_sync_point": {"readonly": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "is_multi_vm_sync_point": {"key": "isMultiVmSyncPoint", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.instance_type: str = "InMageRcm" - self.is_multi_vm_sync_point: Optional[str] = None - - -class InMageRcmReplicationDetails(ReplicationProviderSpecificSettings): - """InMageRcm provider specific details. - - 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 instance_type: Gets the Instance type. Required. - :vartype instance_type: str - :ivar internal_identifier: The virtual machine internal identifier. - :vartype internal_identifier: str - :ivar fabric_discovery_machine_id: The ARM Id of the discovered VM. - :vartype fabric_discovery_machine_id: str - :ivar multi_vm_group_name: The multi VM group name. - :vartype multi_vm_group_name: str - :ivar discovery_type: The type of the discovered VM. - :vartype discovery_type: str - :ivar process_server_id: The process server Id. - :vartype process_server_id: str - :ivar processor_core_count: The processor core count. - :vartype processor_core_count: int - :ivar allocated_memory_in_mb: The allocated memory in MB. - :vartype allocated_memory_in_mb: float - :ivar process_server_name: The process server name. - :vartype process_server_name: str - :ivar run_as_account_id: The run-as account Id. - :vartype run_as_account_id: str - :ivar os_type: The type of the OS on the VM. - :vartype os_type: str - :ivar firmware_type: The firmware type. - :vartype firmware_type: str - :ivar primary_nic_ip_address: The IP address of the primary network interface. - :vartype primary_nic_ip_address: str - :ivar target_generation: The target generation. - :vartype target_generation: str - :ivar license_type: License Type of the VM to be used. - :vartype license_type: str - :ivar linux_license_type: The license type for Linux VM's. Known values are: "NotSpecified", - "NoLicenseType", and "LinuxServer". - :vartype linux_license_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.LinuxLicenseType - :ivar storage_account_id: The replication storage account ARM Id. This is applicable only for - the blob based replication test hook. - :vartype storage_account_id: str - :ivar target_vm_name: Target VM name. - :vartype target_vm_name: str - :ivar target_vm_size: The target VM size. - :vartype target_vm_size: str - :ivar target_resource_group_id: The target resource group Id. - :vartype target_resource_group_id: str - :ivar target_location: The target location. - :vartype target_location: str - :ivar target_availability_set_id: The target availability set Id. - :vartype target_availability_set_id: str - :ivar target_availability_zone: The target availability zone. - :vartype target_availability_zone: str - :ivar target_proximity_placement_group_id: The target proximity placement group Id. - :vartype target_proximity_placement_group_id: str - :ivar target_boot_diagnostics_storage_account_id: The target boot diagnostics storage account - ARM Id. - :vartype target_boot_diagnostics_storage_account_id: str - :ivar target_network_id: The target network Id. - :vartype target_network_id: str - :ivar test_network_id: The test network Id. - :vartype test_network_id: str - :ivar failover_recovery_point_id: The recovery point Id to which the VM was failed over. - :vartype failover_recovery_point_id: str - :ivar last_recovery_point_received: The last recovery point received time. - :vartype last_recovery_point_received: ~datetime.datetime - :ivar last_rpo_in_seconds: The last recovery point objective value. - :vartype last_rpo_in_seconds: int - :ivar last_rpo_calculated_time: The last recovery point objective calculated time. - :vartype last_rpo_calculated_time: ~datetime.datetime - :ivar last_recovery_point_id: The last recovery point Id. - :vartype last_recovery_point_id: str - :ivar initial_replication_progress_percentage: The initial replication progress percentage. - This is calculated based on total bytes processed for all disks in the source VM. - :vartype initial_replication_progress_percentage: int - :ivar initial_replication_processed_bytes: The initial replication processed bytes. This - includes sum of total bytes transferred and matched bytes on all selected disks in source VM. - :vartype initial_replication_processed_bytes: int - :ivar initial_replication_transferred_bytes: The initial replication transferred bytes from - source VM to azure for all selected disks on source VM. - :vartype initial_replication_transferred_bytes: int - :ivar initial_replication_progress_health: The initial replication progress health. Known - values are: "None", "InProgress", "SlowProgress", and "NoProgress". - :vartype initial_replication_progress_health: str or - ~azure.mgmt.recoveryservicessiterecovery.models.VmReplicationProgressHealth - :ivar resync_progress_percentage: The resync progress percentage. This is calculated based on - total bytes processed for all disks in the source VM. - :vartype resync_progress_percentage: int - :ivar resync_processed_bytes: The resync processed bytes. This includes sum of total bytes - transferred and matched bytes on all selected disks in source VM. - :vartype resync_processed_bytes: int - :ivar resync_transferred_bytes: The resync transferred bytes from source VM to azure for all - selected disks on source VM. - :vartype resync_transferred_bytes: int - :ivar resync_progress_health: The resync progress health. Known values are: "None", - "InProgress", "SlowProgress", and "NoProgress". - :vartype resync_progress_health: str or - ~azure.mgmt.recoveryservicessiterecovery.models.VmReplicationProgressHealth - :ivar resync_required: A value indicating whether resync is required. - :vartype resync_required: str - :ivar resync_state: The resync state. Known values are: "None", "PreparedForResynchronization", - and "StartedResynchronization". - :vartype resync_state: str or ~azure.mgmt.recoveryservicessiterecovery.models.ResyncState - :ivar agent_upgrade_state: The agent auto upgrade state. Known values are: "None", "Started", - "Completed", and "Commit". - :vartype agent_upgrade_state: str or - ~azure.mgmt.recoveryservicessiterecovery.models.MobilityAgentUpgradeState - :ivar last_agent_upgrade_type: The last agent upgrade type. - :vartype last_agent_upgrade_type: str - :ivar agent_upgrade_job_id: The agent upgrade job Id. - :vartype agent_upgrade_job_id: str - :ivar agent_upgrade_attempt_to_version: The agent version to which last agent upgrade was - attempted. - :vartype agent_upgrade_attempt_to_version: str - :ivar protected_disks: The list of protected disks. - :vartype protected_disks: - list[~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmProtectedDiskDetails] - :ivar unprotected_disks: The list of unprotected disks. - :vartype unprotected_disks: - list[~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmUnProtectedDiskDetails] - :ivar is_last_upgrade_successful: A value indicating whether last agent upgrade was successful - or not. - :vartype is_last_upgrade_successful: str - :ivar is_agent_registration_successful_after_failover: A value indicating whether agent - registration was successful after failover. - :vartype is_agent_registration_successful_after_failover: bool - :ivar mobility_agent_details: The mobility agent information. - :vartype mobility_agent_details: - ~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmMobilityAgentDetails - :ivar last_agent_upgrade_error_details: The last agent upgrade error information. - :vartype last_agent_upgrade_error_details: - list[~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmLastAgentUpgradeErrorDetails] - :ivar agent_upgrade_blocking_error_details: The agent upgrade blocking error information. - :vartype agent_upgrade_blocking_error_details: - list[~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmAgentUpgradeBlockingErrorDetails] - :ivar vm_nics: The network details. - :vartype vm_nics: list[~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmNicDetails] - :ivar discovered_vm_details: The discovered VM details. - :vartype discovered_vm_details: - ~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmDiscoveredProtectedVmDetails - :ivar target_vm_tags: The target VM tags. - :vartype target_vm_tags: - list[~azure.mgmt.recoveryservicessiterecovery.models.UserCreatedResourceTag] - :ivar seed_managed_disk_tags: The tags for the seed managed disks. - :vartype seed_managed_disk_tags: - list[~azure.mgmt.recoveryservicessiterecovery.models.UserCreatedResourceTag] - :ivar target_managed_disk_tags: The tags for the target managed disks. - :vartype target_managed_disk_tags: - list[~azure.mgmt.recoveryservicessiterecovery.models.UserCreatedResourceTag] - :ivar target_nic_tags: The tags for the target NICs. - :vartype target_nic_tags: - list[~azure.mgmt.recoveryservicessiterecovery.models.UserCreatedResourceTag] - :ivar sql_server_license_type: The SQL Server license type. - :vartype sql_server_license_type: str - :ivar supported_os_versions: A value indicating the inplace OS Upgrade version. - :vartype supported_os_versions: list[str] - :ivar os_name: The OS name associated with VM. - :vartype os_name: str - :ivar target_vm_security_profile: The target VM security profile. - :vartype target_vm_security_profile: - ~azure.mgmt.recoveryservicessiterecovery.models.SecurityProfileProperties - """ - - _validation = { - "instance_type": {"required": True}, - "internal_identifier": {"readonly": True}, - "fabric_discovery_machine_id": {"readonly": True}, - "multi_vm_group_name": {"readonly": True}, - "discovery_type": {"readonly": True}, - "process_server_id": {"readonly": True}, - "processor_core_count": {"readonly": True}, - "allocated_memory_in_mb": {"readonly": True}, - "process_server_name": {"readonly": True}, - "run_as_account_id": {"readonly": True}, - "os_type": {"readonly": True}, - "firmware_type": {"readonly": True}, - "primary_nic_ip_address": {"readonly": True}, - "target_generation": {"readonly": True}, - "storage_account_id": {"readonly": True}, - "failover_recovery_point_id": {"readonly": True}, - "last_recovery_point_received": {"readonly": True}, - "last_rpo_in_seconds": {"readonly": True}, - "last_rpo_calculated_time": {"readonly": True}, - "last_recovery_point_id": {"readonly": True}, - "initial_replication_progress_percentage": {"readonly": True}, - "initial_replication_processed_bytes": {"readonly": True}, - "initial_replication_transferred_bytes": {"readonly": True}, - "initial_replication_progress_health": {"readonly": True}, - "resync_progress_percentage": {"readonly": True}, - "resync_processed_bytes": {"readonly": True}, - "resync_transferred_bytes": {"readonly": True}, - "resync_progress_health": {"readonly": True}, - "resync_required": {"readonly": True}, - "resync_state": {"readonly": True}, - "agent_upgrade_state": {"readonly": True}, - "last_agent_upgrade_type": {"readonly": True}, - "agent_upgrade_job_id": {"readonly": True}, - "agent_upgrade_attempt_to_version": {"readonly": True}, - "is_last_upgrade_successful": {"readonly": True}, - "is_agent_registration_successful_after_failover": {"readonly": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "internal_identifier": {"key": "internalIdentifier", "type": "str"}, - "fabric_discovery_machine_id": {"key": "fabricDiscoveryMachineId", "type": "str"}, - "multi_vm_group_name": {"key": "multiVmGroupName", "type": "str"}, - "discovery_type": {"key": "discoveryType", "type": "str"}, - "process_server_id": {"key": "processServerId", "type": "str"}, - "processor_core_count": {"key": "processorCoreCount", "type": "int"}, - "allocated_memory_in_mb": {"key": "allocatedMemoryInMB", "type": "float"}, - "process_server_name": {"key": "processServerName", "type": "str"}, - "run_as_account_id": {"key": "runAsAccountId", "type": "str"}, - "os_type": {"key": "osType", "type": "str"}, - "firmware_type": {"key": "firmwareType", "type": "str"}, - "primary_nic_ip_address": {"key": "primaryNicIpAddress", "type": "str"}, - "target_generation": {"key": "targetGeneration", "type": "str"}, - "license_type": {"key": "licenseType", "type": "str"}, - "linux_license_type": {"key": "linuxLicenseType", "type": "str"}, - "storage_account_id": {"key": "storageAccountId", "type": "str"}, - "target_vm_name": {"key": "targetVmName", "type": "str"}, - "target_vm_size": {"key": "targetVmSize", "type": "str"}, - "target_resource_group_id": {"key": "targetResourceGroupId", "type": "str"}, - "target_location": {"key": "targetLocation", "type": "str"}, - "target_availability_set_id": {"key": "targetAvailabilitySetId", "type": "str"}, - "target_availability_zone": {"key": "targetAvailabilityZone", "type": "str"}, - "target_proximity_placement_group_id": {"key": "targetProximityPlacementGroupId", "type": "str"}, - "target_boot_diagnostics_storage_account_id": {"key": "targetBootDiagnosticsStorageAccountId", "type": "str"}, - "target_network_id": {"key": "targetNetworkId", "type": "str"}, - "test_network_id": {"key": "testNetworkId", "type": "str"}, - "failover_recovery_point_id": {"key": "failoverRecoveryPointId", "type": "str"}, - "last_recovery_point_received": {"key": "lastRecoveryPointReceived", "type": "iso-8601"}, - "last_rpo_in_seconds": {"key": "lastRpoInSeconds", "type": "int"}, - "last_rpo_calculated_time": {"key": "lastRpoCalculatedTime", "type": "iso-8601"}, - "last_recovery_point_id": {"key": "lastRecoveryPointId", "type": "str"}, - "initial_replication_progress_percentage": {"key": "initialReplicationProgressPercentage", "type": "int"}, - "initial_replication_processed_bytes": {"key": "initialReplicationProcessedBytes", "type": "int"}, - "initial_replication_transferred_bytes": {"key": "initialReplicationTransferredBytes", "type": "int"}, - "initial_replication_progress_health": {"key": "initialReplicationProgressHealth", "type": "str"}, - "resync_progress_percentage": {"key": "resyncProgressPercentage", "type": "int"}, - "resync_processed_bytes": {"key": "resyncProcessedBytes", "type": "int"}, - "resync_transferred_bytes": {"key": "resyncTransferredBytes", "type": "int"}, - "resync_progress_health": {"key": "resyncProgressHealth", "type": "str"}, - "resync_required": {"key": "resyncRequired", "type": "str"}, - "resync_state": {"key": "resyncState", "type": "str"}, - "agent_upgrade_state": {"key": "agentUpgradeState", "type": "str"}, - "last_agent_upgrade_type": {"key": "lastAgentUpgradeType", "type": "str"}, - "agent_upgrade_job_id": {"key": "agentUpgradeJobId", "type": "str"}, - "agent_upgrade_attempt_to_version": {"key": "agentUpgradeAttemptToVersion", "type": "str"}, - "protected_disks": {"key": "protectedDisks", "type": "[InMageRcmProtectedDiskDetails]"}, - "unprotected_disks": {"key": "unprotectedDisks", "type": "[InMageRcmUnProtectedDiskDetails]"}, - "is_last_upgrade_successful": {"key": "isLastUpgradeSuccessful", "type": "str"}, - "is_agent_registration_successful_after_failover": { - "key": "isAgentRegistrationSuccessfulAfterFailover", - "type": "bool", - }, - "mobility_agent_details": {"key": "mobilityAgentDetails", "type": "InMageRcmMobilityAgentDetails"}, - "last_agent_upgrade_error_details": { - "key": "lastAgentUpgradeErrorDetails", - "type": "[InMageRcmLastAgentUpgradeErrorDetails]", - }, - "agent_upgrade_blocking_error_details": { - "key": "agentUpgradeBlockingErrorDetails", - "type": "[InMageRcmAgentUpgradeBlockingErrorDetails]", - }, - "vm_nics": {"key": "vmNics", "type": "[InMageRcmNicDetails]"}, - "discovered_vm_details": {"key": "discoveredVmDetails", "type": "InMageRcmDiscoveredProtectedVmDetails"}, - "target_vm_tags": {"key": "targetVmTags", "type": "[UserCreatedResourceTag]"}, - "seed_managed_disk_tags": {"key": "seedManagedDiskTags", "type": "[UserCreatedResourceTag]"}, - "target_managed_disk_tags": {"key": "targetManagedDiskTags", "type": "[UserCreatedResourceTag]"}, - "target_nic_tags": {"key": "targetNicTags", "type": "[UserCreatedResourceTag]"}, - "sql_server_license_type": {"key": "sqlServerLicenseType", "type": "str"}, - "supported_os_versions": {"key": "supportedOSVersions", "type": "[str]"}, - "os_name": {"key": "osName", "type": "str"}, - "target_vm_security_profile": {"key": "targetVmSecurityProfile", "type": "SecurityProfileProperties"}, - } - - def __init__( # pylint: disable=too-many-locals - self, - *, - license_type: Optional[str] = None, - linux_license_type: Optional[Union[str, "_models.LinuxLicenseType"]] = None, - target_vm_name: Optional[str] = None, - target_vm_size: Optional[str] = None, - target_resource_group_id: Optional[str] = None, - target_location: Optional[str] = None, - target_availability_set_id: Optional[str] = None, - target_availability_zone: Optional[str] = None, - target_proximity_placement_group_id: Optional[str] = None, - target_boot_diagnostics_storage_account_id: Optional[str] = None, - target_network_id: Optional[str] = None, - test_network_id: Optional[str] = None, - protected_disks: Optional[List["_models.InMageRcmProtectedDiskDetails"]] = None, - unprotected_disks: Optional[List["_models.InMageRcmUnProtectedDiskDetails"]] = None, - mobility_agent_details: Optional["_models.InMageRcmMobilityAgentDetails"] = None, - last_agent_upgrade_error_details: Optional[List["_models.InMageRcmLastAgentUpgradeErrorDetails"]] = None, - agent_upgrade_blocking_error_details: Optional[ - List["_models.InMageRcmAgentUpgradeBlockingErrorDetails"] - ] = None, - vm_nics: Optional[List["_models.InMageRcmNicDetails"]] = None, - discovered_vm_details: Optional["_models.InMageRcmDiscoveredProtectedVmDetails"] = None, - target_vm_tags: Optional[List["_models.UserCreatedResourceTag"]] = None, - seed_managed_disk_tags: Optional[List["_models.UserCreatedResourceTag"]] = None, - target_managed_disk_tags: Optional[List["_models.UserCreatedResourceTag"]] = None, - target_nic_tags: Optional[List["_models.UserCreatedResourceTag"]] = None, - sql_server_license_type: Optional[str] = None, - supported_os_versions: Optional[List[str]] = None, - os_name: Optional[str] = None, - target_vm_security_profile: Optional["_models.SecurityProfileProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword license_type: License Type of the VM to be used. - :paramtype license_type: str - :keyword linux_license_type: The license type for Linux VM's. Known values are: "NotSpecified", - "NoLicenseType", and "LinuxServer". - :paramtype linux_license_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.LinuxLicenseType - :keyword target_vm_name: Target VM name. - :paramtype target_vm_name: str - :keyword target_vm_size: The target VM size. - :paramtype target_vm_size: str - :keyword target_resource_group_id: The target resource group Id. - :paramtype target_resource_group_id: str - :keyword target_location: The target location. - :paramtype target_location: str - :keyword target_availability_set_id: The target availability set Id. - :paramtype target_availability_set_id: str - :keyword target_availability_zone: The target availability zone. - :paramtype target_availability_zone: str - :keyword target_proximity_placement_group_id: The target proximity placement group Id. - :paramtype target_proximity_placement_group_id: str - :keyword target_boot_diagnostics_storage_account_id: The target boot diagnostics storage - account ARM Id. - :paramtype target_boot_diagnostics_storage_account_id: str - :keyword target_network_id: The target network Id. - :paramtype target_network_id: str - :keyword test_network_id: The test network Id. - :paramtype test_network_id: str - :keyword protected_disks: The list of protected disks. - :paramtype protected_disks: - list[~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmProtectedDiskDetails] - :keyword unprotected_disks: The list of unprotected disks. - :paramtype unprotected_disks: - list[~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmUnProtectedDiskDetails] - :keyword mobility_agent_details: The mobility agent information. - :paramtype mobility_agent_details: - ~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmMobilityAgentDetails - :keyword last_agent_upgrade_error_details: The last agent upgrade error information. - :paramtype last_agent_upgrade_error_details: - list[~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmLastAgentUpgradeErrorDetails] - :keyword agent_upgrade_blocking_error_details: The agent upgrade blocking error information. - :paramtype agent_upgrade_blocking_error_details: - list[~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmAgentUpgradeBlockingErrorDetails] - :keyword vm_nics: The network details. - :paramtype vm_nics: list[~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmNicDetails] - :keyword discovered_vm_details: The discovered VM details. - :paramtype discovered_vm_details: - ~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmDiscoveredProtectedVmDetails - :keyword target_vm_tags: The target VM tags. - :paramtype target_vm_tags: - list[~azure.mgmt.recoveryservicessiterecovery.models.UserCreatedResourceTag] - :keyword seed_managed_disk_tags: The tags for the seed managed disks. - :paramtype seed_managed_disk_tags: - list[~azure.mgmt.recoveryservicessiterecovery.models.UserCreatedResourceTag] - :keyword target_managed_disk_tags: The tags for the target managed disks. - :paramtype target_managed_disk_tags: - list[~azure.mgmt.recoveryservicessiterecovery.models.UserCreatedResourceTag] - :keyword target_nic_tags: The tags for the target NICs. - :paramtype target_nic_tags: - list[~azure.mgmt.recoveryservicessiterecovery.models.UserCreatedResourceTag] - :keyword sql_server_license_type: The SQL Server license type. - :paramtype sql_server_license_type: str - :keyword supported_os_versions: A value indicating the inplace OS Upgrade version. - :paramtype supported_os_versions: list[str] - :keyword os_name: The OS name associated with VM. - :paramtype os_name: str - :keyword target_vm_security_profile: The target VM security profile. - :paramtype target_vm_security_profile: - ~azure.mgmt.recoveryservicessiterecovery.models.SecurityProfileProperties - """ - super().__init__(**kwargs) - self.instance_type: str = "InMageRcm" - self.internal_identifier: Optional[str] = None - self.fabric_discovery_machine_id: Optional[str] = None - self.multi_vm_group_name: Optional[str] = None - self.discovery_type: Optional[str] = None - self.process_server_id: Optional[str] = None - self.processor_core_count: Optional[int] = None - self.allocated_memory_in_mb: Optional[float] = None - self.process_server_name: Optional[str] = None - self.run_as_account_id: Optional[str] = None - self.os_type: Optional[str] = None - self.firmware_type: Optional[str] = None - self.primary_nic_ip_address: Optional[str] = None - self.target_generation: Optional[str] = None - self.license_type = license_type - self.linux_license_type = linux_license_type - self.storage_account_id: Optional[str] = None - self.target_vm_name = target_vm_name - self.target_vm_size = target_vm_size - self.target_resource_group_id = target_resource_group_id - self.target_location = target_location - self.target_availability_set_id = target_availability_set_id - self.target_availability_zone = target_availability_zone - self.target_proximity_placement_group_id = target_proximity_placement_group_id - self.target_boot_diagnostics_storage_account_id = target_boot_diagnostics_storage_account_id - self.target_network_id = target_network_id - self.test_network_id = test_network_id - self.failover_recovery_point_id: Optional[str] = None - self.last_recovery_point_received: Optional[datetime.datetime] = None - self.last_rpo_in_seconds: Optional[int] = None - self.last_rpo_calculated_time: Optional[datetime.datetime] = None - self.last_recovery_point_id: Optional[str] = None - self.initial_replication_progress_percentage: Optional[int] = None - self.initial_replication_processed_bytes: Optional[int] = None - self.initial_replication_transferred_bytes: Optional[int] = None - self.initial_replication_progress_health: Optional[Union[str, "_models.VmReplicationProgressHealth"]] = None - self.resync_progress_percentage: Optional[int] = None - self.resync_processed_bytes: Optional[int] = None - self.resync_transferred_bytes: Optional[int] = None - self.resync_progress_health: Optional[Union[str, "_models.VmReplicationProgressHealth"]] = None - self.resync_required: Optional[str] = None - self.resync_state: Optional[Union[str, "_models.ResyncState"]] = None - self.agent_upgrade_state: Optional[Union[str, "_models.MobilityAgentUpgradeState"]] = None - self.last_agent_upgrade_type: Optional[str] = None - self.agent_upgrade_job_id: Optional[str] = None - self.agent_upgrade_attempt_to_version: Optional[str] = None - self.protected_disks = protected_disks - self.unprotected_disks = unprotected_disks - self.is_last_upgrade_successful: Optional[str] = None - self.is_agent_registration_successful_after_failover: Optional[bool] = None - self.mobility_agent_details = mobility_agent_details - self.last_agent_upgrade_error_details = last_agent_upgrade_error_details - self.agent_upgrade_blocking_error_details = agent_upgrade_blocking_error_details - self.vm_nics = vm_nics - self.discovered_vm_details = discovered_vm_details - self.target_vm_tags = target_vm_tags - self.seed_managed_disk_tags = seed_managed_disk_tags - self.target_managed_disk_tags = target_managed_disk_tags - self.target_nic_tags = target_nic_tags - self.sql_server_license_type = sql_server_license_type - self.supported_os_versions = supported_os_versions - self.os_name = os_name - self.target_vm_security_profile = target_vm_security_profile - - -class InMageRcmReprotectInput(ReverseReplicationProviderSpecificInput): - """InMageRcm specific provider input. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - :ivar reprotect_agent_id: The reprotect agent Id. Required. - :vartype reprotect_agent_id: str - :ivar datastore_name: The target datastore name. Required. - :vartype datastore_name: str - :ivar log_storage_account_id: The log storage account ARM Id. Required. - :vartype log_storage_account_id: str - :ivar policy_id: The Policy Id. - :vartype policy_id: str - """ - - _validation = { - "instance_type": {"required": True}, - "reprotect_agent_id": {"required": True}, - "datastore_name": {"required": True}, - "log_storage_account_id": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "reprotect_agent_id": {"key": "reprotectAgentId", "type": "str"}, - "datastore_name": {"key": "datastoreName", "type": "str"}, - "log_storage_account_id": {"key": "logStorageAccountId", "type": "str"}, - "policy_id": {"key": "policyId", "type": "str"}, - } - - def __init__( - self, - *, - reprotect_agent_id: str, - datastore_name: str, - log_storage_account_id: str, - policy_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword reprotect_agent_id: The reprotect agent Id. Required. - :paramtype reprotect_agent_id: str - :keyword datastore_name: The target datastore name. Required. - :paramtype datastore_name: str - :keyword log_storage_account_id: The log storage account ARM Id. Required. - :paramtype log_storage_account_id: str - :keyword policy_id: The Policy Id. - :paramtype policy_id: str - """ - super().__init__(**kwargs) - self.instance_type: str = "InMageRcm" - self.reprotect_agent_id = reprotect_agent_id - self.datastore_name = datastore_name - self.log_storage_account_id = log_storage_account_id - self.policy_id = policy_id - - -class InMageRcmSyncDetails(_serialization.Model): - """InMageRcm disk level sync details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar progress_health: The progress health. Known values are: "None", "InProgress", - "SlowProgress", "NoProgress", and "Queued". - :vartype progress_health: str or - ~azure.mgmt.recoveryservicessiterecovery.models.DiskReplicationProgressHealth - :ivar transferred_bytes: The transferred bytes from source VM to azure for the disk. - :vartype transferred_bytes: int - :ivar last15_minutes_transferred_bytes: The bytes transferred in last 15 minutes from source VM - to azure. - :vartype last15_minutes_transferred_bytes: int - :ivar last_data_transfer_time_utc: The time of the last data transfer from source VM to azure. - :vartype last_data_transfer_time_utc: str - :ivar processed_bytes: The total processed bytes. This includes bytes that are transferred from - source VM to azure and matched bytes. - :vartype processed_bytes: int - :ivar start_time: The start time. - :vartype start_time: str - :ivar last_refresh_time: The last refresh time. - :vartype last_refresh_time: str - :ivar progress_percentage: Progress in percentage. Progress percentage is calculated based on - processed bytes. - :vartype progress_percentage: int - """ - - _validation = { - "progress_health": {"readonly": True}, - "transferred_bytes": {"readonly": True}, - "last15_minutes_transferred_bytes": {"readonly": True}, - "last_data_transfer_time_utc": {"readonly": True}, - "processed_bytes": {"readonly": True}, - "start_time": {"readonly": True}, - "last_refresh_time": {"readonly": True}, - "progress_percentage": {"readonly": True}, - } - - _attribute_map = { - "progress_health": {"key": "progressHealth", "type": "str"}, - "transferred_bytes": {"key": "transferredBytes", "type": "int"}, - "last15_minutes_transferred_bytes": {"key": "last15MinutesTransferredBytes", "type": "int"}, - "last_data_transfer_time_utc": {"key": "lastDataTransferTimeUtc", "type": "str"}, - "processed_bytes": {"key": "processedBytes", "type": "int"}, - "start_time": {"key": "startTime", "type": "str"}, - "last_refresh_time": {"key": "lastRefreshTime", "type": "str"}, - "progress_percentage": {"key": "progressPercentage", "type": "int"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.progress_health: Optional[Union[str, "_models.DiskReplicationProgressHealth"]] = None - self.transferred_bytes: Optional[int] = None - self.last15_minutes_transferred_bytes: Optional[int] = None - self.last_data_transfer_time_utc: Optional[str] = None - self.processed_bytes: Optional[int] = None - self.start_time: Optional[str] = None - self.last_refresh_time: Optional[str] = None - self.progress_percentage: Optional[int] = None - - -class InMageRcmTestFailoverInput(TestFailoverProviderSpecificInput): - """InMageRcm provider specific input for test failover. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - :ivar network_id: The test network Id. - :vartype network_id: str - :ivar recovery_point_id: The recovery point id to be passed to test failover to a particular - recovery point. In case of latest recovery point, null should be passed. - :vartype recovery_point_id: str - :ivar os_upgrade_version: A value indicating the inplace OS Upgrade version. - :vartype os_upgrade_version: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "network_id": {"key": "networkId", "type": "str"}, - "recovery_point_id": {"key": "recoveryPointId", "type": "str"}, - "os_upgrade_version": {"key": "osUpgradeVersion", "type": "str"}, - } - - def __init__( - self, - *, - network_id: Optional[str] = None, - recovery_point_id: Optional[str] = None, - os_upgrade_version: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword network_id: The test network Id. - :paramtype network_id: str - :keyword recovery_point_id: The recovery point id to be passed to test failover to a particular - recovery point. In case of latest recovery point, null should be passed. - :paramtype recovery_point_id: str - :keyword os_upgrade_version: A value indicating the inplace OS Upgrade version. - :paramtype os_upgrade_version: str - """ - super().__init__(**kwargs) - self.instance_type: str = "InMageRcm" - self.network_id = network_id - self.recovery_point_id = recovery_point_id - self.os_upgrade_version = os_upgrade_version - - -class InMageRcmUnplannedFailoverInput(UnplannedFailoverProviderSpecificInput): - """InMageRcm provider specific input for unplanned failover. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - :ivar perform_shutdown: A value indicating whether VM is to be shutdown. Required. - :vartype perform_shutdown: str - :ivar recovery_point_id: The recovery point id to be passed to failover to a particular - recovery point. In case of latest recovery point, null should be passed. - :vartype recovery_point_id: str - :ivar os_upgrade_version: A value indicating the inplace OS Upgrade version. - :vartype os_upgrade_version: str - """ - - _validation = { - "instance_type": {"required": True}, - "perform_shutdown": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "perform_shutdown": {"key": "performShutdown", "type": "str"}, - "recovery_point_id": {"key": "recoveryPointId", "type": "str"}, - "os_upgrade_version": {"key": "osUpgradeVersion", "type": "str"}, - } - - def __init__( - self, - *, - perform_shutdown: str, - recovery_point_id: Optional[str] = None, - os_upgrade_version: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword perform_shutdown: A value indicating whether VM is to be shutdown. Required. - :paramtype perform_shutdown: str - :keyword recovery_point_id: The recovery point id to be passed to failover to a particular - recovery point. In case of latest recovery point, null should be passed. - :paramtype recovery_point_id: str - :keyword os_upgrade_version: A value indicating the inplace OS Upgrade version. - :paramtype os_upgrade_version: str - """ - super().__init__(**kwargs) - self.instance_type: str = "InMageRcm" - self.perform_shutdown = perform_shutdown - self.recovery_point_id = recovery_point_id - self.os_upgrade_version = os_upgrade_version - - -class InMageRcmUnProtectedDiskDetails(_serialization.Model): - """InMageRcm un-protected disk details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar disk_id: The disk Id. - :vartype disk_id: str - :ivar disk_name: The disk name. - :vartype disk_name: str - :ivar capacity_in_bytes: The disk capacity in bytes. - :vartype capacity_in_bytes: int - """ - - _validation = { - "disk_id": {"readonly": True}, - "disk_name": {"readonly": True}, - "capacity_in_bytes": {"readonly": True}, - } - - _attribute_map = { - "disk_id": {"key": "diskId", "type": "str"}, - "disk_name": {"key": "diskName", "type": "str"}, - "capacity_in_bytes": {"key": "capacityInBytes", "type": "int"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.disk_id: Optional[str] = None - self.disk_name: Optional[str] = None - self.capacity_in_bytes: Optional[int] = None - - -class UpdateApplianceForReplicationProtectedItemProviderSpecificInput( - _serialization.Model -): # pylint: disable=name-too-long - """Update replication protected item provider specific input. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - InMageRcmUpdateApplianceForReplicationProtectedItemInput - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - } - - _subtype_map = {"instance_type": {"InMageRcm": "InMageRcmUpdateApplianceForReplicationProtectedItemInput"}} - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.instance_type: Optional[str] = None - - -class InMageRcmUpdateApplianceForReplicationProtectedItemInput( - UpdateApplianceForReplicationProtectedItemProviderSpecificInput -): # pylint: disable=name-too-long - """InMageRcm provider specific input to update appliance for replication protected item. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - :ivar run_as_account_id: The run as account Id. - :vartype run_as_account_id: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "run_as_account_id": {"key": "runAsAccountId", "type": "str"}, - } - - def __init__(self, *, run_as_account_id: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword run_as_account_id: The run as account Id. - :paramtype run_as_account_id: str - """ - super().__init__(**kwargs) - self.instance_type: str = "InMageRcm" - self.run_as_account_id = run_as_account_id - - -class InMageRcmUpdateContainerMappingInput(ReplicationProviderSpecificUpdateContainerMappingInput): - """InMageRcm update protection container mapping. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - :ivar enable_agent_auto_upgrade: A value indicating whether agent auto upgrade has to be - enabled. Required. - :vartype enable_agent_auto_upgrade: str - """ - - _validation = { - "instance_type": {"required": True}, - "enable_agent_auto_upgrade": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "enable_agent_auto_upgrade": {"key": "enableAgentAutoUpgrade", "type": "str"}, - } - - def __init__(self, *, enable_agent_auto_upgrade: str, **kwargs: Any) -> None: - """ - :keyword enable_agent_auto_upgrade: A value indicating whether agent auto upgrade has to be - enabled. Required. - :paramtype enable_agent_auto_upgrade: str - """ - super().__init__(**kwargs) - self.instance_type: str = "InMageRcm" - self.enable_agent_auto_upgrade = enable_agent_auto_upgrade - - -class InMageRcmUpdateReplicationProtectedItemInput( - UpdateReplicationProtectedItemProviderInput -): # pylint: disable=name-too-long - """InMageRcm provider specific input to update replication protected item. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - :ivar target_vm_name: The target VM name. - :vartype target_vm_name: str - :ivar target_vm_size: The target VM size. - :vartype target_vm_size: str - :ivar target_resource_group_id: The target resource group ARM Id. - :vartype target_resource_group_id: str - :ivar target_availability_set_id: The target availability set ARM Id. - :vartype target_availability_set_id: str - :ivar target_availability_zone: The target availability zone. - :vartype target_availability_zone: str - :ivar target_proximity_placement_group_id: The target proximity placement group Id. - :vartype target_proximity_placement_group_id: str - :ivar target_boot_diagnostics_storage_account_id: The target boot diagnostics storage account - ARM Id. - :vartype target_boot_diagnostics_storage_account_id: str - :ivar target_network_id: The target network ARM Id. - :vartype target_network_id: str - :ivar test_network_id: The test network ARM Id. - :vartype test_network_id: str - :ivar vm_nics: The list of NIC details. - :vartype vm_nics: list[~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmNicInput] - :ivar license_type: The license type. Known values are: "NotSpecified", "NoLicenseType", and - "WindowsServer". - :vartype license_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.LicenseType - :ivar sql_server_license_type: The SQL Server license type. Known values are: "NotSpecified", - "NoLicenseType", "PAYG", and "AHUB". - :vartype sql_server_license_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.SqlServerLicenseType - :ivar linux_license_type: The license type for Linux VM's. Known values are: "NotSpecified", - "NoLicenseType", and "LinuxServer". - :vartype linux_license_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.LinuxLicenseType - :ivar user_selected_os_name: The OS name selected by user. - :vartype user_selected_os_name: str - :ivar target_vm_tags: The target VM tags. - :vartype target_vm_tags: - list[~azure.mgmt.recoveryservicessiterecovery.models.UserCreatedResourceTag] - :ivar target_managed_disk_tags: The tags for the target managed disks. - :vartype target_managed_disk_tags: - list[~azure.mgmt.recoveryservicessiterecovery.models.UserCreatedResourceTag] - :ivar target_nic_tags: The tags for the target NICs. - :vartype target_nic_tags: - list[~azure.mgmt.recoveryservicessiterecovery.models.UserCreatedResourceTag] - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "target_vm_name": {"key": "targetVmName", "type": "str"}, - "target_vm_size": {"key": "targetVmSize", "type": "str"}, - "target_resource_group_id": {"key": "targetResourceGroupId", "type": "str"}, - "target_availability_set_id": {"key": "targetAvailabilitySetId", "type": "str"}, - "target_availability_zone": {"key": "targetAvailabilityZone", "type": "str"}, - "target_proximity_placement_group_id": {"key": "targetProximityPlacementGroupId", "type": "str"}, - "target_boot_diagnostics_storage_account_id": {"key": "targetBootDiagnosticsStorageAccountId", "type": "str"}, - "target_network_id": {"key": "targetNetworkId", "type": "str"}, - "test_network_id": {"key": "testNetworkId", "type": "str"}, - "vm_nics": {"key": "vmNics", "type": "[InMageRcmNicInput]"}, - "license_type": {"key": "licenseType", "type": "str"}, - "sql_server_license_type": {"key": "sqlServerLicenseType", "type": "str"}, - "linux_license_type": {"key": "linuxLicenseType", "type": "str"}, - "user_selected_os_name": {"key": "userSelectedOSName", "type": "str"}, - "target_vm_tags": {"key": "targetVmTags", "type": "[UserCreatedResourceTag]"}, - "target_managed_disk_tags": {"key": "targetManagedDiskTags", "type": "[UserCreatedResourceTag]"}, - "target_nic_tags": {"key": "targetNicTags", "type": "[UserCreatedResourceTag]"}, - } - - def __init__( - self, - *, - target_vm_name: Optional[str] = None, - target_vm_size: Optional[str] = None, - target_resource_group_id: Optional[str] = None, - target_availability_set_id: Optional[str] = None, - target_availability_zone: Optional[str] = None, - target_proximity_placement_group_id: Optional[str] = None, - target_boot_diagnostics_storage_account_id: Optional[str] = None, - target_network_id: Optional[str] = None, - test_network_id: Optional[str] = None, - vm_nics: Optional[List["_models.InMageRcmNicInput"]] = None, - license_type: Optional[Union[str, "_models.LicenseType"]] = None, - sql_server_license_type: Optional[Union[str, "_models.SqlServerLicenseType"]] = None, - linux_license_type: Optional[Union[str, "_models.LinuxLicenseType"]] = None, - user_selected_os_name: Optional[str] = None, - target_vm_tags: Optional[List["_models.UserCreatedResourceTag"]] = None, - target_managed_disk_tags: Optional[List["_models.UserCreatedResourceTag"]] = None, - target_nic_tags: Optional[List["_models.UserCreatedResourceTag"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword target_vm_name: The target VM name. - :paramtype target_vm_name: str - :keyword target_vm_size: The target VM size. - :paramtype target_vm_size: str - :keyword target_resource_group_id: The target resource group ARM Id. - :paramtype target_resource_group_id: str - :keyword target_availability_set_id: The target availability set ARM Id. - :paramtype target_availability_set_id: str - :keyword target_availability_zone: The target availability zone. - :paramtype target_availability_zone: str - :keyword target_proximity_placement_group_id: The target proximity placement group Id. - :paramtype target_proximity_placement_group_id: str - :keyword target_boot_diagnostics_storage_account_id: The target boot diagnostics storage - account ARM Id. - :paramtype target_boot_diagnostics_storage_account_id: str - :keyword target_network_id: The target network ARM Id. - :paramtype target_network_id: str - :keyword test_network_id: The test network ARM Id. - :paramtype test_network_id: str - :keyword vm_nics: The list of NIC details. - :paramtype vm_nics: list[~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmNicInput] - :keyword license_type: The license type. Known values are: "NotSpecified", "NoLicenseType", and - "WindowsServer". - :paramtype license_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.LicenseType - :keyword sql_server_license_type: The SQL Server license type. Known values are: - "NotSpecified", "NoLicenseType", "PAYG", and "AHUB". - :paramtype sql_server_license_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.SqlServerLicenseType - :keyword linux_license_type: The license type for Linux VM's. Known values are: "NotSpecified", - "NoLicenseType", and "LinuxServer". - :paramtype linux_license_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.LinuxLicenseType - :keyword user_selected_os_name: The OS name selected by user. - :paramtype user_selected_os_name: str - :keyword target_vm_tags: The target VM tags. - :paramtype target_vm_tags: - list[~azure.mgmt.recoveryservicessiterecovery.models.UserCreatedResourceTag] - :keyword target_managed_disk_tags: The tags for the target managed disks. - :paramtype target_managed_disk_tags: - list[~azure.mgmt.recoveryservicessiterecovery.models.UserCreatedResourceTag] - :keyword target_nic_tags: The tags for the target NICs. - :paramtype target_nic_tags: - list[~azure.mgmt.recoveryservicessiterecovery.models.UserCreatedResourceTag] - """ - super().__init__(**kwargs) - self.instance_type: str = "InMageRcm" - self.target_vm_name = target_vm_name - self.target_vm_size = target_vm_size - self.target_resource_group_id = target_resource_group_id - self.target_availability_set_id = target_availability_set_id - self.target_availability_zone = target_availability_zone - self.target_proximity_placement_group_id = target_proximity_placement_group_id - self.target_boot_diagnostics_storage_account_id = target_boot_diagnostics_storage_account_id - self.target_network_id = target_network_id - self.test_network_id = test_network_id - self.vm_nics = vm_nics - self.license_type = license_type - self.sql_server_license_type = sql_server_license_type - self.linux_license_type = linux_license_type - self.user_selected_os_name = user_selected_os_name - self.target_vm_tags = target_vm_tags - self.target_managed_disk_tags = target_managed_disk_tags - self.target_nic_tags = target_nic_tags - - -class InMageReplicationDetails(ReplicationProviderSpecificSettings): - """InMage provider specific settings. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: Gets the Instance type. Required. - :vartype instance_type: str - :ivar active_site_type: The active location of the VM. If the VM is being protected from Azure, - this field will take values from { Azure, OnPrem }. If the VM is being protected between two - data-centers, this field will be OnPrem always. - :vartype active_site_type: str - :ivar source_vm_cpu_count: The CPU count of the VM on the primary side. - :vartype source_vm_cpu_count: int - :ivar source_vm_ram_size_in_mb: The RAM size of the VM on the primary side. - :vartype source_vm_ram_size_in_mb: int - :ivar os_details: The OS details. - :vartype os_details: ~azure.mgmt.recoveryservicessiterecovery.models.OSDiskDetails - :ivar protection_stage: The protection stage. - :vartype protection_stage: str - :ivar vm_id: The virtual machine Id. - :vartype vm_id: str - :ivar vm_protection_state: The protection state for the vm. - :vartype vm_protection_state: str - :ivar vm_protection_state_description: The protection state description for the vm. - :vartype vm_protection_state_description: str - :ivar resync_details: The resync details of the machine. - :vartype resync_details: - ~azure.mgmt.recoveryservicessiterecovery.models.InitialReplicationDetails - :ivar retention_window_start: The retention window start time. - :vartype retention_window_start: ~datetime.datetime - :ivar retention_window_end: The retention window end time. - :vartype retention_window_end: ~datetime.datetime - :ivar compressed_data_rate_in_mb: The compressed data change rate in MB. - :vartype compressed_data_rate_in_mb: float - :ivar uncompressed_data_rate_in_mb: The uncompressed data change rate in MB. - :vartype uncompressed_data_rate_in_mb: float - :ivar rpo_in_seconds: The RPO in seconds. - :vartype rpo_in_seconds: int - :ivar protected_disks: The list of protected disks. - :vartype protected_disks: - list[~azure.mgmt.recoveryservicessiterecovery.models.InMageProtectedDiskDetails] - :ivar ip_address: The source IP address. - :vartype ip_address: str - :ivar last_heartbeat: The last heartbeat received from the source server. - :vartype last_heartbeat: ~datetime.datetime - :ivar process_server_id: The process server Id. - :vartype process_server_id: str - :ivar master_target_id: The master target Id. - :vartype master_target_id: str - :ivar consistency_points: The collection of Consistency points. - :vartype consistency_points: dict[str, ~datetime.datetime] - :ivar disk_resized: A value indicating whether any disk is resized for this VM. - :vartype disk_resized: str - :ivar reboot_after_update_status: A value indicating whether the source server requires a - restart after update. - :vartype reboot_after_update_status: str - :ivar multi_vm_group_id: The multi vm group Id, if any. - :vartype multi_vm_group_id: str - :ivar multi_vm_group_name: The multi vm group name, if any. - :vartype multi_vm_group_name: str - :ivar multi_vm_sync_status: A value indicating whether the multi vm sync is enabled or - disabled. - :vartype multi_vm_sync_status: str - :ivar agent_details: The agent details. - :vartype agent_details: ~azure.mgmt.recoveryservicessiterecovery.models.InMageAgentDetails - :ivar v_center_infrastructure_id: The vCenter infrastructure Id. - :vartype v_center_infrastructure_id: str - :ivar infrastructure_vm_id: The infrastructure VM Id. - :vartype infrastructure_vm_id: str - :ivar vm_nics: The PE Network details. - :vartype vm_nics: list[~azure.mgmt.recoveryservicessiterecovery.models.VMNicDetails] - :ivar discovery_type: A value indicating the discovery type of the machine. - :vartype discovery_type: str - :ivar azure_storage_account_id: A value indicating the underlying Azure storage account. If the - VM is not running in Azure, this value shall be set to null. - :vartype azure_storage_account_id: str - :ivar datastores: The datastores of the on-premise machine Value can be list of strings that - contain datastore names. - :vartype datastores: list[str] - :ivar validation_errors: The validation errors of the on-premise machine Value can be list of - validation errors. - :vartype validation_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] - :ivar last_rpo_calculated_time: The last RPO calculated time. - :vartype last_rpo_calculated_time: ~datetime.datetime - :ivar last_update_received_time: The last update time received from on-prem components. - :vartype last_update_received_time: ~datetime.datetime - :ivar replica_id: The replica id of the protected item. - :vartype replica_id: str - :ivar os_version: The OS Version of the protected item. - :vartype os_version: str - :ivar is_additional_stats_available: A value indicating whether additional IR stats are - available or not. - :vartype is_additional_stats_available: bool - :ivar total_data_transferred: The total transferred data in bytes. - :vartype total_data_transferred: int - :ivar total_progress_health: The progress health. - :vartype total_progress_health: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "active_site_type": {"key": "activeSiteType", "type": "str"}, - "source_vm_cpu_count": {"key": "sourceVmCpuCount", "type": "int"}, - "source_vm_ram_size_in_mb": {"key": "sourceVmRamSizeInMB", "type": "int"}, - "os_details": {"key": "osDetails", "type": "OSDiskDetails"}, - "protection_stage": {"key": "protectionStage", "type": "str"}, - "vm_id": {"key": "vmId", "type": "str"}, - "vm_protection_state": {"key": "vmProtectionState", "type": "str"}, - "vm_protection_state_description": {"key": "vmProtectionStateDescription", "type": "str"}, - "resync_details": {"key": "resyncDetails", "type": "InitialReplicationDetails"}, - "retention_window_start": {"key": "retentionWindowStart", "type": "iso-8601"}, - "retention_window_end": {"key": "retentionWindowEnd", "type": "iso-8601"}, - "compressed_data_rate_in_mb": {"key": "compressedDataRateInMB", "type": "float"}, - "uncompressed_data_rate_in_mb": {"key": "uncompressedDataRateInMB", "type": "float"}, - "rpo_in_seconds": {"key": "rpoInSeconds", "type": "int"}, - "protected_disks": {"key": "protectedDisks", "type": "[InMageProtectedDiskDetails]"}, - "ip_address": {"key": "ipAddress", "type": "str"}, - "last_heartbeat": {"key": "lastHeartbeat", "type": "iso-8601"}, - "process_server_id": {"key": "processServerId", "type": "str"}, - "master_target_id": {"key": "masterTargetId", "type": "str"}, - "consistency_points": {"key": "consistencyPoints", "type": "{iso-8601}"}, - "disk_resized": {"key": "diskResized", "type": "str"}, - "reboot_after_update_status": {"key": "rebootAfterUpdateStatus", "type": "str"}, - "multi_vm_group_id": {"key": "multiVmGroupId", "type": "str"}, - "multi_vm_group_name": {"key": "multiVmGroupName", "type": "str"}, - "multi_vm_sync_status": {"key": "multiVmSyncStatus", "type": "str"}, - "agent_details": {"key": "agentDetails", "type": "InMageAgentDetails"}, - "v_center_infrastructure_id": {"key": "vCenterInfrastructureId", "type": "str"}, - "infrastructure_vm_id": {"key": "infrastructureVmId", "type": "str"}, - "vm_nics": {"key": "vmNics", "type": "[VMNicDetails]"}, - "discovery_type": {"key": "discoveryType", "type": "str"}, - "azure_storage_account_id": {"key": "azureStorageAccountId", "type": "str"}, - "datastores": {"key": "datastores", "type": "[str]"}, - "validation_errors": {"key": "validationErrors", "type": "[HealthError]"}, - "last_rpo_calculated_time": {"key": "lastRpoCalculatedTime", "type": "iso-8601"}, - "last_update_received_time": {"key": "lastUpdateReceivedTime", "type": "iso-8601"}, - "replica_id": {"key": "replicaId", "type": "str"}, - "os_version": {"key": "osVersion", "type": "str"}, - "is_additional_stats_available": {"key": "isAdditionalStatsAvailable", "type": "bool"}, - "total_data_transferred": {"key": "totalDataTransferred", "type": "int"}, - "total_progress_health": {"key": "totalProgressHealth", "type": "str"}, - } - - def __init__( # pylint: disable=too-many-locals - self, - *, - active_site_type: Optional[str] = None, - source_vm_cpu_count: Optional[int] = None, - source_vm_ram_size_in_mb: Optional[int] = None, - os_details: Optional["_models.OSDiskDetails"] = None, - protection_stage: Optional[str] = None, - vm_id: Optional[str] = None, - vm_protection_state: Optional[str] = None, - vm_protection_state_description: Optional[str] = None, - resync_details: Optional["_models.InitialReplicationDetails"] = None, - retention_window_start: Optional[datetime.datetime] = None, - retention_window_end: Optional[datetime.datetime] = None, - compressed_data_rate_in_mb: Optional[float] = None, - uncompressed_data_rate_in_mb: Optional[float] = None, - rpo_in_seconds: Optional[int] = None, - protected_disks: Optional[List["_models.InMageProtectedDiskDetails"]] = None, - ip_address: Optional[str] = None, - last_heartbeat: Optional[datetime.datetime] = None, - process_server_id: Optional[str] = None, - master_target_id: Optional[str] = None, - consistency_points: Optional[Dict[str, datetime.datetime]] = None, - disk_resized: Optional[str] = None, - reboot_after_update_status: Optional[str] = None, - multi_vm_group_id: Optional[str] = None, - multi_vm_group_name: Optional[str] = None, - multi_vm_sync_status: Optional[str] = None, - agent_details: Optional["_models.InMageAgentDetails"] = None, - v_center_infrastructure_id: Optional[str] = None, - infrastructure_vm_id: Optional[str] = None, - vm_nics: Optional[List["_models.VMNicDetails"]] = None, - discovery_type: Optional[str] = None, - azure_storage_account_id: Optional[str] = None, - datastores: Optional[List[str]] = None, - validation_errors: Optional[List["_models.HealthError"]] = None, - last_rpo_calculated_time: Optional[datetime.datetime] = None, - last_update_received_time: Optional[datetime.datetime] = None, - replica_id: Optional[str] = None, - os_version: Optional[str] = None, - is_additional_stats_available: Optional[bool] = None, - total_data_transferred: Optional[int] = None, - total_progress_health: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword active_site_type: The active location of the VM. If the VM is being protected from - Azure, this field will take values from { Azure, OnPrem }. If the VM is being protected between - two data-centers, this field will be OnPrem always. - :paramtype active_site_type: str - :keyword source_vm_cpu_count: The CPU count of the VM on the primary side. - :paramtype source_vm_cpu_count: int - :keyword source_vm_ram_size_in_mb: The RAM size of the VM on the primary side. - :paramtype source_vm_ram_size_in_mb: int - :keyword os_details: The OS details. - :paramtype os_details: ~azure.mgmt.recoveryservicessiterecovery.models.OSDiskDetails - :keyword protection_stage: The protection stage. - :paramtype protection_stage: str - :keyword vm_id: The virtual machine Id. - :paramtype vm_id: str - :keyword vm_protection_state: The protection state for the vm. - :paramtype vm_protection_state: str - :keyword vm_protection_state_description: The protection state description for the vm. - :paramtype vm_protection_state_description: str - :keyword resync_details: The resync details of the machine. - :paramtype resync_details: - ~azure.mgmt.recoveryservicessiterecovery.models.InitialReplicationDetails - :keyword retention_window_start: The retention window start time. - :paramtype retention_window_start: ~datetime.datetime - :keyword retention_window_end: The retention window end time. - :paramtype retention_window_end: ~datetime.datetime - :keyword compressed_data_rate_in_mb: The compressed data change rate in MB. - :paramtype compressed_data_rate_in_mb: float - :keyword uncompressed_data_rate_in_mb: The uncompressed data change rate in MB. - :paramtype uncompressed_data_rate_in_mb: float - :keyword rpo_in_seconds: The RPO in seconds. - :paramtype rpo_in_seconds: int - :keyword protected_disks: The list of protected disks. - :paramtype protected_disks: - list[~azure.mgmt.recoveryservicessiterecovery.models.InMageProtectedDiskDetails] - :keyword ip_address: The source IP address. - :paramtype ip_address: str - :keyword last_heartbeat: The last heartbeat received from the source server. - :paramtype last_heartbeat: ~datetime.datetime - :keyword process_server_id: The process server Id. - :paramtype process_server_id: str - :keyword master_target_id: The master target Id. - :paramtype master_target_id: str - :keyword consistency_points: The collection of Consistency points. - :paramtype consistency_points: dict[str, ~datetime.datetime] - :keyword disk_resized: A value indicating whether any disk is resized for this VM. - :paramtype disk_resized: str - :keyword reboot_after_update_status: A value indicating whether the source server requires a - restart after update. - :paramtype reboot_after_update_status: str - :keyword multi_vm_group_id: The multi vm group Id, if any. - :paramtype multi_vm_group_id: str - :keyword multi_vm_group_name: The multi vm group name, if any. - :paramtype multi_vm_group_name: str - :keyword multi_vm_sync_status: A value indicating whether the multi vm sync is enabled or - disabled. - :paramtype multi_vm_sync_status: str - :keyword agent_details: The agent details. - :paramtype agent_details: ~azure.mgmt.recoveryservicessiterecovery.models.InMageAgentDetails - :keyword v_center_infrastructure_id: The vCenter infrastructure Id. - :paramtype v_center_infrastructure_id: str - :keyword infrastructure_vm_id: The infrastructure VM Id. - :paramtype infrastructure_vm_id: str - :keyword vm_nics: The PE Network details. - :paramtype vm_nics: list[~azure.mgmt.recoveryservicessiterecovery.models.VMNicDetails] - :keyword discovery_type: A value indicating the discovery type of the machine. - :paramtype discovery_type: str - :keyword azure_storage_account_id: A value indicating the underlying Azure storage account. If - the VM is not running in Azure, this value shall be set to null. - :paramtype azure_storage_account_id: str - :keyword datastores: The datastores of the on-premise machine Value can be list of strings that - contain datastore names. - :paramtype datastores: list[str] - :keyword validation_errors: The validation errors of the on-premise machine Value can be list - of validation errors. - :paramtype validation_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] - :keyword last_rpo_calculated_time: The last RPO calculated time. - :paramtype last_rpo_calculated_time: ~datetime.datetime - :keyword last_update_received_time: The last update time received from on-prem components. - :paramtype last_update_received_time: ~datetime.datetime - :keyword replica_id: The replica id of the protected item. - :paramtype replica_id: str - :keyword os_version: The OS Version of the protected item. - :paramtype os_version: str - :keyword is_additional_stats_available: A value indicating whether additional IR stats are - available or not. - :paramtype is_additional_stats_available: bool - :keyword total_data_transferred: The total transferred data in bytes. - :paramtype total_data_transferred: int - :keyword total_progress_health: The progress health. - :paramtype total_progress_health: str - """ - super().__init__(**kwargs) - self.instance_type: str = "InMage" - self.active_site_type = active_site_type - self.source_vm_cpu_count = source_vm_cpu_count - self.source_vm_ram_size_in_mb = source_vm_ram_size_in_mb - self.os_details = os_details - self.protection_stage = protection_stage - self.vm_id = vm_id - self.vm_protection_state = vm_protection_state - self.vm_protection_state_description = vm_protection_state_description - self.resync_details = resync_details - self.retention_window_start = retention_window_start - self.retention_window_end = retention_window_end - self.compressed_data_rate_in_mb = compressed_data_rate_in_mb - self.uncompressed_data_rate_in_mb = uncompressed_data_rate_in_mb - self.rpo_in_seconds = rpo_in_seconds - self.protected_disks = protected_disks - self.ip_address = ip_address - self.last_heartbeat = last_heartbeat - self.process_server_id = process_server_id - self.master_target_id = master_target_id - self.consistency_points = consistency_points - self.disk_resized = disk_resized - self.reboot_after_update_status = reboot_after_update_status - self.multi_vm_group_id = multi_vm_group_id - self.multi_vm_group_name = multi_vm_group_name - self.multi_vm_sync_status = multi_vm_sync_status - self.agent_details = agent_details - self.v_center_infrastructure_id = v_center_infrastructure_id - self.infrastructure_vm_id = infrastructure_vm_id - self.vm_nics = vm_nics - self.discovery_type = discovery_type - self.azure_storage_account_id = azure_storage_account_id - self.datastores = datastores - self.validation_errors = validation_errors - self.last_rpo_calculated_time = last_rpo_calculated_time - self.last_update_received_time = last_update_received_time - self.replica_id = replica_id - self.os_version = os_version - self.is_additional_stats_available = is_additional_stats_available - self.total_data_transferred = total_data_transferred - self.total_progress_health = total_progress_health - - -class InMageReprotectInput(ReverseReplicationProviderSpecificInput): - """InMageAzureV2 specific provider input. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - :ivar master_target_id: The Master Target Id. Required. - :vartype master_target_id: str - :ivar process_server_id: The Process Server Id. Required. - :vartype process_server_id: str - :ivar retention_drive: The retention drive to use on the MT. Required. - :vartype retention_drive: str - :ivar run_as_account_id: The CS account Id. - :vartype run_as_account_id: str - :ivar datastore_name: The target datastore name. - :vartype datastore_name: str - :ivar disk_exclusion_input: The enable disk exclusion input. - :vartype disk_exclusion_input: - ~azure.mgmt.recoveryservicessiterecovery.models.InMageDiskExclusionInput - :ivar profile_id: The Policy Id. Required. - :vartype profile_id: str - :ivar disks_to_include: The disks to include list. - :vartype disks_to_include: list[str] - """ - - _validation = { - "instance_type": {"required": True}, - "master_target_id": {"required": True}, - "process_server_id": {"required": True}, - "retention_drive": {"required": True}, - "profile_id": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "master_target_id": {"key": "masterTargetId", "type": "str"}, - "process_server_id": {"key": "processServerId", "type": "str"}, - "retention_drive": {"key": "retentionDrive", "type": "str"}, - "run_as_account_id": {"key": "runAsAccountId", "type": "str"}, - "datastore_name": {"key": "datastoreName", "type": "str"}, - "disk_exclusion_input": {"key": "diskExclusionInput", "type": "InMageDiskExclusionInput"}, - "profile_id": {"key": "profileId", "type": "str"}, - "disks_to_include": {"key": "disksToInclude", "type": "[str]"}, - } - - def __init__( - self, - *, - master_target_id: str, - process_server_id: str, - retention_drive: str, - profile_id: str, - run_as_account_id: Optional[str] = None, - datastore_name: Optional[str] = None, - disk_exclusion_input: Optional["_models.InMageDiskExclusionInput"] = None, - disks_to_include: Optional[List[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword master_target_id: The Master Target Id. Required. - :paramtype master_target_id: str - :keyword process_server_id: The Process Server Id. Required. - :paramtype process_server_id: str - :keyword retention_drive: The retention drive to use on the MT. Required. - :paramtype retention_drive: str - :keyword run_as_account_id: The CS account Id. - :paramtype run_as_account_id: str - :keyword datastore_name: The target datastore name. - :paramtype datastore_name: str - :keyword disk_exclusion_input: The enable disk exclusion input. - :paramtype disk_exclusion_input: - ~azure.mgmt.recoveryservicessiterecovery.models.InMageDiskExclusionInput - :keyword profile_id: The Policy Id. Required. - :paramtype profile_id: str - :keyword disks_to_include: The disks to include list. - :paramtype disks_to_include: list[str] - """ - super().__init__(**kwargs) - self.instance_type: str = "InMage" - self.master_target_id = master_target_id - self.process_server_id = process_server_id - self.retention_drive = retention_drive - self.run_as_account_id = run_as_account_id - self.datastore_name = datastore_name - self.disk_exclusion_input = disk_exclusion_input - self.profile_id = profile_id - self.disks_to_include = disks_to_include - - -class InMageTestFailoverInput(TestFailoverProviderSpecificInput): - """Provider specific input for InMage test failover. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - :ivar recovery_point_type: The recovery point type. Values from LatestTime, LatestTag or - Custom. In the case of custom, the recovery point provided by RecoveryPointId will be used. In - the other two cases, recovery point id will be ignored. Known values are: "LatestTime", - "LatestTag", and "Custom". - :vartype recovery_point_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPointType - :ivar recovery_point_id: The recovery point id to be passed to test failover to a particular - recovery point. In case of latest recovery point, null should be passed. - :vartype recovery_point_id: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "recovery_point_type": {"key": "recoveryPointType", "type": "str"}, - "recovery_point_id": {"key": "recoveryPointId", "type": "str"}, - } - - def __init__( - self, - *, - recovery_point_type: Optional[Union[str, "_models.RecoveryPointType"]] = None, - recovery_point_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword recovery_point_type: The recovery point type. Values from LatestTime, LatestTag or - Custom. In the case of custom, the recovery point provided by RecoveryPointId will be used. In - the other two cases, recovery point id will be ignored. Known values are: "LatestTime", - "LatestTag", and "Custom". - :paramtype recovery_point_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPointType - :keyword recovery_point_id: The recovery point id to be passed to test failover to a particular - recovery point. In case of latest recovery point, null should be passed. - :paramtype recovery_point_id: str - """ - super().__init__(**kwargs) - self.instance_type: str = "InMage" - self.recovery_point_type = recovery_point_type - self.recovery_point_id = recovery_point_id - - -class InMageUnplannedFailoverInput(UnplannedFailoverProviderSpecificInput): - """Provider specific input for InMage unplanned failover. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - :ivar recovery_point_type: The recovery point type. Values from LatestTime, LatestTag or - Custom. In the case of custom, the recovery point provided by RecoveryPointId will be used. In - the other two cases, recovery point id will be ignored. Known values are: "LatestTime", - "LatestTag", and "Custom". - :vartype recovery_point_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPointType - :ivar recovery_point_id: The recovery point id to be passed to failover to a particular - recovery point. In case of latest recovery point, null should be passed. - :vartype recovery_point_id: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "recovery_point_type": {"key": "recoveryPointType", "type": "str"}, - "recovery_point_id": {"key": "recoveryPointId", "type": "str"}, - } - - def __init__( - self, - *, - recovery_point_type: Optional[Union[str, "_models.RecoveryPointType"]] = None, - recovery_point_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword recovery_point_type: The recovery point type. Values from LatestTime, LatestTag or - Custom. In the case of custom, the recovery point provided by RecoveryPointId will be used. In - the other two cases, recovery point id will be ignored. Known values are: "LatestTime", - "LatestTag", and "Custom". - :paramtype recovery_point_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPointType - :keyword recovery_point_id: The recovery point id to be passed to failover to a particular - recovery point. In case of latest recovery point, null should be passed. - :paramtype recovery_point_id: str - """ - super().__init__(**kwargs) - self.instance_type: str = "InMage" - self.recovery_point_type = recovery_point_type - self.recovery_point_id = recovery_point_id - - -class InMageVolumeExclusionOptions(_serialization.Model): - """Guest disk signature based disk exclusion option when doing enable protection of virtual - machine in InMage provider. - - :ivar volume_label: The volume label. The disk having any volume with this label will be - excluded from replication. - :vartype volume_label: str - :ivar only_exclude_if_single_volume: The value indicating whether to exclude multi volume disk - or not. If a disk has multiple volumes and one of the volume has label matching with - VolumeLabel this disk will be excluded from replication if OnlyExcludeIfSingleVolume is false. - :vartype only_exclude_if_single_volume: str - """ - - _attribute_map = { - "volume_label": {"key": "volumeLabel", "type": "str"}, - "only_exclude_if_single_volume": {"key": "onlyExcludeIfSingleVolume", "type": "str"}, - } - - def __init__( - self, *, volume_label: Optional[str] = None, only_exclude_if_single_volume: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword volume_label: The volume label. The disk having any volume with this label will be - excluded from replication. - :paramtype volume_label: str - :keyword only_exclude_if_single_volume: The value indicating whether to exclude multi volume - disk or not. If a disk has multiple volumes and one of the volume has label matching with - VolumeLabel this disk will be excluded from replication if OnlyExcludeIfSingleVolume is false. - :paramtype only_exclude_if_single_volume: str - """ - super().__init__(**kwargs) - self.volume_label = volume_label - self.only_exclude_if_single_volume = only_exclude_if_single_volume - - -class InnerHealthError(_serialization.Model): - """Implements InnerHealthError class. HealthError object has a list of InnerHealthErrors as child - errors. InnerHealthError is used because this will prevent an infinite loop of structures when - Hydra tries to auto-generate the contract. We are exposing the related health errors as inner - health errors and all API consumers can utilize this in the same fashion as Exception -> - InnerException. - - :ivar error_source: Source of error. - :vartype error_source: str - :ivar error_type: Type of error. - :vartype error_type: str - :ivar error_level: Level of error. - :vartype error_level: str - :ivar error_category: Category of error. - :vartype error_category: str - :ivar error_code: Error code. - :vartype error_code: str - :ivar summary_message: Summary message of the entity. - :vartype summary_message: str - :ivar error_message: Error message. - :vartype error_message: str - :ivar possible_causes: Possible causes of error. - :vartype possible_causes: str - :ivar recommended_action: Recommended action to resolve error. - :vartype recommended_action: str - :ivar creation_time_utc: Error creation time (UTC). - :vartype creation_time_utc: ~datetime.datetime - :ivar recovery_provider_error_message: DRA error message. - :vartype recovery_provider_error_message: str - :ivar entity_id: ID of the entity. - :vartype entity_id: str - :ivar error_id: The health error unique id. - :vartype error_id: str - :ivar customer_resolvability: Value indicating whether the health error is customer resolvable. - Known values are: "Allowed" and "NotAllowed". - :vartype customer_resolvability: str or - ~azure.mgmt.recoveryservicessiterecovery.models.HealthErrorCustomerResolvability - """ - - _attribute_map = { - "error_source": {"key": "errorSource", "type": "str"}, - "error_type": {"key": "errorType", "type": "str"}, - "error_level": {"key": "errorLevel", "type": "str"}, - "error_category": {"key": "errorCategory", "type": "str"}, - "error_code": {"key": "errorCode", "type": "str"}, - "summary_message": {"key": "summaryMessage", "type": "str"}, - "error_message": {"key": "errorMessage", "type": "str"}, - "possible_causes": {"key": "possibleCauses", "type": "str"}, - "recommended_action": {"key": "recommendedAction", "type": "str"}, - "creation_time_utc": {"key": "creationTimeUtc", "type": "iso-8601"}, - "recovery_provider_error_message": {"key": "recoveryProviderErrorMessage", "type": "str"}, - "entity_id": {"key": "entityId", "type": "str"}, - "error_id": {"key": "errorId", "type": "str"}, - "customer_resolvability": {"key": "customerResolvability", "type": "str"}, - } - - def __init__( - self, - *, - error_source: Optional[str] = None, - error_type: Optional[str] = None, - error_level: Optional[str] = None, - error_category: Optional[str] = None, - error_code: Optional[str] = None, - summary_message: Optional[str] = None, - error_message: Optional[str] = None, - possible_causes: Optional[str] = None, - recommended_action: Optional[str] = None, - creation_time_utc: Optional[datetime.datetime] = None, - recovery_provider_error_message: Optional[str] = None, - entity_id: Optional[str] = None, - error_id: Optional[str] = None, - customer_resolvability: Optional[Union[str, "_models.HealthErrorCustomerResolvability"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword error_source: Source of error. - :paramtype error_source: str - :keyword error_type: Type of error. - :paramtype error_type: str - :keyword error_level: Level of error. - :paramtype error_level: str - :keyword error_category: Category of error. - :paramtype error_category: str - :keyword error_code: Error code. - :paramtype error_code: str - :keyword summary_message: Summary message of the entity. - :paramtype summary_message: str - :keyword error_message: Error message. - :paramtype error_message: str - :keyword possible_causes: Possible causes of error. - :paramtype possible_causes: str - :keyword recommended_action: Recommended action to resolve error. - :paramtype recommended_action: str - :keyword creation_time_utc: Error creation time (UTC). - :paramtype creation_time_utc: ~datetime.datetime - :keyword recovery_provider_error_message: DRA error message. - :paramtype recovery_provider_error_message: str - :keyword entity_id: ID of the entity. - :paramtype entity_id: str - :keyword error_id: The health error unique id. - :paramtype error_id: str - :keyword customer_resolvability: Value indicating whether the health error is customer - resolvable. Known values are: "Allowed" and "NotAllowed". - :paramtype customer_resolvability: str or - ~azure.mgmt.recoveryservicessiterecovery.models.HealthErrorCustomerResolvability - """ - super().__init__(**kwargs) - self.error_source = error_source - self.error_type = error_type - self.error_level = error_level - self.error_category = error_category - self.error_code = error_code - self.summary_message = summary_message - self.error_message = error_message - self.possible_causes = possible_causes - self.recommended_action = recommended_action - self.creation_time_utc = creation_time_utc - self.recovery_provider_error_message = recovery_provider_error_message - self.entity_id = entity_id - self.error_id = error_id - self.customer_resolvability = customer_resolvability - - -class InputEndpoint(_serialization.Model): - """InputEndpoint. - - :ivar endpoint_name: - :vartype endpoint_name: str - :ivar private_port: - :vartype private_port: int - :ivar public_port: - :vartype public_port: int - :ivar protocol: - :vartype protocol: str - """ - - _attribute_map = { - "endpoint_name": {"key": "endpointName", "type": "str"}, - "private_port": {"key": "privatePort", "type": "int"}, - "public_port": {"key": "publicPort", "type": "int"}, - "protocol": {"key": "protocol", "type": "str"}, - } - - def __init__( - self, - *, - endpoint_name: Optional[str] = None, - private_port: Optional[int] = None, - public_port: Optional[int] = None, - protocol: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword endpoint_name: - :paramtype endpoint_name: str - :keyword private_port: - :paramtype private_port: int - :keyword public_port: - :paramtype public_port: int - :keyword protocol: - :paramtype protocol: str - """ - super().__init__(**kwargs) - self.endpoint_name = endpoint_name - self.private_port = private_port - self.public_port = public_port - self.protocol = protocol - - -class IPConfigDetails(_serialization.Model): - """IPConfigDetails. - - :ivar name: - :vartype name: str - :ivar is_primary: - :vartype is_primary: bool - :ivar subnet_name: - :vartype subnet_name: str - :ivar static_ip_address: - :vartype static_ip_address: str - :ivar ip_address_type: - :vartype ip_address_type: str - :ivar is_seleted_for_failover: - :vartype is_seleted_for_failover: bool - :ivar recovery_subnet_name: - :vartype recovery_subnet_name: str - :ivar recovery_static_ip_address: - :vartype recovery_static_ip_address: str - :ivar recovery_ip_address_type: - :vartype recovery_ip_address_type: str - :ivar recovery_public_ip_address_id: - :vartype recovery_public_ip_address_id: str - :ivar recovery_lb_backend_address_pool_ids: - :vartype recovery_lb_backend_address_pool_ids: list[str] - :ivar tfo_subnet_name: - :vartype tfo_subnet_name: str - :ivar tfo_static_ip_address: - :vartype tfo_static_ip_address: str - :ivar tfo_public_ip_address_id: - :vartype tfo_public_ip_address_id: str - :ivar tfo_lb_backend_address_pool_ids: - :vartype tfo_lb_backend_address_pool_ids: list[str] - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "is_primary": {"key": "isPrimary", "type": "bool"}, - "subnet_name": {"key": "subnetName", "type": "str"}, - "static_ip_address": {"key": "staticIPAddress", "type": "str"}, - "ip_address_type": {"key": "ipAddressType", "type": "str"}, - "is_seleted_for_failover": {"key": "isSeletedForFailover", "type": "bool"}, - "recovery_subnet_name": {"key": "recoverySubnetName", "type": "str"}, - "recovery_static_ip_address": {"key": "recoveryStaticIPAddress", "type": "str"}, - "recovery_ip_address_type": {"key": "recoveryIPAddressType", "type": "str"}, - "recovery_public_ip_address_id": {"key": "recoveryPublicIPAddressId", "type": "str"}, - "recovery_lb_backend_address_pool_ids": {"key": "recoveryLBBackendAddressPoolIds", "type": "[str]"}, - "tfo_subnet_name": {"key": "tfoSubnetName", "type": "str"}, - "tfo_static_ip_address": {"key": "tfoStaticIPAddress", "type": "str"}, - "tfo_public_ip_address_id": {"key": "tfoPublicIPAddressId", "type": "str"}, - "tfo_lb_backend_address_pool_ids": {"key": "tfoLBBackendAddressPoolIds", "type": "[str]"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - is_primary: Optional[bool] = None, - subnet_name: Optional[str] = None, - static_ip_address: Optional[str] = None, - ip_address_type: Optional[str] = None, - is_seleted_for_failover: Optional[bool] = None, - recovery_subnet_name: Optional[str] = None, - recovery_static_ip_address: Optional[str] = None, - recovery_ip_address_type: Optional[str] = None, - recovery_public_ip_address_id: Optional[str] = None, - recovery_lb_backend_address_pool_ids: Optional[List[str]] = None, - tfo_subnet_name: Optional[str] = None, - tfo_static_ip_address: Optional[str] = None, - tfo_public_ip_address_id: Optional[str] = None, - tfo_lb_backend_address_pool_ids: Optional[List[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: - :paramtype name: str - :keyword is_primary: - :paramtype is_primary: bool - :keyword subnet_name: - :paramtype subnet_name: str - :keyword static_ip_address: - :paramtype static_ip_address: str - :keyword ip_address_type: - :paramtype ip_address_type: str - :keyword is_seleted_for_failover: - :paramtype is_seleted_for_failover: bool - :keyword recovery_subnet_name: - :paramtype recovery_subnet_name: str - :keyword recovery_static_ip_address: - :paramtype recovery_static_ip_address: str - :keyword recovery_ip_address_type: - :paramtype recovery_ip_address_type: str - :keyword recovery_public_ip_address_id: - :paramtype recovery_public_ip_address_id: str - :keyword recovery_lb_backend_address_pool_ids: - :paramtype recovery_lb_backend_address_pool_ids: list[str] - :keyword tfo_subnet_name: - :paramtype tfo_subnet_name: str - :keyword tfo_static_ip_address: - :paramtype tfo_static_ip_address: str - :keyword tfo_public_ip_address_id: - :paramtype tfo_public_ip_address_id: str - :keyword tfo_lb_backend_address_pool_ids: - :paramtype tfo_lb_backend_address_pool_ids: list[str] - """ - super().__init__(**kwargs) - self.name = name - self.is_primary = is_primary - self.subnet_name = subnet_name - self.static_ip_address = static_ip_address - self.ip_address_type = ip_address_type - self.is_seleted_for_failover = is_seleted_for_failover - self.recovery_subnet_name = recovery_subnet_name - self.recovery_static_ip_address = recovery_static_ip_address - self.recovery_ip_address_type = recovery_ip_address_type - self.recovery_public_ip_address_id = recovery_public_ip_address_id - self.recovery_lb_backend_address_pool_ids = recovery_lb_backend_address_pool_ids - self.tfo_subnet_name = tfo_subnet_name - self.tfo_static_ip_address = tfo_static_ip_address - self.tfo_public_ip_address_id = tfo_public_ip_address_id - self.tfo_lb_backend_address_pool_ids = tfo_lb_backend_address_pool_ids - - -class IPConfigInputDetails(_serialization.Model): - """IPConfigInputDetails. - - :ivar ip_config_name: - :vartype ip_config_name: str - :ivar is_primary: - :vartype is_primary: bool - :ivar is_seleted_for_failover: - :vartype is_seleted_for_failover: bool - :ivar recovery_subnet_name: - :vartype recovery_subnet_name: str - :ivar recovery_static_ip_address: - :vartype recovery_static_ip_address: str - :ivar recovery_public_ip_address_id: - :vartype recovery_public_ip_address_id: str - :ivar recovery_lb_backend_address_pool_ids: - :vartype recovery_lb_backend_address_pool_ids: list[str] - :ivar tfo_subnet_name: - :vartype tfo_subnet_name: str - :ivar tfo_static_ip_address: - :vartype tfo_static_ip_address: str - :ivar tfo_public_ip_address_id: - :vartype tfo_public_ip_address_id: str - :ivar tfo_lb_backend_address_pool_ids: - :vartype tfo_lb_backend_address_pool_ids: list[str] - """ - - _attribute_map = { - "ip_config_name": {"key": "ipConfigName", "type": "str"}, - "is_primary": {"key": "isPrimary", "type": "bool"}, - "is_seleted_for_failover": {"key": "isSeletedForFailover", "type": "bool"}, - "recovery_subnet_name": {"key": "recoverySubnetName", "type": "str"}, - "recovery_static_ip_address": {"key": "recoveryStaticIPAddress", "type": "str"}, - "recovery_public_ip_address_id": {"key": "recoveryPublicIPAddressId", "type": "str"}, - "recovery_lb_backend_address_pool_ids": {"key": "recoveryLBBackendAddressPoolIds", "type": "[str]"}, - "tfo_subnet_name": {"key": "tfoSubnetName", "type": "str"}, - "tfo_static_ip_address": {"key": "tfoStaticIPAddress", "type": "str"}, - "tfo_public_ip_address_id": {"key": "tfoPublicIPAddressId", "type": "str"}, - "tfo_lb_backend_address_pool_ids": {"key": "tfoLBBackendAddressPoolIds", "type": "[str]"}, - } - - def __init__( - self, - *, - ip_config_name: Optional[str] = None, - is_primary: Optional[bool] = None, - is_seleted_for_failover: Optional[bool] = None, - recovery_subnet_name: Optional[str] = None, - recovery_static_ip_address: Optional[str] = None, - recovery_public_ip_address_id: Optional[str] = None, - recovery_lb_backend_address_pool_ids: Optional[List[str]] = None, - tfo_subnet_name: Optional[str] = None, - tfo_static_ip_address: Optional[str] = None, - tfo_public_ip_address_id: Optional[str] = None, - tfo_lb_backend_address_pool_ids: Optional[List[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword ip_config_name: - :paramtype ip_config_name: str - :keyword is_primary: - :paramtype is_primary: bool - :keyword is_seleted_for_failover: - :paramtype is_seleted_for_failover: bool - :keyword recovery_subnet_name: - :paramtype recovery_subnet_name: str - :keyword recovery_static_ip_address: - :paramtype recovery_static_ip_address: str - :keyword recovery_public_ip_address_id: - :paramtype recovery_public_ip_address_id: str - :keyword recovery_lb_backend_address_pool_ids: - :paramtype recovery_lb_backend_address_pool_ids: list[str] - :keyword tfo_subnet_name: - :paramtype tfo_subnet_name: str - :keyword tfo_static_ip_address: - :paramtype tfo_static_ip_address: str - :keyword tfo_public_ip_address_id: - :paramtype tfo_public_ip_address_id: str - :keyword tfo_lb_backend_address_pool_ids: - :paramtype tfo_lb_backend_address_pool_ids: list[str] - """ - super().__init__(**kwargs) - self.ip_config_name = ip_config_name - self.is_primary = is_primary - self.is_seleted_for_failover = is_seleted_for_failover - self.recovery_subnet_name = recovery_subnet_name - self.recovery_static_ip_address = recovery_static_ip_address - self.recovery_public_ip_address_id = recovery_public_ip_address_id - self.recovery_lb_backend_address_pool_ids = recovery_lb_backend_address_pool_ids - self.tfo_subnet_name = tfo_subnet_name - self.tfo_static_ip_address = tfo_static_ip_address - self.tfo_public_ip_address_id = tfo_public_ip_address_id - self.tfo_lb_backend_address_pool_ids = tfo_lb_backend_address_pool_ids - - -class Job(Resource): - """Job details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :ivar type: Resource Type. - :vartype type: str - :ivar location: Resource Location. - :vartype location: str - :ivar properties: The custom data. - :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.JobProperties - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "properties": {"key": "properties", "type": "JobProperties"}, - } - - def __init__( - self, *, location: Optional[str] = None, properties: Optional["_models.JobProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword location: Resource Location. - :paramtype location: str - :keyword properties: The custom data. - :paramtype properties: ~azure.mgmt.recoveryservicessiterecovery.models.JobProperties - """ - super().__init__(location=location, **kwargs) - self.properties = properties - - -class JobCollection(_serialization.Model): - """Collection of jobs. - - :ivar value: The list of jobs. - :vartype value: list[~azure.mgmt.recoveryservicessiterecovery.models.Job] - :ivar next_link: The value of next link. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[Job]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.Job"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The list of jobs. - :paramtype value: list[~azure.mgmt.recoveryservicessiterecovery.models.Job] - :keyword next_link: The value of next link. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class JobEntity(_serialization.Model): - """This class contains the minimal job details required to navigate to the desired drill down. - - :ivar job_id: The job id. - :vartype job_id: str - :ivar job_friendly_name: The job display name. - :vartype job_friendly_name: str - :ivar target_object_id: The object id. - :vartype target_object_id: str - :ivar target_object_name: The object name. - :vartype target_object_name: str - :ivar target_instance_type: The workflow affected object type. - :vartype target_instance_type: str - :ivar job_scenario_name: The job name. Enum type ScenarioName. - :vartype job_scenario_name: str - """ - - _attribute_map = { - "job_id": {"key": "jobId", "type": "str"}, - "job_friendly_name": {"key": "jobFriendlyName", "type": "str"}, - "target_object_id": {"key": "targetObjectId", "type": "str"}, - "target_object_name": {"key": "targetObjectName", "type": "str"}, - "target_instance_type": {"key": "targetInstanceType", "type": "str"}, - "job_scenario_name": {"key": "jobScenarioName", "type": "str"}, - } - - def __init__( - self, - *, - job_id: Optional[str] = None, - job_friendly_name: Optional[str] = None, - target_object_id: Optional[str] = None, - target_object_name: Optional[str] = None, - target_instance_type: Optional[str] = None, - job_scenario_name: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword job_id: The job id. - :paramtype job_id: str - :keyword job_friendly_name: The job display name. - :paramtype job_friendly_name: str - :keyword target_object_id: The object id. - :paramtype target_object_id: str - :keyword target_object_name: The object name. - :paramtype target_object_name: str - :keyword target_instance_type: The workflow affected object type. - :paramtype target_instance_type: str - :keyword job_scenario_name: The job name. Enum type ScenarioName. - :paramtype job_scenario_name: str - """ - super().__init__(**kwargs) - self.job_id = job_id - self.job_friendly_name = job_friendly_name - self.target_object_id = target_object_id - self.target_object_name = target_object_name - self.target_instance_type = target_instance_type - self.job_scenario_name = job_scenario_name - - -class JobErrorDetails(_serialization.Model): - """This class contains the error details per object. - - :ivar service_error_details: The Service error details. - :vartype service_error_details: ~azure.mgmt.recoveryservicessiterecovery.models.ServiceError - :ivar provider_error_details: The Provider error details. - :vartype provider_error_details: ~azure.mgmt.recoveryservicessiterecovery.models.ProviderError - :ivar error_level: Error level of error. - :vartype error_level: str - :ivar creation_time: The creation time of job error. - :vartype creation_time: ~datetime.datetime - :ivar task_id: The Id of the task. - :vartype task_id: str - """ - - _attribute_map = { - "service_error_details": {"key": "serviceErrorDetails", "type": "ServiceError"}, - "provider_error_details": {"key": "providerErrorDetails", "type": "ProviderError"}, - "error_level": {"key": "errorLevel", "type": "str"}, - "creation_time": {"key": "creationTime", "type": "iso-8601"}, - "task_id": {"key": "taskId", "type": "str"}, - } - - def __init__( - self, - *, - service_error_details: Optional["_models.ServiceError"] = None, - provider_error_details: Optional["_models.ProviderError"] = None, - error_level: Optional[str] = None, - creation_time: Optional[datetime.datetime] = None, - task_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword service_error_details: The Service error details. - :paramtype service_error_details: ~azure.mgmt.recoveryservicessiterecovery.models.ServiceError - :keyword provider_error_details: The Provider error details. - :paramtype provider_error_details: - ~azure.mgmt.recoveryservicessiterecovery.models.ProviderError - :keyword error_level: Error level of error. - :paramtype error_level: str - :keyword creation_time: The creation time of job error. - :paramtype creation_time: ~datetime.datetime - :keyword task_id: The Id of the task. - :paramtype task_id: str - """ - super().__init__(**kwargs) - self.service_error_details = service_error_details - self.provider_error_details = provider_error_details - self.error_level = error_level - self.creation_time = creation_time - self.task_id = task_id - - -class JobProperties(_serialization.Model): - """Job custom data details. - - :ivar activity_id: The activity id. - :vartype activity_id: str - :ivar scenario_name: The ScenarioName. - :vartype scenario_name: str - :ivar friendly_name: The DisplayName. - :vartype friendly_name: str - :ivar state: The status of the Job. It is one of these values - NotStarted, InProgress, - Succeeded, Failed, Cancelled, Suspended or Other. - :vartype state: str - :ivar state_description: The description of the state of the Job. For e.g. - For Succeeded - state, description can be Completed, PartiallySucceeded, CompletedWithInformation or Skipped. - :vartype state_description: str - :ivar tasks: The tasks. - :vartype tasks: list[~azure.mgmt.recoveryservicessiterecovery.models.ASRTask] - :ivar errors: The errors. - :vartype errors: list[~azure.mgmt.recoveryservicessiterecovery.models.JobErrorDetails] - :ivar start_time: The start time. - :vartype start_time: ~datetime.datetime - :ivar end_time: The end time. - :vartype end_time: ~datetime.datetime - :ivar allowed_actions: The Allowed action the job. - :vartype allowed_actions: list[str] - :ivar target_object_id: The affected Object Id. - :vartype target_object_id: str - :ivar target_object_name: The name of the affected object. - :vartype target_object_name: str - :ivar target_instance_type: The type of the affected object which is of - Microsoft.Azure.SiteRecovery.V2015_11_10.AffectedObjectType class. - :vartype target_instance_type: str - :ivar custom_details: The custom job details like test failover job details. - :vartype custom_details: ~azure.mgmt.recoveryservicessiterecovery.models.JobDetails - """ - - _attribute_map = { - "activity_id": {"key": "activityId", "type": "str"}, - "scenario_name": {"key": "scenarioName", "type": "str"}, - "friendly_name": {"key": "friendlyName", "type": "str"}, - "state": {"key": "state", "type": "str"}, - "state_description": {"key": "stateDescription", "type": "str"}, - "tasks": {"key": "tasks", "type": "[ASRTask]"}, - "errors": {"key": "errors", "type": "[JobErrorDetails]"}, - "start_time": {"key": "startTime", "type": "iso-8601"}, - "end_time": {"key": "endTime", "type": "iso-8601"}, - "allowed_actions": {"key": "allowedActions", "type": "[str]"}, - "target_object_id": {"key": "targetObjectId", "type": "str"}, - "target_object_name": {"key": "targetObjectName", "type": "str"}, - "target_instance_type": {"key": "targetInstanceType", "type": "str"}, - "custom_details": {"key": "customDetails", "type": "JobDetails"}, - } - - def __init__( - self, - *, - activity_id: Optional[str] = None, - scenario_name: Optional[str] = None, - friendly_name: Optional[str] = None, - state: Optional[str] = None, - state_description: Optional[str] = None, - tasks: Optional[List["_models.ASRTask"]] = None, - errors: Optional[List["_models.JobErrorDetails"]] = None, - start_time: Optional[datetime.datetime] = None, - end_time: Optional[datetime.datetime] = None, - allowed_actions: Optional[List[str]] = None, - target_object_id: Optional[str] = None, - target_object_name: Optional[str] = None, - target_instance_type: Optional[str] = None, - custom_details: Optional["_models.JobDetails"] = None, - **kwargs: Any - ) -> None: - """ - :keyword activity_id: The activity id. - :paramtype activity_id: str - :keyword scenario_name: The ScenarioName. - :paramtype scenario_name: str - :keyword friendly_name: The DisplayName. - :paramtype friendly_name: str - :keyword state: The status of the Job. It is one of these values - NotStarted, InProgress, - Succeeded, Failed, Cancelled, Suspended or Other. - :paramtype state: str - :keyword state_description: The description of the state of the Job. For e.g. - For Succeeded - state, description can be Completed, PartiallySucceeded, CompletedWithInformation or Skipped. - :paramtype state_description: str - :keyword tasks: The tasks. - :paramtype tasks: list[~azure.mgmt.recoveryservicessiterecovery.models.ASRTask] - :keyword errors: The errors. - :paramtype errors: list[~azure.mgmt.recoveryservicessiterecovery.models.JobErrorDetails] - :keyword start_time: The start time. - :paramtype start_time: ~datetime.datetime - :keyword end_time: The end time. - :paramtype end_time: ~datetime.datetime - :keyword allowed_actions: The Allowed action the job. - :paramtype allowed_actions: list[str] - :keyword target_object_id: The affected Object Id. - :paramtype target_object_id: str - :keyword target_object_name: The name of the affected object. - :paramtype target_object_name: str - :keyword target_instance_type: The type of the affected object which is of - Microsoft.Azure.SiteRecovery.V2015_11_10.AffectedObjectType class. - :paramtype target_instance_type: str - :keyword custom_details: The custom job details like test failover job details. - :paramtype custom_details: ~azure.mgmt.recoveryservicessiterecovery.models.JobDetails - """ - super().__init__(**kwargs) - self.activity_id = activity_id - self.scenario_name = scenario_name - self.friendly_name = friendly_name - self.state = state - self.state_description = state_description - self.tasks = tasks - self.errors = errors - self.start_time = start_time - self.end_time = end_time - self.allowed_actions = allowed_actions - self.target_object_id = target_object_id - self.target_object_name = target_object_name - self.target_instance_type = target_instance_type - self.custom_details = custom_details - - -class JobQueryParameter(_serialization.Model): - """Query parameter to enumerate jobs. - - :ivar start_time: Date time to get jobs from. - :vartype start_time: str - :ivar end_time: Date time to get jobs upto. - :vartype end_time: str - :ivar fabric_id: The Id of the fabric to search jobs under. - :vartype fabric_id: str - :ivar affected_object_types: The type of objects. - :vartype affected_object_types: str - :ivar job_status: The states of the job to be filtered can be in. - :vartype job_status: str - :ivar job_output_type: The output type of the jobs. Known values are: "Json", "Xml", and - "Excel". - :vartype job_output_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.ExportJobOutputSerializationType - :ivar job_name: The job Name. - :vartype job_name: str - :ivar timezone_offset: The timezone offset for the location of the request (in minutes). - :vartype timezone_offset: float - """ - - _attribute_map = { - "start_time": {"key": "startTime", "type": "str"}, - "end_time": {"key": "endTime", "type": "str"}, - "fabric_id": {"key": "fabricId", "type": "str"}, - "affected_object_types": {"key": "affectedObjectTypes", "type": "str"}, - "job_status": {"key": "jobStatus", "type": "str"}, - "job_output_type": {"key": "jobOutputType", "type": "str"}, - "job_name": {"key": "jobName", "type": "str"}, - "timezone_offset": {"key": "timezoneOffset", "type": "float"}, - } - - def __init__( - self, - *, - start_time: Optional[str] = None, - end_time: Optional[str] = None, - fabric_id: Optional[str] = None, - affected_object_types: Optional[str] = None, - job_status: Optional[str] = None, - job_output_type: Optional[Union[str, "_models.ExportJobOutputSerializationType"]] = None, - job_name: Optional[str] = None, - timezone_offset: Optional[float] = None, - **kwargs: Any - ) -> None: - """ - :keyword start_time: Date time to get jobs from. - :paramtype start_time: str - :keyword end_time: Date time to get jobs upto. - :paramtype end_time: str - :keyword fabric_id: The Id of the fabric to search jobs under. - :paramtype fabric_id: str - :keyword affected_object_types: The type of objects. - :paramtype affected_object_types: str - :keyword job_status: The states of the job to be filtered can be in. - :paramtype job_status: str - :keyword job_output_type: The output type of the jobs. Known values are: "Json", "Xml", and - "Excel". - :paramtype job_output_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.ExportJobOutputSerializationType - :keyword job_name: The job Name. - :paramtype job_name: str - :keyword timezone_offset: The timezone offset for the location of the request (in minutes). - :paramtype timezone_offset: float - """ - super().__init__(**kwargs) - self.start_time = start_time - self.end_time = end_time - self.fabric_id = fabric_id - self.affected_object_types = affected_object_types - self.job_status = job_status - self.job_output_type = job_output_type - self.job_name = job_name - self.timezone_offset = timezone_offset - - -class JobStatusEventDetails(EventSpecificDetails): - """Model class for event details of a job status event. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: Gets the class type. Overridden in derived classes. Required. - :vartype instance_type: str - :ivar job_id: Job arm id for the event. - :vartype job_id: str - :ivar job_friendly_name: JobName for the Event. - :vartype job_friendly_name: str - :ivar job_status: JobStatus for the Event. - :vartype job_status: str - :ivar affected_object_type: AffectedObjectType for the event. - :vartype affected_object_type: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "job_id": {"key": "jobId", "type": "str"}, - "job_friendly_name": {"key": "jobFriendlyName", "type": "str"}, - "job_status": {"key": "jobStatus", "type": "str"}, - "affected_object_type": {"key": "affectedObjectType", "type": "str"}, - } - - def __init__( - self, - *, - job_id: Optional[str] = None, - job_friendly_name: Optional[str] = None, - job_status: Optional[str] = None, - affected_object_type: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword job_id: Job arm id for the event. - :paramtype job_id: str - :keyword job_friendly_name: JobName for the Event. - :paramtype job_friendly_name: str - :keyword job_status: JobStatus for the Event. - :paramtype job_status: str - :keyword affected_object_type: AffectedObjectType for the event. - :paramtype affected_object_type: str - """ - super().__init__(**kwargs) - self.instance_type: str = "JobStatus" - self.job_id = job_id - self.job_friendly_name = job_friendly_name - self.job_status = job_status - self.affected_object_type = affected_object_type - - -class KeyEncryptionKeyInfo(_serialization.Model): - """Key Encryption Key (KEK) information. - - :ivar key_identifier: The key URL / identifier. - :vartype key_identifier: str - :ivar key_vault_resource_arm_id: The KeyVault resource ARM Id for key. - :vartype key_vault_resource_arm_id: str - """ - - _attribute_map = { - "key_identifier": {"key": "keyIdentifier", "type": "str"}, - "key_vault_resource_arm_id": {"key": "keyVaultResourceArmId", "type": "str"}, - } - - def __init__( - self, *, key_identifier: Optional[str] = None, key_vault_resource_arm_id: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword key_identifier: The key URL / identifier. - :paramtype key_identifier: str - :keyword key_vault_resource_arm_id: The KeyVault resource ARM Id for key. - :paramtype key_vault_resource_arm_id: str - """ - super().__init__(**kwargs) - self.key_identifier = key_identifier - self.key_vault_resource_arm_id = key_vault_resource_arm_id - - -class LogicalNetwork(Resource): - """Logical network data model. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :ivar type: Resource Type. - :vartype type: str - :ivar location: Resource Location. - :vartype location: str - :ivar properties: The Logical Network Properties. - :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.LogicalNetworkProperties - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "properties": {"key": "properties", "type": "LogicalNetworkProperties"}, - } - - def __init__( - self, - *, - location: Optional[str] = None, - properties: Optional["_models.LogicalNetworkProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword location: Resource Location. - :paramtype location: str - :keyword properties: The Logical Network Properties. - :paramtype properties: ~azure.mgmt.recoveryservicessiterecovery.models.LogicalNetworkProperties - """ - super().__init__(location=location, **kwargs) - self.properties = properties - - -class LogicalNetworkCollection(_serialization.Model): - """List of logical networks. - - :ivar value: The Logical Networks list details. - :vartype value: list[~azure.mgmt.recoveryservicessiterecovery.models.LogicalNetwork] - :ivar next_link: The value of next link. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[LogicalNetwork]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.LogicalNetwork"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The Logical Networks list details. - :paramtype value: list[~azure.mgmt.recoveryservicessiterecovery.models.LogicalNetwork] - :keyword next_link: The value of next link. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class LogicalNetworkProperties(_serialization.Model): - """Logical Network Properties. - - :ivar friendly_name: The Friendly Name. - :vartype friendly_name: str - :ivar network_virtualization_status: A value indicating whether Network Virtualization is - enabled for the logical network. - :vartype network_virtualization_status: str - :ivar logical_network_usage: A value indicating whether logical network is used as private test - network by test failover. - :vartype logical_network_usage: str - :ivar logical_network_definitions_status: A value indicating whether logical network - definitions are isolated. - :vartype logical_network_definitions_status: str - """ - - _attribute_map = { - "friendly_name": {"key": "friendlyName", "type": "str"}, - "network_virtualization_status": {"key": "networkVirtualizationStatus", "type": "str"}, - "logical_network_usage": {"key": "logicalNetworkUsage", "type": "str"}, - "logical_network_definitions_status": {"key": "logicalNetworkDefinitionsStatus", "type": "str"}, - } - - def __init__( - self, - *, - friendly_name: Optional[str] = None, - network_virtualization_status: Optional[str] = None, - logical_network_usage: Optional[str] = None, - logical_network_definitions_status: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword friendly_name: The Friendly Name. - :paramtype friendly_name: str - :keyword network_virtualization_status: A value indicating whether Network Virtualization is - enabled for the logical network. - :paramtype network_virtualization_status: str - :keyword logical_network_usage: A value indicating whether logical network is used as private - test network by test failover. - :paramtype logical_network_usage: str - :keyword logical_network_definitions_status: A value indicating whether logical network - definitions are isolated. - :paramtype logical_network_definitions_status: str - """ - super().__init__(**kwargs) - self.friendly_name = friendly_name - self.network_virtualization_status = network_virtualization_status - self.logical_network_usage = logical_network_usage - self.logical_network_definitions_status = logical_network_definitions_status - - -class ManagedRunCommandScriptInput(_serialization.Model): - """Managed RunCommand script input. - - All required parameters must be populated in order to send to server. - - :ivar step_name: The step name. Required. - :vartype step_name: str - :ivar script_url: The script url. Required. - :vartype script_url: str - :ivar script_parameters: The script parameters. Required. - :vartype script_parameters: str - """ - - _validation = { - "step_name": {"required": True}, - "script_url": {"required": True}, - "script_parameters": {"required": True}, - } - - _attribute_map = { - "step_name": {"key": "stepName", "type": "str"}, - "script_url": {"key": "scriptUrl", "type": "str"}, - "script_parameters": {"key": "scriptParameters", "type": "str"}, - } - - def __init__(self, *, step_name: str, script_url: str, script_parameters: str, **kwargs: Any) -> None: - """ - :keyword step_name: The step name. Required. - :paramtype step_name: str - :keyword script_url: The script url. Required. - :paramtype script_url: str - :keyword script_parameters: The script parameters. Required. - :paramtype script_parameters: str - """ - super().__init__(**kwargs) - self.step_name = step_name - self.script_url = script_url - self.script_parameters = script_parameters - - -class ManualActionTaskDetails(TaskTypeDetails): - """This class represents the manual action task details. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The type of task details. Required. - :vartype instance_type: str - :ivar name: The name. - :vartype name: str - :ivar instructions: The instructions. - :vartype instructions: str - :ivar observation: The observation. - :vartype observation: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "instructions": {"key": "instructions", "type": "str"}, - "observation": {"key": "observation", "type": "str"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - instructions: Optional[str] = None, - observation: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: The name. - :paramtype name: str - :keyword instructions: The instructions. - :paramtype instructions: str - :keyword observation: The observation. - :paramtype observation: str - """ - super().__init__(**kwargs) - self.instance_type: str = "ManualActionTaskDetails" - self.name = name - self.instructions = instructions - self.observation = observation - - -class MarsAgentDetails(_serialization.Model): - """Mars agent details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The Mars agent Id. - :vartype id: str - :ivar name: The Mars agent name. - :vartype name: str - :ivar bios_id: The Mars agent Bios Id. - :vartype bios_id: str - :ivar fabric_object_id: The fabric object Id. - :vartype fabric_object_id: str - :ivar fqdn: The Mars agent Fqdn. - :vartype fqdn: str - :ivar version: The version. - :vartype version: str - :ivar last_heartbeat_utc: The last heartbeat received from the Mars agent. - :vartype last_heartbeat_utc: ~datetime.datetime - :ivar health: The health of the Mars agent. Known values are: "None", "Normal", "Warning", and - "Critical". - :vartype health: str or ~azure.mgmt.recoveryservicessiterecovery.models.ProtectionHealth - :ivar health_errors: The health errors. - :vartype health_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "bios_id": {"readonly": True}, - "fabric_object_id": {"readonly": True}, - "fqdn": {"readonly": True}, - "version": {"readonly": True}, - "last_heartbeat_utc": {"readonly": True}, - "health": {"readonly": True}, - "health_errors": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "bios_id": {"key": "biosId", "type": "str"}, - "fabric_object_id": {"key": "fabricObjectId", "type": "str"}, - "fqdn": {"key": "fqdn", "type": "str"}, - "version": {"key": "version", "type": "str"}, - "last_heartbeat_utc": {"key": "lastHeartbeatUtc", "type": "iso-8601"}, - "health": {"key": "health", "type": "str"}, - "health_errors": {"key": "healthErrors", "type": "[HealthError]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.id: Optional[str] = None - self.name: Optional[str] = None - self.bios_id: Optional[str] = None - self.fabric_object_id: Optional[str] = None - self.fqdn: Optional[str] = None - self.version: Optional[str] = None - self.last_heartbeat_utc: Optional[datetime.datetime] = None - self.health: Optional[Union[str, "_models.ProtectionHealth"]] = None - self.health_errors: Optional[List["_models.HealthError"]] = None - - -class MasterTargetServer(_serialization.Model): - """Details of a Master Target Server. - - :ivar id: The server Id. - :vartype id: str - :ivar ip_address: The IP address of the server. - :vartype ip_address: str - :ivar name: The server name. - :vartype name: str - :ivar os_type: The OS type of the server. - :vartype os_type: str - :ivar agent_version: The version of the scout component on the server. - :vartype agent_version: str - :ivar last_heartbeat: The last heartbeat received from the server. - :vartype last_heartbeat: ~datetime.datetime - :ivar version_status: Version status. - :vartype version_status: str - :ivar retention_volumes: The retention volumes of Master target Server. - :vartype retention_volumes: - list[~azure.mgmt.recoveryservicessiterecovery.models.RetentionVolume] - :ivar data_stores: The list of data stores in the fabric. - :vartype data_stores: list[~azure.mgmt.recoveryservicessiterecovery.models.DataStore] - :ivar validation_errors: Validation errors. - :vartype validation_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] - :ivar health_errors: Health errors. - :vartype health_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] - :ivar disk_count: Disk count of the master target. - :vartype disk_count: int - :ivar os_version: OS Version of the master target. - :vartype os_version: str - :ivar agent_expiry_date: Agent expiry date. - :vartype agent_expiry_date: ~datetime.datetime - :ivar mars_agent_version: MARS agent version. - :vartype mars_agent_version: str - :ivar mars_agent_expiry_date: MARS agent expiry date. - :vartype mars_agent_expiry_date: ~datetime.datetime - :ivar agent_version_details: Agent version details. - :vartype agent_version_details: ~azure.mgmt.recoveryservicessiterecovery.models.VersionDetails - :ivar mars_agent_version_details: Mars agent version details. - :vartype mars_agent_version_details: - ~azure.mgmt.recoveryservicessiterecovery.models.VersionDetails - """ - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "ip_address": {"key": "ipAddress", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "os_type": {"key": "osType", "type": "str"}, - "agent_version": {"key": "agentVersion", "type": "str"}, - "last_heartbeat": {"key": "lastHeartbeat", "type": "iso-8601"}, - "version_status": {"key": "versionStatus", "type": "str"}, - "retention_volumes": {"key": "retentionVolumes", "type": "[RetentionVolume]"}, - "data_stores": {"key": "dataStores", "type": "[DataStore]"}, - "validation_errors": {"key": "validationErrors", "type": "[HealthError]"}, - "health_errors": {"key": "healthErrors", "type": "[HealthError]"}, - "disk_count": {"key": "diskCount", "type": "int"}, - "os_version": {"key": "osVersion", "type": "str"}, - "agent_expiry_date": {"key": "agentExpiryDate", "type": "iso-8601"}, - "mars_agent_version": {"key": "marsAgentVersion", "type": "str"}, - "mars_agent_expiry_date": {"key": "marsAgentExpiryDate", "type": "iso-8601"}, - "agent_version_details": {"key": "agentVersionDetails", "type": "VersionDetails"}, - "mars_agent_version_details": {"key": "marsAgentVersionDetails", "type": "VersionDetails"}, - } - - def __init__( - self, - *, - id: Optional[str] = None, # pylint: disable=redefined-builtin - ip_address: Optional[str] = None, - name: Optional[str] = None, - os_type: Optional[str] = None, - agent_version: Optional[str] = None, - last_heartbeat: Optional[datetime.datetime] = None, - version_status: Optional[str] = None, - retention_volumes: Optional[List["_models.RetentionVolume"]] = None, - data_stores: Optional[List["_models.DataStore"]] = None, - validation_errors: Optional[List["_models.HealthError"]] = None, - health_errors: Optional[List["_models.HealthError"]] = None, - disk_count: Optional[int] = None, - os_version: Optional[str] = None, - agent_expiry_date: Optional[datetime.datetime] = None, - mars_agent_version: Optional[str] = None, - mars_agent_expiry_date: Optional[datetime.datetime] = None, - agent_version_details: Optional["_models.VersionDetails"] = None, - mars_agent_version_details: Optional["_models.VersionDetails"] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: The server Id. - :paramtype id: str - :keyword ip_address: The IP address of the server. - :paramtype ip_address: str - :keyword name: The server name. - :paramtype name: str - :keyword os_type: The OS type of the server. - :paramtype os_type: str - :keyword agent_version: The version of the scout component on the server. - :paramtype agent_version: str - :keyword last_heartbeat: The last heartbeat received from the server. - :paramtype last_heartbeat: ~datetime.datetime - :keyword version_status: Version status. - :paramtype version_status: str - :keyword retention_volumes: The retention volumes of Master target Server. - :paramtype retention_volumes: - list[~azure.mgmt.recoveryservicessiterecovery.models.RetentionVolume] - :keyword data_stores: The list of data stores in the fabric. - :paramtype data_stores: list[~azure.mgmt.recoveryservicessiterecovery.models.DataStore] - :keyword validation_errors: Validation errors. - :paramtype validation_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] - :keyword health_errors: Health errors. - :paramtype health_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] - :keyword disk_count: Disk count of the master target. - :paramtype disk_count: int - :keyword os_version: OS Version of the master target. - :paramtype os_version: str - :keyword agent_expiry_date: Agent expiry date. - :paramtype agent_expiry_date: ~datetime.datetime - :keyword mars_agent_version: MARS agent version. - :paramtype mars_agent_version: str - :keyword mars_agent_expiry_date: MARS agent expiry date. - :paramtype mars_agent_expiry_date: ~datetime.datetime - :keyword agent_version_details: Agent version details. - :paramtype agent_version_details: - ~azure.mgmt.recoveryservicessiterecovery.models.VersionDetails - :keyword mars_agent_version_details: Mars agent version details. - :paramtype mars_agent_version_details: - ~azure.mgmt.recoveryservicessiterecovery.models.VersionDetails - """ - super().__init__(**kwargs) - self.id = id - self.ip_address = ip_address - self.name = name - self.os_type = os_type - self.agent_version = agent_version - self.last_heartbeat = last_heartbeat - self.version_status = version_status - self.retention_volumes = retention_volumes - self.data_stores = data_stores - self.validation_errors = validation_errors - self.health_errors = health_errors - self.disk_count = disk_count - self.os_version = os_version - self.agent_expiry_date = agent_expiry_date - self.mars_agent_version = mars_agent_version - self.mars_agent_expiry_date = mars_agent_expiry_date - self.agent_version_details = agent_version_details - self.mars_agent_version_details = mars_agent_version_details - - -class MigrateInput(_serialization.Model): - """Input for migrate. - - All required parameters must be populated in order to send to server. - - :ivar properties: Migrate input properties. Required. - :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.MigrateInputProperties - """ - - _validation = { - "properties": {"required": True}, - } - - _attribute_map = { - "properties": {"key": "properties", "type": "MigrateInputProperties"}, - } - - def __init__(self, *, properties: "_models.MigrateInputProperties", **kwargs: Any) -> None: - """ - :keyword properties: Migrate input properties. Required. - :paramtype properties: ~azure.mgmt.recoveryservicessiterecovery.models.MigrateInputProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class MigrateInputProperties(_serialization.Model): - """Migrate input properties. - - All required parameters must be populated in order to send to server. - - :ivar provider_specific_details: The provider specific details. Required. - :vartype provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.MigrateProviderSpecificInput - """ - - _validation = { - "provider_specific_details": {"required": True}, - } - - _attribute_map = { - "provider_specific_details": {"key": "providerSpecificDetails", "type": "MigrateProviderSpecificInput"}, - } - - def __init__(self, *, provider_specific_details: "_models.MigrateProviderSpecificInput", **kwargs: Any) -> None: - """ - :keyword provider_specific_details: The provider specific details. Required. - :paramtype provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.MigrateProviderSpecificInput - """ - super().__init__(**kwargs) - self.provider_specific_details = provider_specific_details - - -class MigrateProviderSpecificInput(_serialization.Model): - """Migrate provider specific input. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - VMwareCbtMigrateInput - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - } - - _subtype_map = {"instance_type": {"VMwareCbt": "VMwareCbtMigrateInput"}} - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.instance_type: Optional[str] = None - - -class MigrationItem(Resource): - """Migration item. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :ivar type: Resource Type. - :vartype type: str - :ivar location: Resource Location. - :vartype location: str - :ivar properties: The migration item properties. - :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.MigrationItemProperties - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "properties": {"key": "properties", "type": "MigrationItemProperties"}, - } - - def __init__( - self, - *, - location: Optional[str] = None, - properties: Optional["_models.MigrationItemProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword location: Resource Location. - :paramtype location: str - :keyword properties: The migration item properties. - :paramtype properties: ~azure.mgmt.recoveryservicessiterecovery.models.MigrationItemProperties - """ - super().__init__(location=location, **kwargs) - self.properties = properties - - -class MigrationItemCollection(_serialization.Model): - """Migration item collection. - - :ivar value: The list of migration items. - :vartype value: list[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] - :ivar next_link: The value of next link. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[MigrationItem]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.MigrationItem"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The list of migration items. - :paramtype value: list[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] - :keyword next_link: The value of next link. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class MigrationItemProperties(_serialization.Model): - """Migration item properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar machine_name: The on-premise virtual machine name. - :vartype machine_name: str - :ivar policy_id: The ARM Id of policy governing this item. - :vartype policy_id: str - :ivar policy_friendly_name: The name of policy governing this item. - :vartype policy_friendly_name: str - :ivar recovery_services_provider_id: The recovery services provider ARM Id. - :vartype recovery_services_provider_id: str - :ivar replication_status: The replication status. - :vartype replication_status: str - :ivar migration_state: The migration status. Known values are: "None", - "EnableMigrationInProgress", "EnableMigrationFailed", "DisableMigrationInProgress", - "DisableMigrationFailed", "InitialSeedingInProgress", "InitialSeedingFailed", "Replicating", - "MigrationInProgress", "MigrationSucceeded", "MigrationFailed", "ResumeInProgress", - "ResumeInitiated", "SuspendingProtection", "ProtectionSuspended", - "MigrationCompletedWithInformation", and "MigrationPartiallySucceeded". - :vartype migration_state: str or ~azure.mgmt.recoveryservicessiterecovery.models.MigrationState - :ivar migration_state_description: The migration state description. - :vartype migration_state_description: str - :ivar last_test_migration_time: The last test migration time. - :vartype last_test_migration_time: ~datetime.datetime - :ivar last_test_migration_status: The status of the last test migration. - :vartype last_test_migration_status: str - :ivar last_migration_time: The last migration time. - :vartype last_migration_time: ~datetime.datetime - :ivar last_migration_status: The status of the last migration. - :vartype last_migration_status: str - :ivar test_migrate_state: The test migrate state. Known values are: "None", - "TestMigrationInProgress", "TestMigrationSucceeded", "TestMigrationFailed", - "TestMigrationCleanupInProgress", "TestMigrationCompletedWithInformation", and - "TestMigrationPartiallySucceeded". - :vartype test_migrate_state: str or - ~azure.mgmt.recoveryservicessiterecovery.models.TestMigrationState - :ivar test_migrate_state_description: The test migrate state description. - :vartype test_migrate_state_description: str - :ivar health: The consolidated health. Known values are: "None", "Normal", "Warning", and - "Critical". - :vartype health: str or ~azure.mgmt.recoveryservicessiterecovery.models.ProtectionHealth - :ivar health_errors: The list of health errors. - :vartype health_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] - :ivar allowed_operations: The allowed operations on the migration item based on the current - migration state of the item. - :vartype allowed_operations: list[str or - ~azure.mgmt.recoveryservicessiterecovery.models.MigrationItemOperation] - :ivar current_job: The current job details. - :vartype current_job: ~azure.mgmt.recoveryservicessiterecovery.models.CurrentJobDetails - :ivar critical_job_history: The critical past job details. - :vartype critical_job_history: - list[~azure.mgmt.recoveryservicessiterecovery.models.CriticalJobHistoryDetails] - :ivar event_correlation_id: The correlation Id for events associated with this migration item. - :vartype event_correlation_id: str - :ivar provider_specific_details: The migration provider custom settings. - :vartype provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.MigrationProviderSpecificSettings - """ - - _validation = { - "machine_name": {"readonly": True}, - "policy_id": {"readonly": True}, - "policy_friendly_name": {"readonly": True}, - "recovery_services_provider_id": {"readonly": True}, - "replication_status": {"readonly": True}, - "migration_state": {"readonly": True}, - "migration_state_description": {"readonly": True}, - "last_test_migration_time": {"readonly": True}, - "last_test_migration_status": {"readonly": True}, - "last_migration_time": {"readonly": True}, - "last_migration_status": {"readonly": True}, - "test_migrate_state": {"readonly": True}, - "test_migrate_state_description": {"readonly": True}, - "health": {"readonly": True}, - "health_errors": {"readonly": True}, - "allowed_operations": {"readonly": True}, - "current_job": {"readonly": True}, - "critical_job_history": {"readonly": True}, - "event_correlation_id": {"readonly": True}, - } - - _attribute_map = { - "machine_name": {"key": "machineName", "type": "str"}, - "policy_id": {"key": "policyId", "type": "str"}, - "policy_friendly_name": {"key": "policyFriendlyName", "type": "str"}, - "recovery_services_provider_id": {"key": "recoveryServicesProviderId", "type": "str"}, - "replication_status": {"key": "replicationStatus", "type": "str"}, - "migration_state": {"key": "migrationState", "type": "str"}, - "migration_state_description": {"key": "migrationStateDescription", "type": "str"}, - "last_test_migration_time": {"key": "lastTestMigrationTime", "type": "iso-8601"}, - "last_test_migration_status": {"key": "lastTestMigrationStatus", "type": "str"}, - "last_migration_time": {"key": "lastMigrationTime", "type": "iso-8601"}, - "last_migration_status": {"key": "lastMigrationStatus", "type": "str"}, - "test_migrate_state": {"key": "testMigrateState", "type": "str"}, - "test_migrate_state_description": {"key": "testMigrateStateDescription", "type": "str"}, - "health": {"key": "health", "type": "str"}, - "health_errors": {"key": "healthErrors", "type": "[HealthError]"}, - "allowed_operations": {"key": "allowedOperations", "type": "[str]"}, - "current_job": {"key": "currentJob", "type": "CurrentJobDetails"}, - "critical_job_history": {"key": "criticalJobHistory", "type": "[CriticalJobHistoryDetails]"}, - "event_correlation_id": {"key": "eventCorrelationId", "type": "str"}, - "provider_specific_details": {"key": "providerSpecificDetails", "type": "MigrationProviderSpecificSettings"}, - } - - def __init__( - self, *, provider_specific_details: Optional["_models.MigrationProviderSpecificSettings"] = None, **kwargs: Any - ) -> None: - """ - :keyword provider_specific_details: The migration provider custom settings. - :paramtype provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.MigrationProviderSpecificSettings - """ - super().__init__(**kwargs) - self.machine_name: Optional[str] = None - self.policy_id: Optional[str] = None - self.policy_friendly_name: Optional[str] = None - self.recovery_services_provider_id: Optional[str] = None - self.replication_status: Optional[str] = None - self.migration_state: Optional[Union[str, "_models.MigrationState"]] = None - self.migration_state_description: Optional[str] = None - self.last_test_migration_time: Optional[datetime.datetime] = None - self.last_test_migration_status: Optional[str] = None - self.last_migration_time: Optional[datetime.datetime] = None - self.last_migration_status: Optional[str] = None - self.test_migrate_state: Optional[Union[str, "_models.TestMigrationState"]] = None - self.test_migrate_state_description: Optional[str] = None - self.health: Optional[Union[str, "_models.ProtectionHealth"]] = None - self.health_errors: Optional[List["_models.HealthError"]] = None - self.allowed_operations: Optional[List[Union[str, "_models.MigrationItemOperation"]]] = None - self.current_job: Optional["_models.CurrentJobDetails"] = None - self.critical_job_history: Optional[List["_models.CriticalJobHistoryDetails"]] = None - self.event_correlation_id: Optional[str] = None - self.provider_specific_details = provider_specific_details - - -class MigrationItemsQueryParameter(_serialization.Model): - """Query parameter to enumerate migration items. - - :ivar source_fabric_name: The source fabric name filter. - :vartype source_fabric_name: str - :ivar source_container_name: The source container name filter. - :vartype source_container_name: str - :ivar instance_type: The replication provider type. - :vartype instance_type: str - """ - - _attribute_map = { - "source_fabric_name": {"key": "sourceFabricName", "type": "str"}, - "source_container_name": {"key": "sourceContainerName", "type": "str"}, - "instance_type": {"key": "instanceType", "type": "str"}, - } - - def __init__( - self, - *, - source_fabric_name: Optional[str] = None, - source_container_name: Optional[str] = None, - instance_type: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword source_fabric_name: The source fabric name filter. - :paramtype source_fabric_name: str - :keyword source_container_name: The source container name filter. - :paramtype source_container_name: str - :keyword instance_type: The replication provider type. - :paramtype instance_type: str - """ - super().__init__(**kwargs) - self.source_fabric_name = source_fabric_name - self.source_container_name = source_container_name - self.instance_type = instance_type - - -class MigrationProviderSpecificSettings(_serialization.Model): - """Migration provider specific settings. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - VMwareCbtMigrationDetails - - All required parameters must be populated in order to send to server. - - :ivar instance_type: Gets the instance type. Required. - :vartype instance_type: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - } - - _subtype_map = {"instance_type": {"VMwareCbt": "VMwareCbtMigrationDetails"}} - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.instance_type: Optional[str] = None - - -class MigrationRecoveryPoint(Resource): - """Recovery point for a migration item. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :ivar type: Resource Type. - :vartype type: str - :ivar location: Resource Location. - :vartype location: str - :ivar properties: Recovery point properties. - :vartype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.MigrationRecoveryPointProperties - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "properties": {"key": "properties", "type": "MigrationRecoveryPointProperties"}, - } - - def __init__( - self, - *, - location: Optional[str] = None, - properties: Optional["_models.MigrationRecoveryPointProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword location: Resource Location. - :paramtype location: str - :keyword properties: Recovery point properties. - :paramtype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.MigrationRecoveryPointProperties - """ - super().__init__(location=location, **kwargs) - self.properties = properties - - -class MigrationRecoveryPointCollection(_serialization.Model): - """Collection of migration recovery points. - - :ivar value: The migration recovery point details. - :vartype value: list[~azure.mgmt.recoveryservicessiterecovery.models.MigrationRecoveryPoint] - :ivar next_link: The value of next link. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[MigrationRecoveryPoint]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.MigrationRecoveryPoint"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The migration recovery point details. - :paramtype value: list[~azure.mgmt.recoveryservicessiterecovery.models.MigrationRecoveryPoint] - :keyword next_link: The value of next link. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class MigrationRecoveryPointProperties(_serialization.Model): - """Migration item recovery point properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar recovery_point_time: The recovery point time. - :vartype recovery_point_time: ~datetime.datetime - :ivar recovery_point_type: The recovery point type. Known values are: "NotSpecified", - "ApplicationConsistent", and "CrashConsistent". - :vartype recovery_point_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.MigrationRecoveryPointType - """ - - _validation = { - "recovery_point_time": {"readonly": True}, - "recovery_point_type": {"readonly": True}, - } - - _attribute_map = { - "recovery_point_time": {"key": "recoveryPointTime", "type": "iso-8601"}, - "recovery_point_type": {"key": "recoveryPointType", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.recovery_point_time: Optional[datetime.datetime] = None - self.recovery_point_type: Optional[Union[str, "_models.MigrationRecoveryPointType"]] = None - - -class MobilityServiceUpdate(_serialization.Model): - """The Mobility Service update details. - - :ivar version: The version of the latest update. - :vartype version: str - :ivar reboot_status: The reboot status of the update - whether it is required or not. - :vartype reboot_status: str - :ivar os_type: The OS type. - :vartype os_type: str - """ - - _attribute_map = { - "version": {"key": "version", "type": "str"}, - "reboot_status": {"key": "rebootStatus", "type": "str"}, - "os_type": {"key": "osType", "type": "str"}, - } - - def __init__( - self, - *, - version: Optional[str] = None, - reboot_status: Optional[str] = None, - os_type: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword version: The version of the latest update. - :paramtype version: str - :keyword reboot_status: The reboot status of the update - whether it is required or not. - :paramtype reboot_status: str - :keyword os_type: The OS type. - :paramtype os_type: str - """ - super().__init__(**kwargs) - self.version = version - self.reboot_status = reboot_status - self.os_type = os_type - - -class Network(Resource): - """Network model. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :ivar type: Resource Type. - :vartype type: str - :ivar location: Resource Location. - :vartype location: str - :ivar properties: The Network Properties. - :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.NetworkProperties - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "properties": {"key": "properties", "type": "NetworkProperties"}, - } - - def __init__( - self, *, location: Optional[str] = None, properties: Optional["_models.NetworkProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword location: Resource Location. - :paramtype location: str - :keyword properties: The Network Properties. - :paramtype properties: ~azure.mgmt.recoveryservicessiterecovery.models.NetworkProperties - """ - super().__init__(location=location, **kwargs) - self.properties = properties - - -class NetworkCollection(_serialization.Model): - """List of networks. - - :ivar value: The Networks list details. - :vartype value: list[~azure.mgmt.recoveryservicessiterecovery.models.Network] - :ivar next_link: The value of next link. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[Network]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.Network"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The Networks list details. - :paramtype value: list[~azure.mgmt.recoveryservicessiterecovery.models.Network] - :keyword next_link: The value of next link. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class NetworkMapping(Resource): - """Network Mapping model. Ideally it should have been possible to inherit this class from prev - version in InheritedModels as long as there is no difference in structure or method signature. - Since there were no base Models for certain fields and methods viz NetworkMappingProperties and - Load with required return type, the class has been introduced in its entirety with references - to base models to facilitate extensions in subsequent versions. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :ivar type: Resource Type. - :vartype type: str - :ivar location: Resource Location. - :vartype location: str - :ivar properties: The Network Mapping Properties. - :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.NetworkMappingProperties - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "properties": {"key": "properties", "type": "NetworkMappingProperties"}, - } - - def __init__( - self, - *, - location: Optional[str] = None, - properties: Optional["_models.NetworkMappingProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword location: Resource Location. - :paramtype location: str - :keyword properties: The Network Mapping Properties. - :paramtype properties: ~azure.mgmt.recoveryservicessiterecovery.models.NetworkMappingProperties - """ - super().__init__(location=location, **kwargs) - self.properties = properties - - -class NetworkMappingCollection(_serialization.Model): - """List of network mappings. As with NetworkMapping, it should be possible to reuse a prev version - of this class. It doesn't seem likely this class could be anything more than a slightly bespoke - collection of NetworkMapping. Hence it makes sense to override Load with Base.NetworkMapping - instead of existing CurrentVersion.NetworkMapping. - - :ivar value: The Network Mappings list. - :vartype value: list[~azure.mgmt.recoveryservicessiterecovery.models.NetworkMapping] - :ivar next_link: The value of next link. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[NetworkMapping]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.NetworkMapping"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The Network Mappings list. - :paramtype value: list[~azure.mgmt.recoveryservicessiterecovery.models.NetworkMapping] - :keyword next_link: The value of next link. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class NetworkMappingProperties(_serialization.Model): - """Network Mapping Properties. - - :ivar state: The pairing state for network mapping. - :vartype state: str - :ivar primary_network_friendly_name: The primary network friendly name. - :vartype primary_network_friendly_name: str - :ivar primary_network_id: The primary network id for network mapping. - :vartype primary_network_id: str - :ivar primary_fabric_friendly_name: The primary fabric friendly name. - :vartype primary_fabric_friendly_name: str - :ivar recovery_network_friendly_name: The recovery network friendly name. - :vartype recovery_network_friendly_name: str - :ivar recovery_network_id: The recovery network id for network mapping. - :vartype recovery_network_id: str - :ivar recovery_fabric_arm_id: The recovery fabric ARM id. - :vartype recovery_fabric_arm_id: str - :ivar recovery_fabric_friendly_name: The recovery fabric friendly name. - :vartype recovery_fabric_friendly_name: str - :ivar fabric_specific_settings: The fabric specific settings. - :vartype fabric_specific_settings: - ~azure.mgmt.recoveryservicessiterecovery.models.NetworkMappingFabricSpecificSettings - """ - - _attribute_map = { - "state": {"key": "state", "type": "str"}, - "primary_network_friendly_name": {"key": "primaryNetworkFriendlyName", "type": "str"}, - "primary_network_id": {"key": "primaryNetworkId", "type": "str"}, - "primary_fabric_friendly_name": {"key": "primaryFabricFriendlyName", "type": "str"}, - "recovery_network_friendly_name": {"key": "recoveryNetworkFriendlyName", "type": "str"}, - "recovery_network_id": {"key": "recoveryNetworkId", "type": "str"}, - "recovery_fabric_arm_id": {"key": "recoveryFabricArmId", "type": "str"}, - "recovery_fabric_friendly_name": {"key": "recoveryFabricFriendlyName", "type": "str"}, - "fabric_specific_settings": {"key": "fabricSpecificSettings", "type": "NetworkMappingFabricSpecificSettings"}, - } - - def __init__( - self, - *, - state: Optional[str] = None, - primary_network_friendly_name: Optional[str] = None, - primary_network_id: Optional[str] = None, - primary_fabric_friendly_name: Optional[str] = None, - recovery_network_friendly_name: Optional[str] = None, - recovery_network_id: Optional[str] = None, - recovery_fabric_arm_id: Optional[str] = None, - recovery_fabric_friendly_name: Optional[str] = None, - fabric_specific_settings: Optional["_models.NetworkMappingFabricSpecificSettings"] = None, - **kwargs: Any - ) -> None: - """ - :keyword state: The pairing state for network mapping. - :paramtype state: str - :keyword primary_network_friendly_name: The primary network friendly name. - :paramtype primary_network_friendly_name: str - :keyword primary_network_id: The primary network id for network mapping. - :paramtype primary_network_id: str - :keyword primary_fabric_friendly_name: The primary fabric friendly name. - :paramtype primary_fabric_friendly_name: str - :keyword recovery_network_friendly_name: The recovery network friendly name. - :paramtype recovery_network_friendly_name: str - :keyword recovery_network_id: The recovery network id for network mapping. - :paramtype recovery_network_id: str - :keyword recovery_fabric_arm_id: The recovery fabric ARM id. - :paramtype recovery_fabric_arm_id: str - :keyword recovery_fabric_friendly_name: The recovery fabric friendly name. - :paramtype recovery_fabric_friendly_name: str - :keyword fabric_specific_settings: The fabric specific settings. - :paramtype fabric_specific_settings: - ~azure.mgmt.recoveryservicessiterecovery.models.NetworkMappingFabricSpecificSettings - """ - super().__init__(**kwargs) - self.state = state - self.primary_network_friendly_name = primary_network_friendly_name - self.primary_network_id = primary_network_id - self.primary_fabric_friendly_name = primary_fabric_friendly_name - self.recovery_network_friendly_name = recovery_network_friendly_name - self.recovery_network_id = recovery_network_id - self.recovery_fabric_arm_id = recovery_fabric_arm_id - self.recovery_fabric_friendly_name = recovery_fabric_friendly_name - self.fabric_specific_settings = fabric_specific_settings - - -class NetworkProperties(_serialization.Model): - """Network Properties. - - :ivar fabric_type: The Fabric Type. - :vartype fabric_type: str - :ivar subnets: The List of subnets. - :vartype subnets: list[~azure.mgmt.recoveryservicessiterecovery.models.Subnet] - :ivar friendly_name: The Friendly Name. - :vartype friendly_name: str - :ivar network_type: The Network Type. - :vartype network_type: str - """ - - _attribute_map = { - "fabric_type": {"key": "fabricType", "type": "str"}, - "subnets": {"key": "subnets", "type": "[Subnet]"}, - "friendly_name": {"key": "friendlyName", "type": "str"}, - "network_type": {"key": "networkType", "type": "str"}, - } - - def __init__( - self, - *, - fabric_type: Optional[str] = None, - subnets: Optional[List["_models.Subnet"]] = None, - friendly_name: Optional[str] = None, - network_type: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword fabric_type: The Fabric Type. - :paramtype fabric_type: str - :keyword subnets: The List of subnets. - :paramtype subnets: list[~azure.mgmt.recoveryservicessiterecovery.models.Subnet] - :keyword friendly_name: The Friendly Name. - :paramtype friendly_name: str - :keyword network_type: The Network Type. - :paramtype network_type: str - """ - super().__init__(**kwargs) - self.fabric_type = fabric_type - self.subnets = subnets - self.friendly_name = friendly_name - self.network_type = network_type - - -class NewProtectionProfile(ProtectionProfileCustomDetails): - """New Protection profile input. - - All required parameters must be populated in order to send to server. - - :ivar resource_type: The class type. Required. - :vartype resource_type: str - :ivar policy_name: The protection profile input. Required. - :vartype policy_name: str - :ivar recovery_point_history: The duration in minutes until which the recovery points need to - be stored. - :vartype recovery_point_history: int - :ivar crash_consistent_frequency_in_minutes: The crash consistent snapshot frequency (in - minutes). - :vartype crash_consistent_frequency_in_minutes: int - :ivar app_consistent_frequency_in_minutes: The app consistent snapshot frequency (in minutes). - :vartype app_consistent_frequency_in_minutes: int - :ivar multi_vm_sync_status: A value indicating whether multi-VM sync has to be enabled. Value - should be 'Enabled' or 'Disabled'. Required. Known values are: "Enable" and "Disable". - :vartype multi_vm_sync_status: str or - ~azure.mgmt.recoveryservicessiterecovery.models.SetMultiVmSyncStatus - """ - - _validation = { - "resource_type": {"required": True}, - "policy_name": {"required": True}, - "multi_vm_sync_status": {"required": True}, - } - - _attribute_map = { - "resource_type": {"key": "resourceType", "type": "str"}, - "policy_name": {"key": "policyName", "type": "str"}, - "recovery_point_history": {"key": "recoveryPointHistory", "type": "int"}, - "crash_consistent_frequency_in_minutes": {"key": "crashConsistentFrequencyInMinutes", "type": "int"}, - "app_consistent_frequency_in_minutes": {"key": "appConsistentFrequencyInMinutes", "type": "int"}, - "multi_vm_sync_status": {"key": "multiVmSyncStatus", "type": "str"}, - } - - def __init__( - self, - *, - policy_name: str, - multi_vm_sync_status: Union[str, "_models.SetMultiVmSyncStatus"], - recovery_point_history: Optional[int] = None, - crash_consistent_frequency_in_minutes: Optional[int] = None, - app_consistent_frequency_in_minutes: Optional[int] = None, - **kwargs: Any - ) -> None: - """ - :keyword policy_name: The protection profile input. Required. - :paramtype policy_name: str - :keyword recovery_point_history: The duration in minutes until which the recovery points need - to be stored. - :paramtype recovery_point_history: int - :keyword crash_consistent_frequency_in_minutes: The crash consistent snapshot frequency (in - minutes). - :paramtype crash_consistent_frequency_in_minutes: int - :keyword app_consistent_frequency_in_minutes: The app consistent snapshot frequency (in - minutes). - :paramtype app_consistent_frequency_in_minutes: int - :keyword multi_vm_sync_status: A value indicating whether multi-VM sync has to be enabled. - Value should be 'Enabled' or 'Disabled'. Required. Known values are: "Enable" and "Disable". - :paramtype multi_vm_sync_status: str or - ~azure.mgmt.recoveryservicessiterecovery.models.SetMultiVmSyncStatus - """ - super().__init__(**kwargs) - self.resource_type: str = "New" - self.policy_name = policy_name - self.recovery_point_history = recovery_point_history - self.crash_consistent_frequency_in_minutes = crash_consistent_frequency_in_minutes - self.app_consistent_frequency_in_minutes = app_consistent_frequency_in_minutes - self.multi_vm_sync_status = multi_vm_sync_status - - -class NewRecoveryVirtualNetwork(RecoveryVirtualNetworkCustomDetails): - """Recovery virtual network input to create new virtual network from given source network. - - All required parameters must be populated in order to send to server. - - :ivar resource_type: The class type. Required. - :vartype resource_type: str - :ivar recovery_virtual_network_resource_group_name: The name of the resource group to be used - to create the recovery virtual network. If absent, target network would be created in the same - resource group as target VM. - :vartype recovery_virtual_network_resource_group_name: str - :ivar recovery_virtual_network_name: The recovery virtual network name. - :vartype recovery_virtual_network_name: str - """ - - _validation = { - "resource_type": {"required": True}, - } - - _attribute_map = { - "resource_type": {"key": "resourceType", "type": "str"}, - "recovery_virtual_network_resource_group_name": { - "key": "recoveryVirtualNetworkResourceGroupName", - "type": "str", - }, - "recovery_virtual_network_name": {"key": "recoveryVirtualNetworkName", "type": "str"}, - } - - def __init__( - self, - *, - recovery_virtual_network_resource_group_name: Optional[str] = None, - recovery_virtual_network_name: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword recovery_virtual_network_resource_group_name: The name of the resource group to be - used to create the recovery virtual network. If absent, target network would be created in the - same resource group as target VM. - :paramtype recovery_virtual_network_resource_group_name: str - :keyword recovery_virtual_network_name: The recovery virtual network name. - :paramtype recovery_virtual_network_name: str - """ - super().__init__(**kwargs) - self.resource_type: str = "New" - self.recovery_virtual_network_resource_group_name = recovery_virtual_network_resource_group_name - self.recovery_virtual_network_name = recovery_virtual_network_name - - -class OperationsDiscovery(_serialization.Model): - """Operations discovery class. - - :ivar name: Name of the API. The name of the operation being performed on this particular - object. It should match the action name that appears in RBAC / the event service. Examples of - operations include: * Microsoft.Compute/virtualMachine/capture/action * - Microsoft.Compute/virtualMachine/restart/action * Microsoft.Compute/virtualMachine/write * - Microsoft.Compute/virtualMachine/read * Microsoft.Compute/virtualMachine/delete Each action - should include, in order: (1) Resource Provider Namespace (2) Type hierarchy for which the - action applies (e.g. server/databases for a SQL Azure database) (3) Read, Write, Action or - Delete indicating which type applies. If it is a PUT/PATCH on a collection or named value, - Write should be used. If it is a GET, Read should be used. If it is a DELETE, Delete should be - used. If it is a POST, Action should be used. As a note: all resource providers would need to - include the "{Resource Provider Namespace}/register/action" operation in their response. This - API is used to register for their service, and should include details about the operation (e.g. - a localized name for the resource provider + any special considerations like PII release). - :vartype name: str - :ivar display: Object type. - :vartype display: ~azure.mgmt.recoveryservicessiterecovery.models.Display - :ivar origin: Origin. The intended executor of the operation; governs the display of the - operation in the RBAC UX and the audit logs UX. Default value is "user,system". - :vartype origin: str - :ivar properties: Properties. Reserved for future use. - :vartype properties: JSON - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "display": {"key": "display", "type": "Display"}, - "origin": {"key": "origin", "type": "str"}, - "properties": {"key": "properties", "type": "object"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - display: Optional["_models.Display"] = None, - origin: Optional[str] = None, - properties: Optional[JSON] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Name of the API. The name of the operation being performed on this particular - object. It should match the action name that appears in RBAC / the event service. Examples of - operations include: * Microsoft.Compute/virtualMachine/capture/action * - Microsoft.Compute/virtualMachine/restart/action * Microsoft.Compute/virtualMachine/write * - Microsoft.Compute/virtualMachine/read * Microsoft.Compute/virtualMachine/delete Each action - should include, in order: (1) Resource Provider Namespace (2) Type hierarchy for which the - action applies (e.g. server/databases for a SQL Azure database) (3) Read, Write, Action or - Delete indicating which type applies. If it is a PUT/PATCH on a collection or named value, - Write should be used. If it is a GET, Read should be used. If it is a DELETE, Delete should be - used. If it is a POST, Action should be used. As a note: all resource providers would need to - include the "{Resource Provider Namespace}/register/action" operation in their response. This - API is used to register for their service, and should include details about the operation (e.g. - a localized name for the resource provider + any special considerations like PII release). - :paramtype name: str - :keyword display: Object type. - :paramtype display: ~azure.mgmt.recoveryservicessiterecovery.models.Display - :keyword origin: Origin. The intended executor of the operation; governs the display of the - operation in the RBAC UX and the audit logs UX. Default value is "user,system". - :paramtype origin: str - :keyword properties: Properties. Reserved for future use. - :paramtype properties: JSON - """ - super().__init__(**kwargs) - self.name = name - self.display = display - self.origin = origin - self.properties = properties - - -class OperationsDiscoveryCollection(_serialization.Model): - """Collection of ClientDiscovery details. - - :ivar value: The ClientDiscovery details. - :vartype value: list[~azure.mgmt.recoveryservicessiterecovery.models.OperationsDiscovery] - :ivar next_link: The value of next link. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[OperationsDiscovery]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.OperationsDiscovery"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The ClientDiscovery details. - :paramtype value: list[~azure.mgmt.recoveryservicessiterecovery.models.OperationsDiscovery] - :keyword next_link: The value of next link. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class OSDetails(_serialization.Model): - """Disk Details. - - :ivar os_type: VM Disk details. - :vartype os_type: str - :ivar product_type: Product type. - :vartype product_type: str - :ivar os_edition: The OSEdition. - :vartype os_edition: str - :ivar o_s_version: The OS Version. - :vartype o_s_version: str - :ivar o_s_major_version: The OS Major Version. - :vartype o_s_major_version: str - :ivar o_s_minor_version: The OS Minor Version. - :vartype o_s_minor_version: str - :ivar user_selected_os_name: The OS name selected by user. - :vartype user_selected_os_name: str - """ - - _attribute_map = { - "os_type": {"key": "osType", "type": "str"}, - "product_type": {"key": "productType", "type": "str"}, - "os_edition": {"key": "osEdition", "type": "str"}, - "o_s_version": {"key": "oSVersion", "type": "str"}, - "o_s_major_version": {"key": "oSMajorVersion", "type": "str"}, - "o_s_minor_version": {"key": "oSMinorVersion", "type": "str"}, - "user_selected_os_name": {"key": "userSelectedOSName", "type": "str"}, - } - - def __init__( - self, - *, - os_type: Optional[str] = None, - product_type: Optional[str] = None, - os_edition: Optional[str] = None, - o_s_version: Optional[str] = None, - o_s_major_version: Optional[str] = None, - o_s_minor_version: Optional[str] = None, - user_selected_os_name: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword os_type: VM Disk details. - :paramtype os_type: str - :keyword product_type: Product type. - :paramtype product_type: str - :keyword os_edition: The OSEdition. - :paramtype os_edition: str - :keyword o_s_version: The OS Version. - :paramtype o_s_version: str - :keyword o_s_major_version: The OS Major Version. - :paramtype o_s_major_version: str - :keyword o_s_minor_version: The OS Minor Version. - :paramtype o_s_minor_version: str - :keyword user_selected_os_name: The OS name selected by user. - :paramtype user_selected_os_name: str - """ - super().__init__(**kwargs) - self.os_type = os_type - self.product_type = product_type - self.os_edition = os_edition - self.o_s_version = o_s_version - self.o_s_major_version = o_s_major_version - self.o_s_minor_version = o_s_minor_version - self.user_selected_os_name = user_selected_os_name - - -class OSDiskDetails(_serialization.Model): - """Details of the OS Disk. - - :ivar os_vhd_id: The id of the disk containing the OS. - :vartype os_vhd_id: str - :ivar os_type: The type of the OS on the VM. - :vartype os_type: str - :ivar vhd_name: The OS disk VHD name. - :vartype vhd_name: str - """ - - _attribute_map = { - "os_vhd_id": {"key": "osVhdId", "type": "str"}, - "os_type": {"key": "osType", "type": "str"}, - "vhd_name": {"key": "vhdName", "type": "str"}, - } - - def __init__( - self, - *, - os_vhd_id: Optional[str] = None, - os_type: Optional[str] = None, - vhd_name: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword os_vhd_id: The id of the disk containing the OS. - :paramtype os_vhd_id: str - :keyword os_type: The type of the OS on the VM. - :paramtype os_type: str - :keyword vhd_name: The OS disk VHD name. - :paramtype vhd_name: str - """ - super().__init__(**kwargs) - self.os_vhd_id = os_vhd_id - self.os_type = os_type - self.vhd_name = vhd_name - - -class OSUpgradeSupportedVersions(_serialization.Model): - """Supported OS upgrade versions. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar supported_source_os_version: The source OS version name. - :vartype supported_source_os_version: str - :ivar supported_target_os_versions: The target OS version names. - :vartype supported_target_os_versions: list[str] - """ - - _validation = { - "supported_source_os_version": {"readonly": True}, - "supported_target_os_versions": {"readonly": True}, - } - - _attribute_map = { - "supported_source_os_version": {"key": "supportedSourceOsVersion", "type": "str"}, - "supported_target_os_versions": {"key": "supportedTargetOsVersions", "type": "[str]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.supported_source_os_version: Optional[str] = None - self.supported_target_os_versions: Optional[List[str]] = None - - -class OSVersionWrapper(_serialization.Model): - """Wrapper model for OSVersion to include version and service pack info. - - :ivar version: The version. - :vartype version: str - :ivar service_pack: The service pack. - :vartype service_pack: str - """ - - _attribute_map = { - "version": {"key": "version", "type": "str"}, - "service_pack": {"key": "servicePack", "type": "str"}, - } - - def __init__(self, *, version: Optional[str] = None, service_pack: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword version: The version. - :paramtype version: str - :keyword service_pack: The service pack. - :paramtype service_pack: str - """ - super().__init__(**kwargs) - self.version = version - self.service_pack = service_pack - - -class PauseReplicationInput(_serialization.Model): - """Pause replication input. - - All required parameters must be populated in order to send to server. - - :ivar properties: Pause replication input properties. Required. - :vartype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.PauseReplicationInputProperties - """ - - _validation = { - "properties": {"required": True}, - } - - _attribute_map = { - "properties": {"key": "properties", "type": "PauseReplicationInputProperties"}, - } - - def __init__(self, *, properties: "_models.PauseReplicationInputProperties", **kwargs: Any) -> None: - """ - :keyword properties: Pause replication input properties. Required. - :paramtype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.PauseReplicationInputProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class PauseReplicationInputProperties(_serialization.Model): - """Pause replication input properties. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - } - - def __init__(self, *, instance_type: str, **kwargs: Any) -> None: - """ - :keyword instance_type: The class type. Required. - :paramtype instance_type: str - """ - super().__init__(**kwargs) - self.instance_type = instance_type - - -class PlannedFailoverInput(_serialization.Model): - """Input definition for planned failover. - - :ivar properties: Planned failover input properties. - :vartype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.PlannedFailoverInputProperties - """ - - _attribute_map = { - "properties": {"key": "properties", "type": "PlannedFailoverInputProperties"}, - } - - def __init__(self, *, properties: Optional["_models.PlannedFailoverInputProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Planned failover input properties. - :paramtype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.PlannedFailoverInputProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class PlannedFailoverInputProperties(_serialization.Model): - """Input definition for planned failover input properties. - - :ivar failover_direction: Failover direction. - :vartype failover_direction: str - :ivar provider_specific_details: Provider specific settings. - :vartype provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.PlannedFailoverProviderSpecificFailoverInput - """ - - _attribute_map = { - "failover_direction": {"key": "failoverDirection", "type": "str"}, - "provider_specific_details": { - "key": "providerSpecificDetails", - "type": "PlannedFailoverProviderSpecificFailoverInput", - }, - } - - def __init__( - self, - *, - failover_direction: Optional[str] = None, - provider_specific_details: Optional["_models.PlannedFailoverProviderSpecificFailoverInput"] = None, - **kwargs: Any - ) -> None: - """ - :keyword failover_direction: Failover direction. - :paramtype failover_direction: str - :keyword provider_specific_details: Provider specific settings. - :paramtype provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.PlannedFailoverProviderSpecificFailoverInput - """ - super().__init__(**kwargs) - self.failover_direction = failover_direction - self.provider_specific_details = provider_specific_details - - -class Policy(Resource): - """Protection profile details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :ivar type: Resource Type. - :vartype type: str - :ivar location: Resource Location. - :vartype location: str - :ivar properties: The custom data. - :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.PolicyProperties - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "properties": {"key": "properties", "type": "PolicyProperties"}, - } - - def __init__( - self, *, location: Optional[str] = None, properties: Optional["_models.PolicyProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword location: Resource Location. - :paramtype location: str - :keyword properties: The custom data. - :paramtype properties: ~azure.mgmt.recoveryservicessiterecovery.models.PolicyProperties - """ - super().__init__(location=location, **kwargs) - self.properties = properties - - -class PolicyCollection(_serialization.Model): - """Protection Profile Collection details. - - :ivar value: The policy details. - :vartype value: list[~azure.mgmt.recoveryservicessiterecovery.models.Policy] - :ivar next_link: The value of next link. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[Policy]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.Policy"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The policy details. - :paramtype value: list[~azure.mgmt.recoveryservicessiterecovery.models.Policy] - :keyword next_link: The value of next link. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class PolicyProperties(_serialization.Model): - """Protection profile custom data details. - - :ivar friendly_name: The FriendlyName. - :vartype friendly_name: str - :ivar provider_specific_details: The ReplicationChannelSetting. - :vartype provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.PolicyProviderSpecificDetails - """ - - _attribute_map = { - "friendly_name": {"key": "friendlyName", "type": "str"}, - "provider_specific_details": {"key": "providerSpecificDetails", "type": "PolicyProviderSpecificDetails"}, - } - - def __init__( - self, - *, - friendly_name: Optional[str] = None, - provider_specific_details: Optional["_models.PolicyProviderSpecificDetails"] = None, - **kwargs: Any - ) -> None: - """ - :keyword friendly_name: The FriendlyName. - :paramtype friendly_name: str - :keyword provider_specific_details: The ReplicationChannelSetting. - :paramtype provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.PolicyProviderSpecificDetails - """ - super().__init__(**kwargs) - self.friendly_name = friendly_name - self.provider_specific_details = provider_specific_details - - -class ProcessServer(_serialization.Model): - """Details of the Process Server. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar friendly_name: The Process Server's friendly name. - :vartype friendly_name: str - :ivar id: The Process Server Id. - :vartype id: str - :ivar ip_address: The IP address of the server. - :vartype ip_address: str - :ivar os_type: The OS type of the server. - :vartype os_type: str - :ivar agent_version: The version of the scout component on the server. - :vartype agent_version: str - :ivar last_heartbeat: The last heartbeat received from the server. - :vartype last_heartbeat: ~datetime.datetime - :ivar version_status: Version status. - :vartype version_status: str - :ivar mobility_service_updates: The list of the mobility service updates available on the - Process Server. - :vartype mobility_service_updates: - list[~azure.mgmt.recoveryservicessiterecovery.models.MobilityServiceUpdate] - :ivar host_id: The agent generated Id. - :vartype host_id: str - :ivar machine_count: The servers configured with this PS. - :vartype machine_count: str - :ivar replication_pair_count: The number of replication pairs configured in this PS. - :vartype replication_pair_count: str - :ivar system_load: The percentage of the system load. - :vartype system_load: str - :ivar system_load_status: The system load status. - :vartype system_load_status: str - :ivar cpu_load: The percentage of the CPU load. - :vartype cpu_load: str - :ivar cpu_load_status: The CPU load status. - :vartype cpu_load_status: str - :ivar total_memory_in_bytes: The total memory. - :vartype total_memory_in_bytes: int - :ivar available_memory_in_bytes: The available memory. - :vartype available_memory_in_bytes: int - :ivar memory_usage_status: The memory usage status. - :vartype memory_usage_status: str - :ivar total_space_in_bytes: The total space. - :vartype total_space_in_bytes: int - :ivar available_space_in_bytes: The available space. - :vartype available_space_in_bytes: int - :ivar space_usage_status: The space usage status. - :vartype space_usage_status: str - :ivar ps_service_status: The PS service status. - :vartype ps_service_status: str - :ivar ssl_cert_expiry_date: The PS SSL cert expiry date. - :vartype ssl_cert_expiry_date: ~datetime.datetime - :ivar ssl_cert_expiry_remaining_days: CS SSL cert expiry date. - :vartype ssl_cert_expiry_remaining_days: int - :ivar os_version: OS Version of the process server. Note: This will get populated if user has - CS version greater than 9.12.0.0. - :vartype os_version: str - :ivar health_errors: Health errors. - :vartype health_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] - :ivar agent_expiry_date: Agent expiry date. - :vartype agent_expiry_date: ~datetime.datetime - :ivar agent_version_details: The agent version details. - :vartype agent_version_details: ~azure.mgmt.recoveryservicessiterecovery.models.VersionDetails - :ivar health: The health of Process Server. Known values are: "None", "Normal", "Warning", and - "Critical". - :vartype health: str or ~azure.mgmt.recoveryservicessiterecovery.models.ProtectionHealth - :ivar ps_stats_refresh_time: The process server stats refresh time. - :vartype ps_stats_refresh_time: ~datetime.datetime - :ivar throughput_upload_pending_data_in_bytes: The uploading pending data in bytes. - :vartype throughput_upload_pending_data_in_bytes: int - :ivar throughput_in_m_bps: The throughput in MBps. - :vartype throughput_in_m_bps: int - :ivar throughput_in_bytes: The throughput in bytes. - :vartype throughput_in_bytes: int - :ivar throughput_status: The throughput status. - :vartype throughput_status: str - :ivar mars_communication_status: The MARS communication status. - :vartype mars_communication_status: str - :ivar mars_registration_status: The MARS registration status. - :vartype mars_registration_status: str - """ - - _validation = { - "health": {"readonly": True}, - "ps_stats_refresh_time": {"readonly": True}, - "throughput_upload_pending_data_in_bytes": {"readonly": True}, - "throughput_in_m_bps": {"readonly": True}, - "throughput_in_bytes": {"readonly": True}, - "throughput_status": {"readonly": True}, - "mars_communication_status": {"readonly": True}, - "mars_registration_status": {"readonly": True}, - } - - _attribute_map = { - "friendly_name": {"key": "friendlyName", "type": "str"}, - "id": {"key": "id", "type": "str"}, - "ip_address": {"key": "ipAddress", "type": "str"}, - "os_type": {"key": "osType", "type": "str"}, - "agent_version": {"key": "agentVersion", "type": "str"}, - "last_heartbeat": {"key": "lastHeartbeat", "type": "iso-8601"}, - "version_status": {"key": "versionStatus", "type": "str"}, - "mobility_service_updates": {"key": "mobilityServiceUpdates", "type": "[MobilityServiceUpdate]"}, - "host_id": {"key": "hostId", "type": "str"}, - "machine_count": {"key": "machineCount", "type": "str"}, - "replication_pair_count": {"key": "replicationPairCount", "type": "str"}, - "system_load": {"key": "systemLoad", "type": "str"}, - "system_load_status": {"key": "systemLoadStatus", "type": "str"}, - "cpu_load": {"key": "cpuLoad", "type": "str"}, - "cpu_load_status": {"key": "cpuLoadStatus", "type": "str"}, - "total_memory_in_bytes": {"key": "totalMemoryInBytes", "type": "int"}, - "available_memory_in_bytes": {"key": "availableMemoryInBytes", "type": "int"}, - "memory_usage_status": {"key": "memoryUsageStatus", "type": "str"}, - "total_space_in_bytes": {"key": "totalSpaceInBytes", "type": "int"}, - "available_space_in_bytes": {"key": "availableSpaceInBytes", "type": "int"}, - "space_usage_status": {"key": "spaceUsageStatus", "type": "str"}, - "ps_service_status": {"key": "psServiceStatus", "type": "str"}, - "ssl_cert_expiry_date": {"key": "sslCertExpiryDate", "type": "iso-8601"}, - "ssl_cert_expiry_remaining_days": {"key": "sslCertExpiryRemainingDays", "type": "int"}, - "os_version": {"key": "osVersion", "type": "str"}, - "health_errors": {"key": "healthErrors", "type": "[HealthError]"}, - "agent_expiry_date": {"key": "agentExpiryDate", "type": "iso-8601"}, - "agent_version_details": {"key": "agentVersionDetails", "type": "VersionDetails"}, - "health": {"key": "health", "type": "str"}, - "ps_stats_refresh_time": {"key": "psStatsRefreshTime", "type": "iso-8601"}, - "throughput_upload_pending_data_in_bytes": {"key": "throughputUploadPendingDataInBytes", "type": "int"}, - "throughput_in_m_bps": {"key": "throughputInMBps", "type": "int"}, - "throughput_in_bytes": {"key": "throughputInBytes", "type": "int"}, - "throughput_status": {"key": "throughputStatus", "type": "str"}, - "mars_communication_status": {"key": "marsCommunicationStatus", "type": "str"}, - "mars_registration_status": {"key": "marsRegistrationStatus", "type": "str"}, - } - - def __init__( # pylint: disable=too-many-locals - self, - *, - friendly_name: Optional[str] = None, - id: Optional[str] = None, # pylint: disable=redefined-builtin - ip_address: Optional[str] = None, - os_type: Optional[str] = None, - agent_version: Optional[str] = None, - last_heartbeat: Optional[datetime.datetime] = None, - version_status: Optional[str] = None, - mobility_service_updates: Optional[List["_models.MobilityServiceUpdate"]] = None, - host_id: Optional[str] = None, - machine_count: Optional[str] = None, - replication_pair_count: Optional[str] = None, - system_load: Optional[str] = None, - system_load_status: Optional[str] = None, - cpu_load: Optional[str] = None, - cpu_load_status: Optional[str] = None, - total_memory_in_bytes: Optional[int] = None, - available_memory_in_bytes: Optional[int] = None, - memory_usage_status: Optional[str] = None, - total_space_in_bytes: Optional[int] = None, - available_space_in_bytes: Optional[int] = None, - space_usage_status: Optional[str] = None, - ps_service_status: Optional[str] = None, - ssl_cert_expiry_date: Optional[datetime.datetime] = None, - ssl_cert_expiry_remaining_days: Optional[int] = None, - os_version: Optional[str] = None, - health_errors: Optional[List["_models.HealthError"]] = None, - agent_expiry_date: Optional[datetime.datetime] = None, - agent_version_details: Optional["_models.VersionDetails"] = None, - **kwargs: Any - ) -> None: - """ - :keyword friendly_name: The Process Server's friendly name. - :paramtype friendly_name: str - :keyword id: The Process Server Id. - :paramtype id: str - :keyword ip_address: The IP address of the server. - :paramtype ip_address: str - :keyword os_type: The OS type of the server. - :paramtype os_type: str - :keyword agent_version: The version of the scout component on the server. - :paramtype agent_version: str - :keyword last_heartbeat: The last heartbeat received from the server. - :paramtype last_heartbeat: ~datetime.datetime - :keyword version_status: Version status. - :paramtype version_status: str - :keyword mobility_service_updates: The list of the mobility service updates available on the - Process Server. - :paramtype mobility_service_updates: - list[~azure.mgmt.recoveryservicessiterecovery.models.MobilityServiceUpdate] - :keyword host_id: The agent generated Id. - :paramtype host_id: str - :keyword machine_count: The servers configured with this PS. - :paramtype machine_count: str - :keyword replication_pair_count: The number of replication pairs configured in this PS. - :paramtype replication_pair_count: str - :keyword system_load: The percentage of the system load. - :paramtype system_load: str - :keyword system_load_status: The system load status. - :paramtype system_load_status: str - :keyword cpu_load: The percentage of the CPU load. - :paramtype cpu_load: str - :keyword cpu_load_status: The CPU load status. - :paramtype cpu_load_status: str - :keyword total_memory_in_bytes: The total memory. - :paramtype total_memory_in_bytes: int - :keyword available_memory_in_bytes: The available memory. - :paramtype available_memory_in_bytes: int - :keyword memory_usage_status: The memory usage status. - :paramtype memory_usage_status: str - :keyword total_space_in_bytes: The total space. - :paramtype total_space_in_bytes: int - :keyword available_space_in_bytes: The available space. - :paramtype available_space_in_bytes: int - :keyword space_usage_status: The space usage status. - :paramtype space_usage_status: str - :keyword ps_service_status: The PS service status. - :paramtype ps_service_status: str - :keyword ssl_cert_expiry_date: The PS SSL cert expiry date. - :paramtype ssl_cert_expiry_date: ~datetime.datetime - :keyword ssl_cert_expiry_remaining_days: CS SSL cert expiry date. - :paramtype ssl_cert_expiry_remaining_days: int - :keyword os_version: OS Version of the process server. Note: This will get populated if user - has CS version greater than 9.12.0.0. - :paramtype os_version: str - :keyword health_errors: Health errors. - :paramtype health_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] - :keyword agent_expiry_date: Agent expiry date. - :paramtype agent_expiry_date: ~datetime.datetime - :keyword agent_version_details: The agent version details. - :paramtype agent_version_details: - ~azure.mgmt.recoveryservicessiterecovery.models.VersionDetails - """ - super().__init__(**kwargs) - self.friendly_name = friendly_name - self.id = id - self.ip_address = ip_address - self.os_type = os_type - self.agent_version = agent_version - self.last_heartbeat = last_heartbeat - self.version_status = version_status - self.mobility_service_updates = mobility_service_updates - self.host_id = host_id - self.machine_count = machine_count - self.replication_pair_count = replication_pair_count - self.system_load = system_load - self.system_load_status = system_load_status - self.cpu_load = cpu_load - self.cpu_load_status = cpu_load_status - self.total_memory_in_bytes = total_memory_in_bytes - self.available_memory_in_bytes = available_memory_in_bytes - self.memory_usage_status = memory_usage_status - self.total_space_in_bytes = total_space_in_bytes - self.available_space_in_bytes = available_space_in_bytes - self.space_usage_status = space_usage_status - self.ps_service_status = ps_service_status - self.ssl_cert_expiry_date = ssl_cert_expiry_date - self.ssl_cert_expiry_remaining_days = ssl_cert_expiry_remaining_days - self.os_version = os_version - self.health_errors = health_errors - self.agent_expiry_date = agent_expiry_date - self.agent_version_details = agent_version_details - self.health: Optional[Union[str, "_models.ProtectionHealth"]] = None - self.ps_stats_refresh_time: Optional[datetime.datetime] = None - self.throughput_upload_pending_data_in_bytes: Optional[int] = None - self.throughput_in_m_bps: Optional[int] = None - self.throughput_in_bytes: Optional[int] = None - self.throughput_status: Optional[str] = None - self.mars_communication_status: Optional[str] = None - self.mars_registration_status: Optional[str] = None - - -class ProcessServerDetails(_serialization.Model): - """Process server details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The process server Id. - :vartype id: str - :ivar name: The process server name. - :vartype name: str - :ivar bios_id: The process server Bios Id. - :vartype bios_id: str - :ivar fabric_object_id: The fabric object Id. - :vartype fabric_object_id: str - :ivar fqdn: The process server Fqdn. - :vartype fqdn: str - :ivar ip_addresses: The list of IP addresses for communicating with the RCM component. - :vartype ip_addresses: list[str] - :ivar version: The version. - :vartype version: str - :ivar last_heartbeat_utc: The last heartbeat received from the process server. - :vartype last_heartbeat_utc: ~datetime.datetime - :ivar total_memory_in_bytes: The total memory. - :vartype total_memory_in_bytes: int - :ivar available_memory_in_bytes: The available memory. - :vartype available_memory_in_bytes: int - :ivar used_memory_in_bytes: The used memory. - :vartype used_memory_in_bytes: int - :ivar memory_usage_percentage: The memory usage percentage. - :vartype memory_usage_percentage: float - :ivar total_space_in_bytes: The total disk space. - :vartype total_space_in_bytes: int - :ivar available_space_in_bytes: The available disk space. - :vartype available_space_in_bytes: int - :ivar used_space_in_bytes: The used disk space. - :vartype used_space_in_bytes: int - :ivar free_space_percentage: The free disk space percentage. - :vartype free_space_percentage: float - :ivar throughput_upload_pending_data_in_bytes: The uploading pending data in bytes. - :vartype throughput_upload_pending_data_in_bytes: int - :ivar throughput_in_bytes: The throughput in bytes. - :vartype throughput_in_bytes: int - :ivar processor_usage_percentage: The processor usage percentage. - :vartype processor_usage_percentage: float - :ivar throughput_status: The throughput status. Known values are: "Healthy", "Warning", - "Critical", and "Unknown". - :vartype throughput_status: str or - ~azure.mgmt.recoveryservicessiterecovery.models.RcmComponentStatus - :ivar system_load: The system load. - :vartype system_load: int - :ivar system_load_status: The system load status. Known values are: "Healthy", "Warning", - "Critical", and "Unknown". - :vartype system_load_status: str or - ~azure.mgmt.recoveryservicessiterecovery.models.RcmComponentStatus - :ivar disk_usage_status: The disk usage status. Known values are: "Healthy", "Warning", - "Critical", and "Unknown". - :vartype disk_usage_status: str or - ~azure.mgmt.recoveryservicessiterecovery.models.RcmComponentStatus - :ivar memory_usage_status: The memory usage status. Known values are: "Healthy", "Warning", - "Critical", and "Unknown". - :vartype memory_usage_status: str or - ~azure.mgmt.recoveryservicessiterecovery.models.RcmComponentStatus - :ivar processor_usage_status: The processor usage status. Known values are: "Healthy", - "Warning", "Critical", and "Unknown". - :vartype processor_usage_status: str or - ~azure.mgmt.recoveryservicessiterecovery.models.RcmComponentStatus - :ivar health: The health of the process server. Known values are: "None", "Normal", "Warning", - and "Critical". - :vartype health: str or ~azure.mgmt.recoveryservicessiterecovery.models.ProtectionHealth - :ivar health_errors: The health errors. - :vartype health_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] - :ivar protected_item_count: The protected item count. - :vartype protected_item_count: int - :ivar historic_health: The historic health of the process server based on the health in last 24 - hours. Known values are: "None", "Normal", "Warning", and "Critical". - :vartype historic_health: str or - ~azure.mgmt.recoveryservicessiterecovery.models.ProtectionHealth - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "bios_id": {"readonly": True}, - "fabric_object_id": {"readonly": True}, - "fqdn": {"readonly": True}, - "ip_addresses": {"readonly": True}, - "version": {"readonly": True}, - "last_heartbeat_utc": {"readonly": True}, - "total_memory_in_bytes": {"readonly": True}, - "available_memory_in_bytes": {"readonly": True}, - "used_memory_in_bytes": {"readonly": True}, - "memory_usage_percentage": {"readonly": True}, - "total_space_in_bytes": {"readonly": True}, - "available_space_in_bytes": {"readonly": True}, - "used_space_in_bytes": {"readonly": True}, - "free_space_percentage": {"readonly": True}, - "throughput_upload_pending_data_in_bytes": {"readonly": True}, - "throughput_in_bytes": {"readonly": True}, - "processor_usage_percentage": {"readonly": True}, - "throughput_status": {"readonly": True}, - "system_load": {"readonly": True}, - "system_load_status": {"readonly": True}, - "disk_usage_status": {"readonly": True}, - "memory_usage_status": {"readonly": True}, - "processor_usage_status": {"readonly": True}, - "health": {"readonly": True}, - "health_errors": {"readonly": True}, - "protected_item_count": {"readonly": True}, - "historic_health": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "bios_id": {"key": "biosId", "type": "str"}, - "fabric_object_id": {"key": "fabricObjectId", "type": "str"}, - "fqdn": {"key": "fqdn", "type": "str"}, - "ip_addresses": {"key": "ipAddresses", "type": "[str]"}, - "version": {"key": "version", "type": "str"}, - "last_heartbeat_utc": {"key": "lastHeartbeatUtc", "type": "iso-8601"}, - "total_memory_in_bytes": {"key": "totalMemoryInBytes", "type": "int"}, - "available_memory_in_bytes": {"key": "availableMemoryInBytes", "type": "int"}, - "used_memory_in_bytes": {"key": "usedMemoryInBytes", "type": "int"}, - "memory_usage_percentage": {"key": "memoryUsagePercentage", "type": "float"}, - "total_space_in_bytes": {"key": "totalSpaceInBytes", "type": "int"}, - "available_space_in_bytes": {"key": "availableSpaceInBytes", "type": "int"}, - "used_space_in_bytes": {"key": "usedSpaceInBytes", "type": "int"}, - "free_space_percentage": {"key": "freeSpacePercentage", "type": "float"}, - "throughput_upload_pending_data_in_bytes": {"key": "throughputUploadPendingDataInBytes", "type": "int"}, - "throughput_in_bytes": {"key": "throughputInBytes", "type": "int"}, - "processor_usage_percentage": {"key": "processorUsagePercentage", "type": "float"}, - "throughput_status": {"key": "throughputStatus", "type": "str"}, - "system_load": {"key": "systemLoad", "type": "int"}, - "system_load_status": {"key": "systemLoadStatus", "type": "str"}, - "disk_usage_status": {"key": "diskUsageStatus", "type": "str"}, - "memory_usage_status": {"key": "memoryUsageStatus", "type": "str"}, - "processor_usage_status": {"key": "processorUsageStatus", "type": "str"}, - "health": {"key": "health", "type": "str"}, - "health_errors": {"key": "healthErrors", "type": "[HealthError]"}, - "protected_item_count": {"key": "protectedItemCount", "type": "int"}, - "historic_health": {"key": "historicHealth", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: # pylint: disable=too-many-locals - """ """ - super().__init__(**kwargs) - self.id: Optional[str] = None - self.name: Optional[str] = None - self.bios_id: Optional[str] = None - self.fabric_object_id: Optional[str] = None - self.fqdn: Optional[str] = None - self.ip_addresses: Optional[List[str]] = None - self.version: Optional[str] = None - self.last_heartbeat_utc: Optional[datetime.datetime] = None - self.total_memory_in_bytes: Optional[int] = None - self.available_memory_in_bytes: Optional[int] = None - self.used_memory_in_bytes: Optional[int] = None - self.memory_usage_percentage: Optional[float] = None - self.total_space_in_bytes: Optional[int] = None - self.available_space_in_bytes: Optional[int] = None - self.used_space_in_bytes: Optional[int] = None - self.free_space_percentage: Optional[float] = None - self.throughput_upload_pending_data_in_bytes: Optional[int] = None - self.throughput_in_bytes: Optional[int] = None - self.processor_usage_percentage: Optional[float] = None - self.throughput_status: Optional[Union[str, "_models.RcmComponentStatus"]] = None - self.system_load: Optional[int] = None - self.system_load_status: Optional[Union[str, "_models.RcmComponentStatus"]] = None - self.disk_usage_status: Optional[Union[str, "_models.RcmComponentStatus"]] = None - self.memory_usage_status: Optional[Union[str, "_models.RcmComponentStatus"]] = None - self.processor_usage_status: Optional[Union[str, "_models.RcmComponentStatus"]] = None - self.health: Optional[Union[str, "_models.ProtectionHealth"]] = None - self.health_errors: Optional[List["_models.HealthError"]] = None - self.protected_item_count: Optional[int] = None - self.historic_health: Optional[Union[str, "_models.ProtectionHealth"]] = None - - -class ProtectableItem(Resource): - """Replication protected item. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :ivar type: Resource Type. - :vartype type: str - :ivar location: Resource Location. - :vartype location: str - :ivar properties: The custom data. - :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.ProtectableItemProperties - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "properties": {"key": "properties", "type": "ProtectableItemProperties"}, - } - - def __init__( - self, - *, - location: Optional[str] = None, - properties: Optional["_models.ProtectableItemProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword location: Resource Location. - :paramtype location: str - :keyword properties: The custom data. - :paramtype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.ProtectableItemProperties - """ - super().__init__(location=location, **kwargs) - self.properties = properties - - -class ProtectableItemCollection(_serialization.Model): - """Protectable item collection. - - :ivar value: The Protectable item details. - :vartype value: list[~azure.mgmt.recoveryservicessiterecovery.models.ProtectableItem] - :ivar next_link: The value of next link. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[ProtectableItem]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.ProtectableItem"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The Protectable item details. - :paramtype value: list[~azure.mgmt.recoveryservicessiterecovery.models.ProtectableItem] - :keyword next_link: The value of next link. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ProtectableItemProperties(_serialization.Model): - """Replication protected item custom data details. - - :ivar friendly_name: The name. - :vartype friendly_name: str - :ivar protection_status: The protection status. - :vartype protection_status: str - :ivar replication_protected_item_id: The ARM resource of protected items. - :vartype replication_protected_item_id: str - :ivar recovery_services_provider_id: The recovery provider ARM Id. - :vartype recovery_services_provider_id: str - :ivar protection_readiness_errors: The Current protection readiness errors. - :vartype protection_readiness_errors: list[str] - :ivar supported_replication_providers: The list of replication providers supported for the - protectable item. - :vartype supported_replication_providers: list[str] - :ivar custom_details: The Replication provider custom settings. - :vartype custom_details: ~azure.mgmt.recoveryservicessiterecovery.models.ConfigurationSettings - """ - - _attribute_map = { - "friendly_name": {"key": "friendlyName", "type": "str"}, - "protection_status": {"key": "protectionStatus", "type": "str"}, - "replication_protected_item_id": {"key": "replicationProtectedItemId", "type": "str"}, - "recovery_services_provider_id": {"key": "recoveryServicesProviderId", "type": "str"}, - "protection_readiness_errors": {"key": "protectionReadinessErrors", "type": "[str]"}, - "supported_replication_providers": {"key": "supportedReplicationProviders", "type": "[str]"}, - "custom_details": {"key": "customDetails", "type": "ConfigurationSettings"}, - } - - def __init__( - self, - *, - friendly_name: Optional[str] = None, - protection_status: Optional[str] = None, - replication_protected_item_id: Optional[str] = None, - recovery_services_provider_id: Optional[str] = None, - protection_readiness_errors: Optional[List[str]] = None, - supported_replication_providers: Optional[List[str]] = None, - custom_details: Optional["_models.ConfigurationSettings"] = None, - **kwargs: Any - ) -> None: - """ - :keyword friendly_name: The name. - :paramtype friendly_name: str - :keyword protection_status: The protection status. - :paramtype protection_status: str - :keyword replication_protected_item_id: The ARM resource of protected items. - :paramtype replication_protected_item_id: str - :keyword recovery_services_provider_id: The recovery provider ARM Id. - :paramtype recovery_services_provider_id: str - :keyword protection_readiness_errors: The Current protection readiness errors. - :paramtype protection_readiness_errors: list[str] - :keyword supported_replication_providers: The list of replication providers supported for the - protectable item. - :paramtype supported_replication_providers: list[str] - :keyword custom_details: The Replication provider custom settings. - :paramtype custom_details: - ~azure.mgmt.recoveryservicessiterecovery.models.ConfigurationSettings - """ - super().__init__(**kwargs) - self.friendly_name = friendly_name - self.protection_status = protection_status - self.replication_protected_item_id = replication_protected_item_id - self.recovery_services_provider_id = recovery_services_provider_id - self.protection_readiness_errors = protection_readiness_errors - self.supported_replication_providers = supported_replication_providers - self.custom_details = custom_details - - -class ProtectableItemQueryParameter(_serialization.Model): - """Query parameter to enumerate Protectable items. - - :ivar state: State of the Protectable item query filter. - :vartype state: str - """ - - _attribute_map = { - "state": {"key": "state", "type": "str"}, - } - - def __init__(self, *, state: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword state: State of the Protectable item query filter. - :paramtype state: str - """ - super().__init__(**kwargs) - self.state = state - - -class ProtectedClustersQueryParameter(_serialization.Model): - """Query parameter to enumerate protected clusters. - - :ivar source_fabric_name: The source fabric name filter. - :vartype source_fabric_name: str - :ivar source_fabric_location: The source fabric location filter. - :vartype source_fabric_location: str - :ivar instance_type: The replication provider type. - :vartype instance_type: str - """ - - _attribute_map = { - "source_fabric_name": {"key": "sourceFabricName", "type": "str"}, - "source_fabric_location": {"key": "sourceFabricLocation", "type": "str"}, - "instance_type": {"key": "instanceType", "type": "str"}, - } - - def __init__( - self, - *, - source_fabric_name: Optional[str] = None, - source_fabric_location: Optional[str] = None, - instance_type: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword source_fabric_name: The source fabric name filter. - :paramtype source_fabric_name: str - :keyword source_fabric_location: The source fabric location filter. - :paramtype source_fabric_location: str - :keyword instance_type: The replication provider type. - :paramtype instance_type: str - """ - super().__init__(**kwargs) - self.source_fabric_name = source_fabric_name - self.source_fabric_location = source_fabric_location - self.instance_type = instance_type - - -class ProtectedItemsQueryParameter(_serialization.Model): - """Query parameter to enumerate protected items. - - :ivar source_fabric_name: The source fabric name filter. - :vartype source_fabric_name: str - :ivar recovery_plan_name: The recovery plan filter. - :vartype recovery_plan_name: str - :ivar source_fabric_location: The source fabric location filter. - :vartype source_fabric_location: str - :ivar fabric_object_id: The fabric object Id filter. - :vartype fabric_object_id: str - :ivar v_center_name: The vCenter name filter. - :vartype v_center_name: str - :ivar instance_type: The replication provider type. - :vartype instance_type: str - :ivar multi_vm_group_create_option: Whether Multi VM group is auto created or specified by - user. Known values are: "AutoCreated" and "UserSpecified". - :vartype multi_vm_group_create_option: str or - ~azure.mgmt.recoveryservicessiterecovery.models.MultiVmGroupCreateOption - :ivar process_server_id: The process server Id filter. - :vartype process_server_id: str - """ - - _attribute_map = { - "source_fabric_name": {"key": "sourceFabricName", "type": "str"}, - "recovery_plan_name": {"key": "recoveryPlanName", "type": "str"}, - "source_fabric_location": {"key": "sourceFabricLocation", "type": "str"}, - "fabric_object_id": {"key": "fabricObjectId", "type": "str"}, - "v_center_name": {"key": "vCenterName", "type": "str"}, - "instance_type": {"key": "instanceType", "type": "str"}, - "multi_vm_group_create_option": {"key": "multiVmGroupCreateOption", "type": "str"}, - "process_server_id": {"key": "processServerId", "type": "str"}, - } - - def __init__( - self, - *, - source_fabric_name: Optional[str] = None, - recovery_plan_name: Optional[str] = None, - source_fabric_location: Optional[str] = None, - fabric_object_id: Optional[str] = None, - v_center_name: Optional[str] = None, - instance_type: Optional[str] = None, - multi_vm_group_create_option: Optional[Union[str, "_models.MultiVmGroupCreateOption"]] = None, - process_server_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword source_fabric_name: The source fabric name filter. - :paramtype source_fabric_name: str - :keyword recovery_plan_name: The recovery plan filter. - :paramtype recovery_plan_name: str - :keyword source_fabric_location: The source fabric location filter. - :paramtype source_fabric_location: str - :keyword fabric_object_id: The fabric object Id filter. - :paramtype fabric_object_id: str - :keyword v_center_name: The vCenter name filter. - :paramtype v_center_name: str - :keyword instance_type: The replication provider type. - :paramtype instance_type: str - :keyword multi_vm_group_create_option: Whether Multi VM group is auto created or specified by - user. Known values are: "AutoCreated" and "UserSpecified". - :paramtype multi_vm_group_create_option: str or - ~azure.mgmt.recoveryservicessiterecovery.models.MultiVmGroupCreateOption - :keyword process_server_id: The process server Id filter. - :paramtype process_server_id: str - """ - super().__init__(**kwargs) - self.source_fabric_name = source_fabric_name - self.recovery_plan_name = recovery_plan_name - self.source_fabric_location = source_fabric_location - self.fabric_object_id = fabric_object_id - self.v_center_name = v_center_name - self.instance_type = instance_type - self.multi_vm_group_create_option = multi_vm_group_create_option - self.process_server_id = process_server_id - - -class ProtectionContainer(Resource): - """Protection container details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :ivar type: Resource Type. - :vartype type: str - :ivar location: Resource Location. - :vartype location: str - :ivar properties: The custom data. - :vartype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerProperties - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "properties": {"key": "properties", "type": "ProtectionContainerProperties"}, - } - - def __init__( - self, - *, - location: Optional[str] = None, - properties: Optional["_models.ProtectionContainerProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword location: Resource Location. - :paramtype location: str - :keyword properties: The custom data. - :paramtype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerProperties - """ - super().__init__(location=location, **kwargs) - self.properties = properties - - -class ProtectionContainerCollection(_serialization.Model): - """Protection Container collection. - - :ivar value: The Protection Container details. - :vartype value: list[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] - :ivar next_link: The value of next link. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[ProtectionContainer]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.ProtectionContainer"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The Protection Container details. - :paramtype value: list[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] - :keyword next_link: The value of next link. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ProtectionContainerFabricSpecificDetails(_serialization.Model): - """Base class for fabric specific details of container. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar instance_type: Gets the class type. Overridden in derived classes. - :vartype instance_type: str - """ - - _validation = { - "instance_type": {"readonly": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.instance_type: Optional[str] = None - - -class ProtectionContainerMapping(Resource): - """Protection container mapping object. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :ivar type: Resource Type. - :vartype type: str - :ivar location: Resource Location. - :vartype location: str - :ivar properties: The custom data. - :vartype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerMappingProperties - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "properties": {"key": "properties", "type": "ProtectionContainerMappingProperties"}, - } - - def __init__( - self, - *, - location: Optional[str] = None, - properties: Optional["_models.ProtectionContainerMappingProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword location: Resource Location. - :paramtype location: str - :keyword properties: The custom data. - :paramtype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerMappingProperties - """ - super().__init__(location=location, **kwargs) - self.properties = properties - - -class ProtectionContainerMappingCollection(_serialization.Model): - """Protection container mapping collection class. - - :ivar value: List of container mappings. - :vartype value: - list[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerMapping] - :ivar next_link: Link to fetch rest of the data. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[ProtectionContainerMapping]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.ProtectionContainerMapping"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: List of container mappings. - :paramtype value: - list[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerMapping] - :keyword next_link: Link to fetch rest of the data. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ProtectionContainerMappingProperties(_serialization.Model): - """Protection container mapping properties. - - :ivar target_protection_container_id: Paired protection container ARM ID. - :vartype target_protection_container_id: str - :ivar target_protection_container_friendly_name: Friendly name of paired container. - :vartype target_protection_container_friendly_name: str - :ivar provider_specific_details: Provider specific provider details. - :vartype provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerMappingProviderSpecificDetails - :ivar health: Health of pairing. - :vartype health: str - :ivar health_error_details: Health error. - :vartype health_error_details: - list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] - :ivar policy_id: Policy ARM Id. - :vartype policy_id: str - :ivar state: Association Status. - :vartype state: str - :ivar source_protection_container_friendly_name: Friendly name of source protection container. - :vartype source_protection_container_friendly_name: str - :ivar source_fabric_friendly_name: Friendly name of source fabric. - :vartype source_fabric_friendly_name: str - :ivar target_fabric_friendly_name: Friendly name of target fabric. - :vartype target_fabric_friendly_name: str - :ivar policy_friendly_name: Friendly name of replication policy. - :vartype policy_friendly_name: str - """ - - _attribute_map = { - "target_protection_container_id": {"key": "targetProtectionContainerId", "type": "str"}, - "target_protection_container_friendly_name": {"key": "targetProtectionContainerFriendlyName", "type": "str"}, - "provider_specific_details": { - "key": "providerSpecificDetails", - "type": "ProtectionContainerMappingProviderSpecificDetails", - }, - "health": {"key": "health", "type": "str"}, - "health_error_details": {"key": "healthErrorDetails", "type": "[HealthError]"}, - "policy_id": {"key": "policyId", "type": "str"}, - "state": {"key": "state", "type": "str"}, - "source_protection_container_friendly_name": {"key": "sourceProtectionContainerFriendlyName", "type": "str"}, - "source_fabric_friendly_name": {"key": "sourceFabricFriendlyName", "type": "str"}, - "target_fabric_friendly_name": {"key": "targetFabricFriendlyName", "type": "str"}, - "policy_friendly_name": {"key": "policyFriendlyName", "type": "str"}, - } - - def __init__( - self, - *, - target_protection_container_id: Optional[str] = None, - target_protection_container_friendly_name: Optional[str] = None, - provider_specific_details: Optional["_models.ProtectionContainerMappingProviderSpecificDetails"] = None, - health: Optional[str] = None, - health_error_details: Optional[List["_models.HealthError"]] = None, - policy_id: Optional[str] = None, - state: Optional[str] = None, - source_protection_container_friendly_name: Optional[str] = None, - source_fabric_friendly_name: Optional[str] = None, - target_fabric_friendly_name: Optional[str] = None, - policy_friendly_name: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword target_protection_container_id: Paired protection container ARM ID. - :paramtype target_protection_container_id: str - :keyword target_protection_container_friendly_name: Friendly name of paired container. - :paramtype target_protection_container_friendly_name: str - :keyword provider_specific_details: Provider specific provider details. - :paramtype provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerMappingProviderSpecificDetails - :keyword health: Health of pairing. - :paramtype health: str - :keyword health_error_details: Health error. - :paramtype health_error_details: - list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] - :keyword policy_id: Policy ARM Id. - :paramtype policy_id: str - :keyword state: Association Status. - :paramtype state: str - :keyword source_protection_container_friendly_name: Friendly name of source protection - container. - :paramtype source_protection_container_friendly_name: str - :keyword source_fabric_friendly_name: Friendly name of source fabric. - :paramtype source_fabric_friendly_name: str - :keyword target_fabric_friendly_name: Friendly name of target fabric. - :paramtype target_fabric_friendly_name: str - :keyword policy_friendly_name: Friendly name of replication policy. - :paramtype policy_friendly_name: str - """ - super().__init__(**kwargs) - self.target_protection_container_id = target_protection_container_id - self.target_protection_container_friendly_name = target_protection_container_friendly_name - self.provider_specific_details = provider_specific_details - self.health = health - self.health_error_details = health_error_details - self.policy_id = policy_id - self.state = state - self.source_protection_container_friendly_name = source_protection_container_friendly_name - self.source_fabric_friendly_name = source_fabric_friendly_name - self.target_fabric_friendly_name = target_fabric_friendly_name - self.policy_friendly_name = policy_friendly_name - - -class ProtectionContainerProperties(_serialization.Model): - """Protection profile custom data details. - - :ivar fabric_friendly_name: Fabric friendly name. - :vartype fabric_friendly_name: str - :ivar friendly_name: The name. - :vartype friendly_name: str - :ivar fabric_type: The fabric type. - :vartype fabric_type: str - :ivar protected_item_count: Number of protected PEs. - :vartype protected_item_count: int - :ivar pairing_status: The pairing status of this cloud. - :vartype pairing_status: str - :ivar role: The role of this cloud. - :vartype role: str - :ivar fabric_specific_details: Fabric specific details. - :vartype fabric_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerFabricSpecificDetails - """ - - _attribute_map = { - "fabric_friendly_name": {"key": "fabricFriendlyName", "type": "str"}, - "friendly_name": {"key": "friendlyName", "type": "str"}, - "fabric_type": {"key": "fabricType", "type": "str"}, - "protected_item_count": {"key": "protectedItemCount", "type": "int"}, - "pairing_status": {"key": "pairingStatus", "type": "str"}, - "role": {"key": "role", "type": "str"}, - "fabric_specific_details": {"key": "fabricSpecificDetails", "type": "ProtectionContainerFabricSpecificDetails"}, - } - - def __init__( - self, - *, - fabric_friendly_name: Optional[str] = None, - friendly_name: Optional[str] = None, - fabric_type: Optional[str] = None, - protected_item_count: Optional[int] = None, - pairing_status: Optional[str] = None, - role: Optional[str] = None, - fabric_specific_details: Optional["_models.ProtectionContainerFabricSpecificDetails"] = None, - **kwargs: Any - ) -> None: - """ - :keyword fabric_friendly_name: Fabric friendly name. - :paramtype fabric_friendly_name: str - :keyword friendly_name: The name. - :paramtype friendly_name: str - :keyword fabric_type: The fabric type. - :paramtype fabric_type: str - :keyword protected_item_count: Number of protected PEs. - :paramtype protected_item_count: int - :keyword pairing_status: The pairing status of this cloud. - :paramtype pairing_status: str - :keyword role: The role of this cloud. - :paramtype role: str - :keyword fabric_specific_details: Fabric specific details. - :paramtype fabric_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerFabricSpecificDetails - """ - super().__init__(**kwargs) - self.fabric_friendly_name = fabric_friendly_name - self.friendly_name = friendly_name - self.fabric_type = fabric_type - self.protected_item_count = protected_item_count - self.pairing_status = pairing_status - self.role = role - self.fabric_specific_details = fabric_specific_details - - -class ProviderError(_serialization.Model): - """This class contains the error details per object. - - :ivar error_code: The Error code. - :vartype error_code: int - :ivar error_message: The Error message. - :vartype error_message: str - :ivar error_id: The Provider error Id. - :vartype error_id: str - :ivar possible_causes: The possible causes for the error. - :vartype possible_causes: str - :ivar recommended_action: The recommended action to resolve the error. - :vartype recommended_action: str - """ - - _attribute_map = { - "error_code": {"key": "errorCode", "type": "int"}, - "error_message": {"key": "errorMessage", "type": "str"}, - "error_id": {"key": "errorId", "type": "str"}, - "possible_causes": {"key": "possibleCauses", "type": "str"}, - "recommended_action": {"key": "recommendedAction", "type": "str"}, - } - - def __init__( - self, - *, - error_code: Optional[int] = None, - error_message: Optional[str] = None, - error_id: Optional[str] = None, - possible_causes: Optional[str] = None, - recommended_action: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword error_code: The Error code. - :paramtype error_code: int - :keyword error_message: The Error message. - :paramtype error_message: str - :keyword error_id: The Provider error Id. - :paramtype error_id: str - :keyword possible_causes: The possible causes for the error. - :paramtype possible_causes: str - :keyword recommended_action: The recommended action to resolve the error. - :paramtype recommended_action: str - """ - super().__init__(**kwargs) - self.error_code = error_code - self.error_message = error_message - self.error_id = error_id - self.possible_causes = possible_causes - self.recommended_action = recommended_action - - -class PushInstallerDetails(_serialization.Model): - """Push installer details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The push installer Id. - :vartype id: str - :ivar name: The push installer name. - :vartype name: str - :ivar bios_id: The push installer Bios Id. - :vartype bios_id: str - :ivar fabric_object_id: The fabric object Id. - :vartype fabric_object_id: str - :ivar fqdn: The push installer Fqdn. - :vartype fqdn: str - :ivar version: The version. - :vartype version: str - :ivar last_heartbeat_utc: The last heartbeat received from the push installer. - :vartype last_heartbeat_utc: ~datetime.datetime - :ivar health: The health of the push installer. Known values are: "None", "Normal", "Warning", - and "Critical". - :vartype health: str or ~azure.mgmt.recoveryservicessiterecovery.models.ProtectionHealth - :ivar health_errors: The health errors. - :vartype health_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "bios_id": {"readonly": True}, - "fabric_object_id": {"readonly": True}, - "fqdn": {"readonly": True}, - "version": {"readonly": True}, - "last_heartbeat_utc": {"readonly": True}, - "health": {"readonly": True}, - "health_errors": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "bios_id": {"key": "biosId", "type": "str"}, - "fabric_object_id": {"key": "fabricObjectId", "type": "str"}, - "fqdn": {"key": "fqdn", "type": "str"}, - "version": {"key": "version", "type": "str"}, - "last_heartbeat_utc": {"key": "lastHeartbeatUtc", "type": "iso-8601"}, - "health": {"key": "health", "type": "str"}, - "health_errors": {"key": "healthErrors", "type": "[HealthError]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.id: Optional[str] = None - self.name: Optional[str] = None - self.bios_id: Optional[str] = None - self.fabric_object_id: Optional[str] = None - self.fqdn: Optional[str] = None - self.version: Optional[str] = None - self.last_heartbeat_utc: Optional[datetime.datetime] = None - self.health: Optional[Union[str, "_models.ProtectionHealth"]] = None - self.health_errors: Optional[List["_models.HealthError"]] = None - - -class RcmProxyDetails(_serialization.Model): - """RCM proxy details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The RCM proxy Id. - :vartype id: str - :ivar name: The RCM proxy name. - :vartype name: str - :ivar bios_id: The RCM proxy Bios Id. - :vartype bios_id: str - :ivar fabric_object_id: The fabric object Id. - :vartype fabric_object_id: str - :ivar fqdn: The RCM proxy Fqdn. - :vartype fqdn: str - :ivar client_authentication_type: The client authentication type. - :vartype client_authentication_type: str - :ivar version: The version. - :vartype version: str - :ivar last_heartbeat_utc: The last heartbeat received from the RCM proxy. - :vartype last_heartbeat_utc: ~datetime.datetime - :ivar health: The health of the RCM proxy. Known values are: "None", "Normal", "Warning", and - "Critical". - :vartype health: str or ~azure.mgmt.recoveryservicessiterecovery.models.ProtectionHealth - :ivar health_errors: The health errors. - :vartype health_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "bios_id": {"readonly": True}, - "fabric_object_id": {"readonly": True}, - "fqdn": {"readonly": True}, - "client_authentication_type": {"readonly": True}, - "version": {"readonly": True}, - "last_heartbeat_utc": {"readonly": True}, - "health": {"readonly": True}, - "health_errors": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "bios_id": {"key": "biosId", "type": "str"}, - "fabric_object_id": {"key": "fabricObjectId", "type": "str"}, - "fqdn": {"key": "fqdn", "type": "str"}, - "client_authentication_type": {"key": "clientAuthenticationType", "type": "str"}, - "version": {"key": "version", "type": "str"}, - "last_heartbeat_utc": {"key": "lastHeartbeatUtc", "type": "iso-8601"}, - "health": {"key": "health", "type": "str"}, - "health_errors": {"key": "healthErrors", "type": "[HealthError]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.id: Optional[str] = None - self.name: Optional[str] = None - self.bios_id: Optional[str] = None - self.fabric_object_id: Optional[str] = None - self.fqdn: Optional[str] = None - self.client_authentication_type: Optional[str] = None - self.version: Optional[str] = None - self.last_heartbeat_utc: Optional[datetime.datetime] = None - self.health: Optional[Union[str, "_models.ProtectionHealth"]] = None - self.health_errors: Optional[List["_models.HealthError"]] = None - - -class RecoveryPlan(Resource): - """Recovery plan details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :ivar type: Resource Type. - :vartype type: str - :ivar location: Resource Location. - :vartype location: str - :ivar properties: The custom details. - :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanProperties - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "properties": {"key": "properties", "type": "RecoveryPlanProperties"}, - } - - def __init__( - self, - *, - location: Optional[str] = None, - properties: Optional["_models.RecoveryPlanProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword location: Resource Location. - :paramtype location: str - :keyword properties: The custom details. - :paramtype properties: ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanProperties - """ - super().__init__(location=location, **kwargs) - self.properties = properties - - -class RecoveryPlanProviderSpecificDetails(_serialization.Model): - """Recovery plan provider specific details. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - RecoveryPlanA2ADetails - - All required parameters must be populated in order to send to server. - - :ivar instance_type: Gets the Instance type. Required. - :vartype instance_type: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - } - - _subtype_map = {"instance_type": {"A2A": "RecoveryPlanA2ADetails"}} - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.instance_type: Optional[str] = None - - -class RecoveryPlanA2ADetails(RecoveryPlanProviderSpecificDetails): - """Recovery plan A2A specific details. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: Gets the Instance type. Required. - :vartype instance_type: str - :ivar primary_zone: The primary zone. - :vartype primary_zone: str - :ivar recovery_zone: The recovery zone. - :vartype recovery_zone: str - :ivar primary_extended_location: The primary extended location. - :vartype primary_extended_location: - ~azure.mgmt.recoveryservicessiterecovery.models.ExtendedLocation - :ivar recovery_extended_location: The recovery extended location. - :vartype recovery_extended_location: - ~azure.mgmt.recoveryservicessiterecovery.models.ExtendedLocation - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "primary_zone": {"key": "primaryZone", "type": "str"}, - "recovery_zone": {"key": "recoveryZone", "type": "str"}, - "primary_extended_location": {"key": "primaryExtendedLocation", "type": "ExtendedLocation"}, - "recovery_extended_location": {"key": "recoveryExtendedLocation", "type": "ExtendedLocation"}, - } - - def __init__( - self, - *, - primary_zone: Optional[str] = None, - recovery_zone: Optional[str] = None, - primary_extended_location: Optional["_models.ExtendedLocation"] = None, - recovery_extended_location: Optional["_models.ExtendedLocation"] = None, - **kwargs: Any - ) -> None: - """ - :keyword primary_zone: The primary zone. - :paramtype primary_zone: str - :keyword recovery_zone: The recovery zone. - :paramtype recovery_zone: str - :keyword primary_extended_location: The primary extended location. - :paramtype primary_extended_location: - ~azure.mgmt.recoveryservicessiterecovery.models.ExtendedLocation - :keyword recovery_extended_location: The recovery extended location. - :paramtype recovery_extended_location: - ~azure.mgmt.recoveryservicessiterecovery.models.ExtendedLocation - """ - super().__init__(**kwargs) - self.instance_type: str = "A2A" - self.primary_zone = primary_zone - self.recovery_zone = recovery_zone - self.primary_extended_location = primary_extended_location - self.recovery_extended_location = recovery_extended_location - - -class RecoveryPlanProviderSpecificFailoverInput(_serialization.Model): # pylint: disable=name-too-long - """Recovery plan provider specific failover input. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - RecoveryPlanA2AFailoverInput, RecoveryPlanHyperVReplicaAzureFailoverInput, - RecoveryPlanHyperVReplicaAzureFailbackInput, RecoveryPlanInMageFailoverInput, - RecoveryPlanInMageAzureV2FailoverInput, RecoveryPlanInMageRcmFailoverInput, - RecoveryPlanInMageRcmFailbackFailoverInput - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - } - - _subtype_map = { - "instance_type": { - "A2A": "RecoveryPlanA2AFailoverInput", - "HyperVReplicaAzure": "RecoveryPlanHyperVReplicaAzureFailoverInput", - "HyperVReplicaAzureFailback": "RecoveryPlanHyperVReplicaAzureFailbackInput", - "InMage": "RecoveryPlanInMageFailoverInput", - "InMageAzureV2": "RecoveryPlanInMageAzureV2FailoverInput", - "InMageRcm": "RecoveryPlanInMageRcmFailoverInput", - "InMageRcmFailback": "RecoveryPlanInMageRcmFailbackFailoverInput", - } - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.instance_type: Optional[str] = None - - -class RecoveryPlanA2AFailoverInput(RecoveryPlanProviderSpecificFailoverInput): - """Recovery plan A2A failover input. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - :ivar recovery_point_type: The recovery point type. Required. Known values are: "Latest", - "LatestApplicationConsistent", "LatestCrashConsistent", and "LatestProcessed". - :vartype recovery_point_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.A2ARpRecoveryPointType - :ivar cloud_service_creation_option: A value indicating whether to use recovery cloud service - for TFO or not. - :vartype cloud_service_creation_option: str - :ivar multi_vm_sync_point_option: A value indicating whether multi VM sync enabled VMs should - use multi VM sync points for failover. Known values are: "UseMultiVmSyncRecoveryPoint" and - "UsePerVmRecoveryPoint". - :vartype multi_vm_sync_point_option: str or - ~azure.mgmt.recoveryservicessiterecovery.models.MultiVmSyncPointOption - """ - - _validation = { - "instance_type": {"required": True}, - "recovery_point_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "recovery_point_type": {"key": "recoveryPointType", "type": "str"}, - "cloud_service_creation_option": {"key": "cloudServiceCreationOption", "type": "str"}, - "multi_vm_sync_point_option": {"key": "multiVmSyncPointOption", "type": "str"}, - } - - def __init__( - self, - *, - recovery_point_type: Union[str, "_models.A2ARpRecoveryPointType"], - cloud_service_creation_option: Optional[str] = None, - multi_vm_sync_point_option: Optional[Union[str, "_models.MultiVmSyncPointOption"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword recovery_point_type: The recovery point type. Required. Known values are: "Latest", - "LatestApplicationConsistent", "LatestCrashConsistent", and "LatestProcessed". - :paramtype recovery_point_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.A2ARpRecoveryPointType - :keyword cloud_service_creation_option: A value indicating whether to use recovery cloud - service for TFO or not. - :paramtype cloud_service_creation_option: str - :keyword multi_vm_sync_point_option: A value indicating whether multi VM sync enabled VMs - should use multi VM sync points for failover. Known values are: "UseMultiVmSyncRecoveryPoint" - and "UsePerVmRecoveryPoint". - :paramtype multi_vm_sync_point_option: str or - ~azure.mgmt.recoveryservicessiterecovery.models.MultiVmSyncPointOption - """ - super().__init__(**kwargs) - self.instance_type: str = "A2A" - self.recovery_point_type = recovery_point_type - self.cloud_service_creation_option = cloud_service_creation_option - self.multi_vm_sync_point_option = multi_vm_sync_point_option - - -class RecoveryPlanProviderSpecificInput(_serialization.Model): - """Recovery plan provider specific input base class. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - RecoveryPlanA2AInput - - All required parameters must be populated in order to send to server. - - :ivar instance_type: Gets the Instance type. Required. - :vartype instance_type: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - } - - _subtype_map = {"instance_type": {"A2A": "RecoveryPlanA2AInput"}} - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.instance_type: Optional[str] = None - - -class RecoveryPlanA2AInput(RecoveryPlanProviderSpecificInput): - """Recovery plan A2A input. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: Gets the Instance type. Required. - :vartype instance_type: str - :ivar primary_zone: The primary zone. - :vartype primary_zone: str - :ivar recovery_zone: The recovery zone. - :vartype recovery_zone: str - :ivar primary_extended_location: The primary extended location. - :vartype primary_extended_location: - ~azure.mgmt.recoveryservicessiterecovery.models.ExtendedLocation - :ivar recovery_extended_location: The recovery extended location. - :vartype recovery_extended_location: - ~azure.mgmt.recoveryservicessiterecovery.models.ExtendedLocation - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "primary_zone": {"key": "primaryZone", "type": "str"}, - "recovery_zone": {"key": "recoveryZone", "type": "str"}, - "primary_extended_location": {"key": "primaryExtendedLocation", "type": "ExtendedLocation"}, - "recovery_extended_location": {"key": "recoveryExtendedLocation", "type": "ExtendedLocation"}, - } - - def __init__( - self, - *, - primary_zone: Optional[str] = None, - recovery_zone: Optional[str] = None, - primary_extended_location: Optional["_models.ExtendedLocation"] = None, - recovery_extended_location: Optional["_models.ExtendedLocation"] = None, - **kwargs: Any - ) -> None: - """ - :keyword primary_zone: The primary zone. - :paramtype primary_zone: str - :keyword recovery_zone: The recovery zone. - :paramtype recovery_zone: str - :keyword primary_extended_location: The primary extended location. - :paramtype primary_extended_location: - ~azure.mgmt.recoveryservicessiterecovery.models.ExtendedLocation - :keyword recovery_extended_location: The recovery extended location. - :paramtype recovery_extended_location: - ~azure.mgmt.recoveryservicessiterecovery.models.ExtendedLocation - """ - super().__init__(**kwargs) - self.instance_type: str = "A2A" - self.primary_zone = primary_zone - self.recovery_zone = recovery_zone - self.primary_extended_location = primary_extended_location - self.recovery_extended_location = recovery_extended_location - - -class RecoveryPlanAction(_serialization.Model): - """Recovery plan action details. - - All required parameters must be populated in order to send to server. - - :ivar action_name: The action name. Required. - :vartype action_name: str - :ivar failover_types: The list of failover types. Required. - :vartype failover_types: list[str or - ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItemOperation] - :ivar failover_directions: The list of failover directions. Required. - :vartype failover_directions: list[str or - ~azure.mgmt.recoveryservicessiterecovery.models.PossibleOperationsDirections] - :ivar custom_details: The custom details. Required. - :vartype custom_details: - ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanActionDetails - """ - - _validation = { - "action_name": {"required": True}, - "failover_types": {"required": True}, - "failover_directions": {"required": True}, - "custom_details": {"required": True}, - } - - _attribute_map = { - "action_name": {"key": "actionName", "type": "str"}, - "failover_types": {"key": "failoverTypes", "type": "[str]"}, - "failover_directions": {"key": "failoverDirections", "type": "[str]"}, - "custom_details": {"key": "customDetails", "type": "RecoveryPlanActionDetails"}, - } - - def __init__( - self, - *, - action_name: str, - failover_types: List[Union[str, "_models.ReplicationProtectedItemOperation"]], - failover_directions: List[Union[str, "_models.PossibleOperationsDirections"]], - custom_details: "_models.RecoveryPlanActionDetails", - **kwargs: Any - ) -> None: - """ - :keyword action_name: The action name. Required. - :paramtype action_name: str - :keyword failover_types: The list of failover types. Required. - :paramtype failover_types: list[str or - ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItemOperation] - :keyword failover_directions: The list of failover directions. Required. - :paramtype failover_directions: list[str or - ~azure.mgmt.recoveryservicessiterecovery.models.PossibleOperationsDirections] - :keyword custom_details: The custom details. Required. - :paramtype custom_details: - ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanActionDetails - """ - super().__init__(**kwargs) - self.action_name = action_name - self.failover_types = failover_types - self.failover_directions = failover_directions - self.custom_details = custom_details - - -class RecoveryPlanActionDetails(_serialization.Model): - """Recovery plan action custom details. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - RecoveryPlanAutomationRunbookActionDetails, RecoveryPlanManualActionDetails, - RecoveryPlanScriptActionDetails - - All required parameters must be populated in order to send to server. - - :ivar instance_type: Gets the type of action details (see RecoveryPlanActionDetailsTypes enum - for possible values). Required. - :vartype instance_type: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - } - - _subtype_map = { - "instance_type": { - "AutomationRunbookActionDetails": "RecoveryPlanAutomationRunbookActionDetails", - "ManualActionDetails": "RecoveryPlanManualActionDetails", - "ScriptActionDetails": "RecoveryPlanScriptActionDetails", - } - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.instance_type: Optional[str] = None - - -class RecoveryPlanAutomationRunbookActionDetails(RecoveryPlanActionDetails): # pylint: disable=name-too-long - """Recovery plan Automation runbook action details. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: Gets the type of action details (see RecoveryPlanActionDetailsTypes enum - for possible values). Required. - :vartype instance_type: str - :ivar runbook_id: The runbook ARM Id. - :vartype runbook_id: str - :ivar timeout: The runbook timeout. - :vartype timeout: str - :ivar fabric_location: The fabric location. Required. Known values are: "Primary" and - "Recovery". - :vartype fabric_location: str or - ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanActionLocation - """ - - _validation = { - "instance_type": {"required": True}, - "fabric_location": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "runbook_id": {"key": "runbookId", "type": "str"}, - "timeout": {"key": "timeout", "type": "str"}, - "fabric_location": {"key": "fabricLocation", "type": "str"}, - } - - def __init__( - self, - *, - fabric_location: Union[str, "_models.RecoveryPlanActionLocation"], - runbook_id: Optional[str] = None, - timeout: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword runbook_id: The runbook ARM Id. - :paramtype runbook_id: str - :keyword timeout: The runbook timeout. - :paramtype timeout: str - :keyword fabric_location: The fabric location. Required. Known values are: "Primary" and - "Recovery". - :paramtype fabric_location: str or - ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanActionLocation - """ - super().__init__(**kwargs) - self.instance_type: str = "AutomationRunbookActionDetails" - self.runbook_id = runbook_id - self.timeout = timeout - self.fabric_location = fabric_location - - -class RecoveryPlanCollection(_serialization.Model): - """Recovery plan collection details. - - :ivar value: The list of recovery plans. - :vartype value: list[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] - :ivar next_link: The value of next link. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[RecoveryPlan]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.RecoveryPlan"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The list of recovery plans. - :paramtype value: list[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] - :keyword next_link: The value of next link. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class RecoveryPlanGroup(_serialization.Model): - """Recovery plan group details. - - All required parameters must be populated in order to send to server. - - :ivar group_type: The group type. Required. Known values are: "Shutdown", "Boot", and - "Failover". - :vartype group_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanGroupType - :ivar replication_protected_items: The list of protected items. - :vartype replication_protected_items: - list[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanProtectedItem] - :ivar start_group_actions: The start group actions. - :vartype start_group_actions: - list[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanAction] - :ivar end_group_actions: The end group actions. - :vartype end_group_actions: - list[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanAction] - """ - - _validation = { - "group_type": {"required": True}, - } - - _attribute_map = { - "group_type": {"key": "groupType", "type": "str"}, - "replication_protected_items": {"key": "replicationProtectedItems", "type": "[RecoveryPlanProtectedItem]"}, - "start_group_actions": {"key": "startGroupActions", "type": "[RecoveryPlanAction]"}, - "end_group_actions": {"key": "endGroupActions", "type": "[RecoveryPlanAction]"}, - } - - def __init__( - self, - *, - group_type: Union[str, "_models.RecoveryPlanGroupType"], - replication_protected_items: Optional[List["_models.RecoveryPlanProtectedItem"]] = None, - start_group_actions: Optional[List["_models.RecoveryPlanAction"]] = None, - end_group_actions: Optional[List["_models.RecoveryPlanAction"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword group_type: The group type. Required. Known values are: "Shutdown", "Boot", and - "Failover". - :paramtype group_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanGroupType - :keyword replication_protected_items: The list of protected items. - :paramtype replication_protected_items: - list[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanProtectedItem] - :keyword start_group_actions: The start group actions. - :paramtype start_group_actions: - list[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanAction] - :keyword end_group_actions: The end group actions. - :paramtype end_group_actions: - list[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanAction] - """ - super().__init__(**kwargs) - self.group_type = group_type - self.replication_protected_items = replication_protected_items - self.start_group_actions = start_group_actions - self.end_group_actions = end_group_actions - - -class RecoveryPlanGroupTaskDetails(GroupTaskDetails): - """This class represents the recovery plan group task. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - RecoveryPlanShutdownGroupTaskDetails - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The type of task details. Required. - :vartype instance_type: str - :ivar child_tasks: The child tasks. - :vartype child_tasks: list[~azure.mgmt.recoveryservicessiterecovery.models.ASRTask] - :ivar name: The name. - :vartype name: str - :ivar group_id: The group identifier. - :vartype group_id: str - :ivar rp_group_type: The group type. - :vartype rp_group_type: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "child_tasks": {"key": "childTasks", "type": "[ASRTask]"}, - "name": {"key": "name", "type": "str"}, - "group_id": {"key": "groupId", "type": "str"}, - "rp_group_type": {"key": "rpGroupType", "type": "str"}, - } - - _subtype_map = {"instance_type": {"RecoveryPlanShutdownGroupTaskDetails": "RecoveryPlanShutdownGroupTaskDetails"}} - - def __init__( - self, - *, - child_tasks: Optional[List["_models.ASRTask"]] = None, - name: Optional[str] = None, - group_id: Optional[str] = None, - rp_group_type: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword child_tasks: The child tasks. - :paramtype child_tasks: list[~azure.mgmt.recoveryservicessiterecovery.models.ASRTask] - :keyword name: The name. - :paramtype name: str - :keyword group_id: The group identifier. - :paramtype group_id: str - :keyword rp_group_type: The group type. - :paramtype rp_group_type: str - """ - super().__init__(child_tasks=child_tasks, **kwargs) - self.instance_type: str = "RecoveryPlanGroupTaskDetails" - self.name = name - self.group_id = group_id - self.rp_group_type = rp_group_type - - -class RecoveryPlanHyperVReplicaAzureFailbackInput( - RecoveryPlanProviderSpecificFailoverInput -): # pylint: disable=name-too-long - """Recovery plan HVR Azure failback input. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - :ivar data_sync_option: The data sync option. Required. Known values are: "ForDownTime" and - "ForSynchronization". - :vartype data_sync_option: str or - ~azure.mgmt.recoveryservicessiterecovery.models.DataSyncStatus - :ivar recovery_vm_creation_option: The ALR option. Required. Known values are: - "CreateVmIfNotFound" and "NoAction". - :vartype recovery_vm_creation_option: str or - ~azure.mgmt.recoveryservicessiterecovery.models.AlternateLocationRecoveryOption - """ - - _validation = { - "instance_type": {"required": True}, - "data_sync_option": {"required": True}, - "recovery_vm_creation_option": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "data_sync_option": {"key": "dataSyncOption", "type": "str"}, - "recovery_vm_creation_option": {"key": "recoveryVmCreationOption", "type": "str"}, - } - - def __init__( - self, - *, - data_sync_option: Union[str, "_models.DataSyncStatus"], - recovery_vm_creation_option: Union[str, "_models.AlternateLocationRecoveryOption"], - **kwargs: Any - ) -> None: - """ - :keyword data_sync_option: The data sync option. Required. Known values are: "ForDownTime" and - "ForSynchronization". - :paramtype data_sync_option: str or - ~azure.mgmt.recoveryservicessiterecovery.models.DataSyncStatus - :keyword recovery_vm_creation_option: The ALR option. Required. Known values are: - "CreateVmIfNotFound" and "NoAction". - :paramtype recovery_vm_creation_option: str or - ~azure.mgmt.recoveryservicessiterecovery.models.AlternateLocationRecoveryOption - """ - super().__init__(**kwargs) - self.instance_type: str = "HyperVReplicaAzureFailback" - self.data_sync_option = data_sync_option - self.recovery_vm_creation_option = recovery_vm_creation_option - - -class RecoveryPlanHyperVReplicaAzureFailoverInput( - RecoveryPlanProviderSpecificFailoverInput -): # pylint: disable=name-too-long - """Recovery plan HVR Azure failover input. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - :ivar primary_kek_certificate_pfx: The primary KEK certificate PFX. - :vartype primary_kek_certificate_pfx: str - :ivar secondary_kek_certificate_pfx: The secondary KEK certificate PFX. - :vartype secondary_kek_certificate_pfx: str - :ivar recovery_point_type: The recovery point type. Known values are: "Latest", - "LatestApplicationConsistent", and "LatestProcessed". - :vartype recovery_point_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.HyperVReplicaAzureRpRecoveryPointType - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "primary_kek_certificate_pfx": {"key": "primaryKekCertificatePfx", "type": "str"}, - "secondary_kek_certificate_pfx": {"key": "secondaryKekCertificatePfx", "type": "str"}, - "recovery_point_type": {"key": "recoveryPointType", "type": "str"}, - } - - def __init__( - self, - *, - primary_kek_certificate_pfx: Optional[str] = None, - secondary_kek_certificate_pfx: Optional[str] = None, - recovery_point_type: Optional[Union[str, "_models.HyperVReplicaAzureRpRecoveryPointType"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword primary_kek_certificate_pfx: The primary KEK certificate PFX. - :paramtype primary_kek_certificate_pfx: str - :keyword secondary_kek_certificate_pfx: The secondary KEK certificate PFX. - :paramtype secondary_kek_certificate_pfx: str - :keyword recovery_point_type: The recovery point type. Known values are: "Latest", - "LatestApplicationConsistent", and "LatestProcessed". - :paramtype recovery_point_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.HyperVReplicaAzureRpRecoveryPointType - """ - super().__init__(**kwargs) - self.instance_type: str = "HyperVReplicaAzure" - self.primary_kek_certificate_pfx = primary_kek_certificate_pfx - self.secondary_kek_certificate_pfx = secondary_kek_certificate_pfx - self.recovery_point_type = recovery_point_type - - -class RecoveryPlanInMageAzureV2FailoverInput(RecoveryPlanProviderSpecificFailoverInput): - """Recovery plan InMageAzureV2 failover input. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - :ivar recovery_point_type: The recovery point type. Required. Known values are: "Latest", - "LatestApplicationConsistent", "LatestCrashConsistent", and "LatestProcessed". - :vartype recovery_point_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.InMageV2RpRecoveryPointType - :ivar use_multi_vm_sync_point: A value indicating whether multi VM sync enabled VMs should use - multi VM sync points for failover. - :vartype use_multi_vm_sync_point: str - """ - - _validation = { - "instance_type": {"required": True}, - "recovery_point_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "recovery_point_type": {"key": "recoveryPointType", "type": "str"}, - "use_multi_vm_sync_point": {"key": "useMultiVmSyncPoint", "type": "str"}, - } - - def __init__( - self, - *, - recovery_point_type: Union[str, "_models.InMageV2RpRecoveryPointType"], - use_multi_vm_sync_point: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword recovery_point_type: The recovery point type. Required. Known values are: "Latest", - "LatestApplicationConsistent", "LatestCrashConsistent", and "LatestProcessed". - :paramtype recovery_point_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.InMageV2RpRecoveryPointType - :keyword use_multi_vm_sync_point: A value indicating whether multi VM sync enabled VMs should - use multi VM sync points for failover. - :paramtype use_multi_vm_sync_point: str - """ - super().__init__(**kwargs) - self.instance_type: str = "InMageAzureV2" - self.recovery_point_type = recovery_point_type - self.use_multi_vm_sync_point = use_multi_vm_sync_point - - -class RecoveryPlanInMageFailoverInput(RecoveryPlanProviderSpecificFailoverInput): - """Recovery plan InMage failover input. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - :ivar recovery_point_type: The recovery point type. Required. Known values are: "LatestTime", - "LatestTag", and "Custom". - :vartype recovery_point_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.RpInMageRecoveryPointType - """ - - _validation = { - "instance_type": {"required": True}, - "recovery_point_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "recovery_point_type": {"key": "recoveryPointType", "type": "str"}, - } - - def __init__(self, *, recovery_point_type: Union[str, "_models.RpInMageRecoveryPointType"], **kwargs: Any) -> None: - """ - :keyword recovery_point_type: The recovery point type. Required. Known values are: - "LatestTime", "LatestTag", and "Custom". - :paramtype recovery_point_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.RpInMageRecoveryPointType - """ - super().__init__(**kwargs) - self.instance_type: str = "InMage" - self.recovery_point_type = recovery_point_type - - -class RecoveryPlanInMageRcmFailbackFailoverInput( - RecoveryPlanProviderSpecificFailoverInput -): # pylint: disable=name-too-long - """Recovery plan InMageRcmFailback failover input. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - :ivar recovery_point_type: The recovery point type. Required. Known values are: - "ApplicationConsistent" and "CrashConsistent". - :vartype recovery_point_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmFailbackRecoveryPointType - :ivar use_multi_vm_sync_point: A value indicating whether multi VM sync enabled VMs should use - multi VM sync points for failover. - :vartype use_multi_vm_sync_point: str - """ - - _validation = { - "instance_type": {"required": True}, - "recovery_point_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "recovery_point_type": {"key": "recoveryPointType", "type": "str"}, - "use_multi_vm_sync_point": {"key": "useMultiVmSyncPoint", "type": "str"}, - } - - def __init__( - self, - *, - recovery_point_type: Union[str, "_models.InMageRcmFailbackRecoveryPointType"], - use_multi_vm_sync_point: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword recovery_point_type: The recovery point type. Required. Known values are: - "ApplicationConsistent" and "CrashConsistent". - :paramtype recovery_point_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.InMageRcmFailbackRecoveryPointType - :keyword use_multi_vm_sync_point: A value indicating whether multi VM sync enabled VMs should - use multi VM sync points for failover. - :paramtype use_multi_vm_sync_point: str - """ - super().__init__(**kwargs) - self.instance_type: str = "InMageRcmFailback" - self.recovery_point_type = recovery_point_type - self.use_multi_vm_sync_point = use_multi_vm_sync_point - - -class RecoveryPlanInMageRcmFailoverInput(RecoveryPlanProviderSpecificFailoverInput): - """Recovery plan InMageRcm failover input. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - :ivar recovery_point_type: The recovery point type. Required. Known values are: "Latest", - "LatestApplicationConsistent", "LatestCrashConsistent", and "LatestProcessed". - :vartype recovery_point_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanPointType - :ivar use_multi_vm_sync_point: A value indicating whether multi VM sync enabled VMs should use - multi VM sync points for failover. - :vartype use_multi_vm_sync_point: str - """ - - _validation = { - "instance_type": {"required": True}, - "recovery_point_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "recovery_point_type": {"key": "recoveryPointType", "type": "str"}, - "use_multi_vm_sync_point": {"key": "useMultiVmSyncPoint", "type": "str"}, - } - - def __init__( - self, - *, - recovery_point_type: Union[str, "_models.RecoveryPlanPointType"], - use_multi_vm_sync_point: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword recovery_point_type: The recovery point type. Required. Known values are: "Latest", - "LatestApplicationConsistent", "LatestCrashConsistent", and "LatestProcessed". - :paramtype recovery_point_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanPointType - :keyword use_multi_vm_sync_point: A value indicating whether multi VM sync enabled VMs should - use multi VM sync points for failover. - :paramtype use_multi_vm_sync_point: str - """ - super().__init__(**kwargs) - self.instance_type: str = "InMageRcm" - self.recovery_point_type = recovery_point_type - self.use_multi_vm_sync_point = use_multi_vm_sync_point - - -class RecoveryPlanManualActionDetails(RecoveryPlanActionDetails): - """Recovery plan manual action details. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: Gets the type of action details (see RecoveryPlanActionDetailsTypes enum - for possible values). Required. - :vartype instance_type: str - :ivar description: The manual action description. - :vartype description: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "description": {"key": "description", "type": "str"}, - } - - def __init__(self, *, description: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword description: The manual action description. - :paramtype description: str - """ - super().__init__(**kwargs) - self.instance_type: str = "ManualActionDetails" - self.description = description - - -class RecoveryPlanPlannedFailoverInput(_serialization.Model): - """Recovery plan planned failover input. - - All required parameters must be populated in order to send to server. - - :ivar properties: The recovery plan planned failover input properties. Required. - :vartype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanPlannedFailoverInputProperties - """ - - _validation = { - "properties": {"required": True}, - } - - _attribute_map = { - "properties": {"key": "properties", "type": "RecoveryPlanPlannedFailoverInputProperties"}, - } - - def __init__(self, *, properties: "_models.RecoveryPlanPlannedFailoverInputProperties", **kwargs: Any) -> None: - """ - :keyword properties: The recovery plan planned failover input properties. Required. - :paramtype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanPlannedFailoverInputProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class RecoveryPlanPlannedFailoverInputProperties(_serialization.Model): # pylint: disable=name-too-long - """Recovery plan planned failover input properties. - - All required parameters must be populated in order to send to server. - - :ivar failover_direction: The failover direction. Required. Known values are: - "PrimaryToRecovery" and "RecoveryToPrimary". - :vartype failover_direction: str or - ~azure.mgmt.recoveryservicessiterecovery.models.PossibleOperationsDirections - :ivar provider_specific_details: The provider specific properties. - :vartype provider_specific_details: - list[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanProviderSpecificFailoverInput] - """ - - _validation = { - "failover_direction": {"required": True}, - } - - _attribute_map = { - "failover_direction": {"key": "failoverDirection", "type": "str"}, - "provider_specific_details": { - "key": "providerSpecificDetails", - "type": "[RecoveryPlanProviderSpecificFailoverInput]", - }, - } - - def __init__( - self, - *, - failover_direction: Union[str, "_models.PossibleOperationsDirections"], - provider_specific_details: Optional[List["_models.RecoveryPlanProviderSpecificFailoverInput"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword failover_direction: The failover direction. Required. Known values are: - "PrimaryToRecovery" and "RecoveryToPrimary". - :paramtype failover_direction: str or - ~azure.mgmt.recoveryservicessiterecovery.models.PossibleOperationsDirections - :keyword provider_specific_details: The provider specific properties. - :paramtype provider_specific_details: - list[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanProviderSpecificFailoverInput] - """ - super().__init__(**kwargs) - self.failover_direction = failover_direction - self.provider_specific_details = provider_specific_details - - -class RecoveryPlanProperties(_serialization.Model): - """Recovery plan properties. - - :ivar friendly_name: The friendly name. - :vartype friendly_name: str - :ivar primary_fabric_id: The primary fabric Id. - :vartype primary_fabric_id: str - :ivar primary_fabric_friendly_name: The primary fabric friendly name. - :vartype primary_fabric_friendly_name: str - :ivar recovery_fabric_id: The recovery fabric Id. - :vartype recovery_fabric_id: str - :ivar recovery_fabric_friendly_name: The recovery fabric friendly name. - :vartype recovery_fabric_friendly_name: str - :ivar failover_deployment_model: The failover deployment model. - :vartype failover_deployment_model: str - :ivar replication_providers: The list of replication providers. - :vartype replication_providers: list[str] - :ivar allowed_operations: The list of allowed operations. - :vartype allowed_operations: list[str] - :ivar last_planned_failover_time: The start time of the last planned failover. - :vartype last_planned_failover_time: ~datetime.datetime - :ivar last_unplanned_failover_time: The start time of the last unplanned failover. - :vartype last_unplanned_failover_time: ~datetime.datetime - :ivar last_test_failover_time: The start time of the last test failover. - :vartype last_test_failover_time: ~datetime.datetime - :ivar current_scenario: The current scenario details. - :vartype current_scenario: - ~azure.mgmt.recoveryservicessiterecovery.models.CurrentScenarioDetails - :ivar current_scenario_status: The recovery plan status. - :vartype current_scenario_status: str - :ivar current_scenario_status_description: The recovery plan status description. - :vartype current_scenario_status_description: str - :ivar groups: The recovery plan groups. - :vartype groups: list[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanGroup] - :ivar provider_specific_details: The provider id and provider specific details. - :vartype provider_specific_details: - list[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanProviderSpecificDetails] - """ - - _attribute_map = { - "friendly_name": {"key": "friendlyName", "type": "str"}, - "primary_fabric_id": {"key": "primaryFabricId", "type": "str"}, - "primary_fabric_friendly_name": {"key": "primaryFabricFriendlyName", "type": "str"}, - "recovery_fabric_id": {"key": "recoveryFabricId", "type": "str"}, - "recovery_fabric_friendly_name": {"key": "recoveryFabricFriendlyName", "type": "str"}, - "failover_deployment_model": {"key": "failoverDeploymentModel", "type": "str"}, - "replication_providers": {"key": "replicationProviders", "type": "[str]"}, - "allowed_operations": {"key": "allowedOperations", "type": "[str]"}, - "last_planned_failover_time": {"key": "lastPlannedFailoverTime", "type": "iso-8601"}, - "last_unplanned_failover_time": {"key": "lastUnplannedFailoverTime", "type": "iso-8601"}, - "last_test_failover_time": {"key": "lastTestFailoverTime", "type": "iso-8601"}, - "current_scenario": {"key": "currentScenario", "type": "CurrentScenarioDetails"}, - "current_scenario_status": {"key": "currentScenarioStatus", "type": "str"}, - "current_scenario_status_description": {"key": "currentScenarioStatusDescription", "type": "str"}, - "groups": {"key": "groups", "type": "[RecoveryPlanGroup]"}, - "provider_specific_details": { - "key": "providerSpecificDetails", - "type": "[RecoveryPlanProviderSpecificDetails]", - }, - } - - def __init__( - self, - *, - friendly_name: Optional[str] = None, - primary_fabric_id: Optional[str] = None, - primary_fabric_friendly_name: Optional[str] = None, - recovery_fabric_id: Optional[str] = None, - recovery_fabric_friendly_name: Optional[str] = None, - failover_deployment_model: Optional[str] = None, - replication_providers: Optional[List[str]] = None, - allowed_operations: Optional[List[str]] = None, - last_planned_failover_time: Optional[datetime.datetime] = None, - last_unplanned_failover_time: Optional[datetime.datetime] = None, - last_test_failover_time: Optional[datetime.datetime] = None, - current_scenario: Optional["_models.CurrentScenarioDetails"] = None, - current_scenario_status: Optional[str] = None, - current_scenario_status_description: Optional[str] = None, - groups: Optional[List["_models.RecoveryPlanGroup"]] = None, - provider_specific_details: Optional[List["_models.RecoveryPlanProviderSpecificDetails"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword friendly_name: The friendly name. - :paramtype friendly_name: str - :keyword primary_fabric_id: The primary fabric Id. - :paramtype primary_fabric_id: str - :keyword primary_fabric_friendly_name: The primary fabric friendly name. - :paramtype primary_fabric_friendly_name: str - :keyword recovery_fabric_id: The recovery fabric Id. - :paramtype recovery_fabric_id: str - :keyword recovery_fabric_friendly_name: The recovery fabric friendly name. - :paramtype recovery_fabric_friendly_name: str - :keyword failover_deployment_model: The failover deployment model. - :paramtype failover_deployment_model: str - :keyword replication_providers: The list of replication providers. - :paramtype replication_providers: list[str] - :keyword allowed_operations: The list of allowed operations. - :paramtype allowed_operations: list[str] - :keyword last_planned_failover_time: The start time of the last planned failover. - :paramtype last_planned_failover_time: ~datetime.datetime - :keyword last_unplanned_failover_time: The start time of the last unplanned failover. - :paramtype last_unplanned_failover_time: ~datetime.datetime - :keyword last_test_failover_time: The start time of the last test failover. - :paramtype last_test_failover_time: ~datetime.datetime - :keyword current_scenario: The current scenario details. - :paramtype current_scenario: - ~azure.mgmt.recoveryservicessiterecovery.models.CurrentScenarioDetails - :keyword current_scenario_status: The recovery plan status. - :paramtype current_scenario_status: str - :keyword current_scenario_status_description: The recovery plan status description. - :paramtype current_scenario_status_description: str - :keyword groups: The recovery plan groups. - :paramtype groups: list[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanGroup] - :keyword provider_specific_details: The provider id and provider specific details. - :paramtype provider_specific_details: - list[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanProviderSpecificDetails] - """ - super().__init__(**kwargs) - self.friendly_name = friendly_name - self.primary_fabric_id = primary_fabric_id - self.primary_fabric_friendly_name = primary_fabric_friendly_name - self.recovery_fabric_id = recovery_fabric_id - self.recovery_fabric_friendly_name = recovery_fabric_friendly_name - self.failover_deployment_model = failover_deployment_model - self.replication_providers = replication_providers - self.allowed_operations = allowed_operations - self.last_planned_failover_time = last_planned_failover_time - self.last_unplanned_failover_time = last_unplanned_failover_time - self.last_test_failover_time = last_test_failover_time - self.current_scenario = current_scenario - self.current_scenario_status = current_scenario_status - self.current_scenario_status_description = current_scenario_status_description - self.groups = groups - self.provider_specific_details = provider_specific_details - - -class RecoveryPlanProtectedItem(_serialization.Model): - """Recovery plan protected item. - - :ivar id: The ARM Id of the recovery plan protected item. - :vartype id: str - :ivar virtual_machine_id: The virtual machine Id. - :vartype virtual_machine_id: str - """ - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "virtual_machine_id": {"key": "virtualMachineId", "type": "str"}, - } - - def __init__( - self, - *, - id: Optional[str] = None, # pylint: disable=redefined-builtin - virtual_machine_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: The ARM Id of the recovery plan protected item. - :paramtype id: str - :keyword virtual_machine_id: The virtual machine Id. - :paramtype virtual_machine_id: str - """ - super().__init__(**kwargs) - self.id = id - self.virtual_machine_id = virtual_machine_id - - -class RecoveryPlanScriptActionDetails(RecoveryPlanActionDetails): - """Recovery plan script action details. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: Gets the type of action details (see RecoveryPlanActionDetailsTypes enum - for possible values). Required. - :vartype instance_type: str - :ivar path: The script path. Required. - :vartype path: str - :ivar timeout: The script timeout. - :vartype timeout: str - :ivar fabric_location: The fabric location. Required. Known values are: "Primary" and - "Recovery". - :vartype fabric_location: str or - ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanActionLocation - """ - - _validation = { - "instance_type": {"required": True}, - "path": {"required": True}, - "fabric_location": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "path": {"key": "path", "type": "str"}, - "timeout": {"key": "timeout", "type": "str"}, - "fabric_location": {"key": "fabricLocation", "type": "str"}, - } - - def __init__( - self, - *, - path: str, - fabric_location: Union[str, "_models.RecoveryPlanActionLocation"], - timeout: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword path: The script path. Required. - :paramtype path: str - :keyword timeout: The script timeout. - :paramtype timeout: str - :keyword fabric_location: The fabric location. Required. Known values are: "Primary" and - "Recovery". - :paramtype fabric_location: str or - ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanActionLocation - """ - super().__init__(**kwargs) - self.instance_type: str = "ScriptActionDetails" - self.path = path - self.timeout = timeout - self.fabric_location = fabric_location - - -class RecoveryPlanShutdownGroupTaskDetails(RecoveryPlanGroupTaskDetails): - """This class represents the recovery plan shutdown group task details. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The type of task details. Required. - :vartype instance_type: str - :ivar child_tasks: The child tasks. - :vartype child_tasks: list[~azure.mgmt.recoveryservicessiterecovery.models.ASRTask] - :ivar name: The name. - :vartype name: str - :ivar group_id: The group identifier. - :vartype group_id: str - :ivar rp_group_type: The group type. - :vartype rp_group_type: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "child_tasks": {"key": "childTasks", "type": "[ASRTask]"}, - "name": {"key": "name", "type": "str"}, - "group_id": {"key": "groupId", "type": "str"}, - "rp_group_type": {"key": "rpGroupType", "type": "str"}, - } - - def __init__( - self, - *, - child_tasks: Optional[List["_models.ASRTask"]] = None, - name: Optional[str] = None, - group_id: Optional[str] = None, - rp_group_type: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword child_tasks: The child tasks. - :paramtype child_tasks: list[~azure.mgmt.recoveryservicessiterecovery.models.ASRTask] - :keyword name: The name. - :paramtype name: str - :keyword group_id: The group identifier. - :paramtype group_id: str - :keyword rp_group_type: The group type. - :paramtype rp_group_type: str - """ - super().__init__(child_tasks=child_tasks, name=name, group_id=group_id, rp_group_type=rp_group_type, **kwargs) - self.instance_type: str = "RecoveryPlanShutdownGroupTaskDetails" - - -class RecoveryPlanTestFailoverCleanupInput(_serialization.Model): - """Recovery plan test failover cleanup input. - - All required parameters must be populated in order to send to server. - - :ivar properties: The recovery plan test failover cleanup input properties. Required. - :vartype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanTestFailoverCleanupInputProperties - """ - - _validation = { - "properties": {"required": True}, - } - - _attribute_map = { - "properties": {"key": "properties", "type": "RecoveryPlanTestFailoverCleanupInputProperties"}, - } - - def __init__(self, *, properties: "_models.RecoveryPlanTestFailoverCleanupInputProperties", **kwargs: Any) -> None: - """ - :keyword properties: The recovery plan test failover cleanup input properties. Required. - :paramtype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanTestFailoverCleanupInputProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class RecoveryPlanTestFailoverCleanupInputProperties(_serialization.Model): # pylint: disable=name-too-long - """Recovery plan test failover cleanup input properties. - - :ivar comments: The test failover cleanup comments. - :vartype comments: str - """ - - _validation = { - "comments": {"max_length": 1024}, - } - - _attribute_map = { - "comments": {"key": "comments", "type": "str"}, - } - - def __init__(self, *, comments: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword comments: The test failover cleanup comments. - :paramtype comments: str - """ - super().__init__(**kwargs) - self.comments = comments - - -class RecoveryPlanTestFailoverInput(_serialization.Model): - """Recovery plan test failover input. - - All required parameters must be populated in order to send to server. - - :ivar properties: The recovery plan test failover input properties. Required. - :vartype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanTestFailoverInputProperties - """ - - _validation = { - "properties": {"required": True}, - } - - _attribute_map = { - "properties": {"key": "properties", "type": "RecoveryPlanTestFailoverInputProperties"}, - } - - def __init__(self, *, properties: "_models.RecoveryPlanTestFailoverInputProperties", **kwargs: Any) -> None: - """ - :keyword properties: The recovery plan test failover input properties. Required. - :paramtype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanTestFailoverInputProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class RecoveryPlanTestFailoverInputProperties(_serialization.Model): - """Recovery plan test failover input properties. - - All required parameters must be populated in order to send to server. - - :ivar failover_direction: The failover direction. Required. Known values are: - "PrimaryToRecovery" and "RecoveryToPrimary". - :vartype failover_direction: str or - ~azure.mgmt.recoveryservicessiterecovery.models.PossibleOperationsDirections - :ivar network_type: The network type to be used for test failover. Required. - :vartype network_type: str - :ivar network_id: The Id of the network to be used for test failover. - :vartype network_id: str - :ivar provider_specific_details: The provider specific properties. - :vartype provider_specific_details: - list[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanProviderSpecificFailoverInput] - """ - - _validation = { - "failover_direction": {"required": True}, - "network_type": {"required": True}, - } - - _attribute_map = { - "failover_direction": {"key": "failoverDirection", "type": "str"}, - "network_type": {"key": "networkType", "type": "str"}, - "network_id": {"key": "networkId", "type": "str"}, - "provider_specific_details": { - "key": "providerSpecificDetails", - "type": "[RecoveryPlanProviderSpecificFailoverInput]", - }, - } - - def __init__( - self, - *, - failover_direction: Union[str, "_models.PossibleOperationsDirections"], - network_type: str, - network_id: Optional[str] = None, - provider_specific_details: Optional[List["_models.RecoveryPlanProviderSpecificFailoverInput"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword failover_direction: The failover direction. Required. Known values are: - "PrimaryToRecovery" and "RecoveryToPrimary". - :paramtype failover_direction: str or - ~azure.mgmt.recoveryservicessiterecovery.models.PossibleOperationsDirections - :keyword network_type: The network type to be used for test failover. Required. - :paramtype network_type: str - :keyword network_id: The Id of the network to be used for test failover. - :paramtype network_id: str - :keyword provider_specific_details: The provider specific properties. - :paramtype provider_specific_details: - list[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanProviderSpecificFailoverInput] - """ - super().__init__(**kwargs) - self.failover_direction = failover_direction - self.network_type = network_type - self.network_id = network_id - self.provider_specific_details = provider_specific_details - - -class RecoveryPlanUnplannedFailoverInput(_serialization.Model): - """Recovery plan unplanned failover input. - - All required parameters must be populated in order to send to server. - - :ivar properties: The recovery plan unplanned failover input properties. Required. - :vartype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanUnplannedFailoverInputProperties - """ - - _validation = { - "properties": {"required": True}, - } - - _attribute_map = { - "properties": {"key": "properties", "type": "RecoveryPlanUnplannedFailoverInputProperties"}, - } - - def __init__(self, *, properties: "_models.RecoveryPlanUnplannedFailoverInputProperties", **kwargs: Any) -> None: - """ - :keyword properties: The recovery plan unplanned failover input properties. Required. - :paramtype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanUnplannedFailoverInputProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class RecoveryPlanUnplannedFailoverInputProperties(_serialization.Model): # pylint: disable=name-too-long - """Recovery plan unplanned failover input properties. - - All required parameters must be populated in order to send to server. - - :ivar failover_direction: The failover direction. Required. Known values are: - "PrimaryToRecovery" and "RecoveryToPrimary". - :vartype failover_direction: str or - ~azure.mgmt.recoveryservicessiterecovery.models.PossibleOperationsDirections - :ivar source_site_operations: A value indicating whether source site operations are required. - Required. Known values are: "Required" and "NotRequired". - :vartype source_site_operations: str or - ~azure.mgmt.recoveryservicessiterecovery.models.SourceSiteOperations - :ivar provider_specific_details: The provider specific properties. - :vartype provider_specific_details: - list[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanProviderSpecificFailoverInput] - """ - - _validation = { - "failover_direction": {"required": True}, - "source_site_operations": {"required": True}, - } - - _attribute_map = { - "failover_direction": {"key": "failoverDirection", "type": "str"}, - "source_site_operations": {"key": "sourceSiteOperations", "type": "str"}, - "provider_specific_details": { - "key": "providerSpecificDetails", - "type": "[RecoveryPlanProviderSpecificFailoverInput]", - }, - } - - def __init__( - self, - *, - failover_direction: Union[str, "_models.PossibleOperationsDirections"], - source_site_operations: Union[str, "_models.SourceSiteOperations"], - provider_specific_details: Optional[List["_models.RecoveryPlanProviderSpecificFailoverInput"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword failover_direction: The failover direction. Required. Known values are: - "PrimaryToRecovery" and "RecoveryToPrimary". - :paramtype failover_direction: str or - ~azure.mgmt.recoveryservicessiterecovery.models.PossibleOperationsDirections - :keyword source_site_operations: A value indicating whether source site operations are - required. Required. Known values are: "Required" and "NotRequired". - :paramtype source_site_operations: str or - ~azure.mgmt.recoveryservicessiterecovery.models.SourceSiteOperations - :keyword provider_specific_details: The provider specific properties. - :paramtype provider_specific_details: - list[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanProviderSpecificFailoverInput] - """ - super().__init__(**kwargs) - self.failover_direction = failover_direction - self.source_site_operations = source_site_operations - self.provider_specific_details = provider_specific_details - - -class RecoveryPoint(Resource): - """Recovery point. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :ivar type: Resource Type. - :vartype type: str - :ivar location: Resource Location. - :vartype location: str - :ivar properties: The recovery point properties. - :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPointProperties - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "properties": {"key": "properties", "type": "RecoveryPointProperties"}, - } - - def __init__( - self, - *, - location: Optional[str] = None, - properties: Optional["_models.RecoveryPointProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword location: Resource Location. - :paramtype location: str - :keyword properties: The recovery point properties. - :paramtype properties: ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPointProperties - """ - super().__init__(location=location, **kwargs) - self.properties = properties - - -class RecoveryPointCollection(_serialization.Model): - """Collection of recovery point details. - - :ivar value: The recovery point details. - :vartype value: list[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPoint] - :ivar next_link: The value of next link. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[RecoveryPoint]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.RecoveryPoint"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The recovery point details. - :paramtype value: list[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPoint] - :keyword next_link: The value of next link. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class RecoveryPointProperties(_serialization.Model): - """Recovery point properties. - - :ivar recovery_point_time: The recovery point time. - :vartype recovery_point_time: ~datetime.datetime - :ivar recovery_point_type: The recovery point type: ApplicationConsistent, CrashConsistent. - :vartype recovery_point_type: str - :ivar provider_specific_details: The provider specific details for the recovery point. - :vartype provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.ProviderSpecificRecoveryPointDetails - """ - - _attribute_map = { - "recovery_point_time": {"key": "recoveryPointTime", "type": "iso-8601"}, - "recovery_point_type": {"key": "recoveryPointType", "type": "str"}, - "provider_specific_details": {"key": "providerSpecificDetails", "type": "ProviderSpecificRecoveryPointDetails"}, - } - - def __init__( - self, - *, - recovery_point_time: Optional[datetime.datetime] = None, - recovery_point_type: Optional[str] = None, - provider_specific_details: Optional["_models.ProviderSpecificRecoveryPointDetails"] = None, - **kwargs: Any - ) -> None: - """ - :keyword recovery_point_time: The recovery point time. - :paramtype recovery_point_time: ~datetime.datetime - :keyword recovery_point_type: The recovery point type: ApplicationConsistent, CrashConsistent. - :paramtype recovery_point_type: str - :keyword provider_specific_details: The provider specific details for the recovery point. - :paramtype provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.ProviderSpecificRecoveryPointDetails - """ - super().__init__(**kwargs) - self.recovery_point_time = recovery_point_time - self.recovery_point_type = recovery_point_type - self.provider_specific_details = provider_specific_details - - -class RecoveryServicesProvider(Resource): - """Provider details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :ivar type: Resource Type. - :vartype type: str - :ivar location: Resource Location. - :vartype location: str - :ivar properties: Provider properties. - :vartype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryServicesProviderProperties - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "properties": {"key": "properties", "type": "RecoveryServicesProviderProperties"}, - } - - def __init__( - self, - *, - location: Optional[str] = None, - properties: Optional["_models.RecoveryServicesProviderProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword location: Resource Location. - :paramtype location: str - :keyword properties: Provider properties. - :paramtype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryServicesProviderProperties - """ - super().__init__(location=location, **kwargs) - self.properties = properties - - -class RecoveryServicesProviderCollection(_serialization.Model): - """Collection of providers. - - :ivar value: The Servers details. - :vartype value: list[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryServicesProvider] - :ivar next_link: The value of next link. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[RecoveryServicesProvider]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.RecoveryServicesProvider"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The Servers details. - :paramtype value: - list[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryServicesProvider] - :keyword next_link: The value of next link. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class RecoveryServicesProviderProperties(_serialization.Model): - """Recovery services provider properties. - - :ivar fabric_type: Type of the site. - :vartype fabric_type: str - :ivar friendly_name: Friendly name of the DRA. - :vartype friendly_name: str - :ivar provider_version: The provider version. - :vartype provider_version: str - :ivar server_version: The fabric provider. - :vartype server_version: str - :ivar provider_version_state: DRA version status. - :vartype provider_version_state: str - :ivar provider_version_expiry_date: Expiry date of the version. - :vartype provider_version_expiry_date: ~datetime.datetime - :ivar fabric_friendly_name: The fabric friendly name. - :vartype fabric_friendly_name: str - :ivar last_heart_beat: Time when last heartbeat was sent by the DRA. - :vartype last_heart_beat: ~datetime.datetime - :ivar connection_status: A value indicating whether DRA is responsive. - :vartype connection_status: str - :ivar protected_item_count: Number of protected VMs currently managed by the DRA. - :vartype protected_item_count: int - :ivar allowed_scenarios: The scenarios allowed on this provider. - :vartype allowed_scenarios: list[str] - :ivar health_error_details: The recovery services provider health error details. - :vartype health_error_details: - list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] - :ivar dra_identifier: The DRA Id. - :vartype dra_identifier: str - :ivar machine_id: The machine Id. - :vartype machine_id: str - :ivar machine_name: The machine name. - :vartype machine_name: str - :ivar bios_id: The Bios Id. - :vartype bios_id: str - :ivar authentication_identity_details: The authentication identity details. - :vartype authentication_identity_details: - ~azure.mgmt.recoveryservicessiterecovery.models.IdentityProviderDetails - :ivar resource_access_identity_details: The resource access identity details. - :vartype resource_access_identity_details: - ~azure.mgmt.recoveryservicessiterecovery.models.IdentityProviderDetails - :ivar data_plane_authentication_identity_details: The data plane authentication identity - details. - :vartype data_plane_authentication_identity_details: - ~azure.mgmt.recoveryservicessiterecovery.models.IdentityProviderDetails - :ivar provider_version_details: The provider version details. - :vartype provider_version_details: - ~azure.mgmt.recoveryservicessiterecovery.models.VersionDetails - """ - - _attribute_map = { - "fabric_type": {"key": "fabricType", "type": "str"}, - "friendly_name": {"key": "friendlyName", "type": "str"}, - "provider_version": {"key": "providerVersion", "type": "str"}, - "server_version": {"key": "serverVersion", "type": "str"}, - "provider_version_state": {"key": "providerVersionState", "type": "str"}, - "provider_version_expiry_date": {"key": "providerVersionExpiryDate", "type": "iso-8601"}, - "fabric_friendly_name": {"key": "fabricFriendlyName", "type": "str"}, - "last_heart_beat": {"key": "lastHeartBeat", "type": "iso-8601"}, - "connection_status": {"key": "connectionStatus", "type": "str"}, - "protected_item_count": {"key": "protectedItemCount", "type": "int"}, - "allowed_scenarios": {"key": "allowedScenarios", "type": "[str]"}, - "health_error_details": {"key": "healthErrorDetails", "type": "[HealthError]"}, - "dra_identifier": {"key": "draIdentifier", "type": "str"}, - "machine_id": {"key": "machineId", "type": "str"}, - "machine_name": {"key": "machineName", "type": "str"}, - "bios_id": {"key": "biosId", "type": "str"}, - "authentication_identity_details": {"key": "authenticationIdentityDetails", "type": "IdentityProviderDetails"}, - "resource_access_identity_details": {"key": "resourceAccessIdentityDetails", "type": "IdentityProviderDetails"}, - "data_plane_authentication_identity_details": { - "key": "dataPlaneAuthenticationIdentityDetails", - "type": "IdentityProviderDetails", - }, - "provider_version_details": {"key": "providerVersionDetails", "type": "VersionDetails"}, - } - - def __init__( - self, - *, - fabric_type: Optional[str] = None, - friendly_name: Optional[str] = None, - provider_version: Optional[str] = None, - server_version: Optional[str] = None, - provider_version_state: Optional[str] = None, - provider_version_expiry_date: Optional[datetime.datetime] = None, - fabric_friendly_name: Optional[str] = None, - last_heart_beat: Optional[datetime.datetime] = None, - connection_status: Optional[str] = None, - protected_item_count: Optional[int] = None, - allowed_scenarios: Optional[List[str]] = None, - health_error_details: Optional[List["_models.HealthError"]] = None, - dra_identifier: Optional[str] = None, - machine_id: Optional[str] = None, - machine_name: Optional[str] = None, - bios_id: Optional[str] = None, - authentication_identity_details: Optional["_models.IdentityProviderDetails"] = None, - resource_access_identity_details: Optional["_models.IdentityProviderDetails"] = None, - data_plane_authentication_identity_details: Optional["_models.IdentityProviderDetails"] = None, - provider_version_details: Optional["_models.VersionDetails"] = None, - **kwargs: Any - ) -> None: - """ - :keyword fabric_type: Type of the site. - :paramtype fabric_type: str - :keyword friendly_name: Friendly name of the DRA. - :paramtype friendly_name: str - :keyword provider_version: The provider version. - :paramtype provider_version: str - :keyword server_version: The fabric provider. - :paramtype server_version: str - :keyword provider_version_state: DRA version status. - :paramtype provider_version_state: str - :keyword provider_version_expiry_date: Expiry date of the version. - :paramtype provider_version_expiry_date: ~datetime.datetime - :keyword fabric_friendly_name: The fabric friendly name. - :paramtype fabric_friendly_name: str - :keyword last_heart_beat: Time when last heartbeat was sent by the DRA. - :paramtype last_heart_beat: ~datetime.datetime - :keyword connection_status: A value indicating whether DRA is responsive. - :paramtype connection_status: str - :keyword protected_item_count: Number of protected VMs currently managed by the DRA. - :paramtype protected_item_count: int - :keyword allowed_scenarios: The scenarios allowed on this provider. - :paramtype allowed_scenarios: list[str] - :keyword health_error_details: The recovery services provider health error details. - :paramtype health_error_details: - list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] - :keyword dra_identifier: The DRA Id. - :paramtype dra_identifier: str - :keyword machine_id: The machine Id. - :paramtype machine_id: str - :keyword machine_name: The machine name. - :paramtype machine_name: str - :keyword bios_id: The Bios Id. - :paramtype bios_id: str - :keyword authentication_identity_details: The authentication identity details. - :paramtype authentication_identity_details: - ~azure.mgmt.recoveryservicessiterecovery.models.IdentityProviderDetails - :keyword resource_access_identity_details: The resource access identity details. - :paramtype resource_access_identity_details: - ~azure.mgmt.recoveryservicessiterecovery.models.IdentityProviderDetails - :keyword data_plane_authentication_identity_details: The data plane authentication identity - details. - :paramtype data_plane_authentication_identity_details: - ~azure.mgmt.recoveryservicessiterecovery.models.IdentityProviderDetails - :keyword provider_version_details: The provider version details. - :paramtype provider_version_details: - ~azure.mgmt.recoveryservicessiterecovery.models.VersionDetails - """ - super().__init__(**kwargs) - self.fabric_type = fabric_type - self.friendly_name = friendly_name - self.provider_version = provider_version - self.server_version = server_version - self.provider_version_state = provider_version_state - self.provider_version_expiry_date = provider_version_expiry_date - self.fabric_friendly_name = fabric_friendly_name - self.last_heart_beat = last_heart_beat - self.connection_status = connection_status - self.protected_item_count = protected_item_count - self.allowed_scenarios = allowed_scenarios - self.health_error_details = health_error_details - self.dra_identifier = dra_identifier - self.machine_id = machine_id - self.machine_name = machine_name - self.bios_id = bios_id - self.authentication_identity_details = authentication_identity_details - self.resource_access_identity_details = resource_access_identity_details - self.data_plane_authentication_identity_details = data_plane_authentication_identity_details - self.provider_version_details = provider_version_details - - -class RegisteredClusterNodes(_serialization.Model): - """Extended location of the resource. - - :ivar cluster_node_fqdn: The cluster node name. - :vartype cluster_node_fqdn: str - :ivar machine_id: The machine ID. - :vartype machine_id: str - :ivar bios_id: The BIOS ID. - :vartype bios_id: str - :ivar is_shared_disk_virtual_node: A value indicating whether this represents virtual entity - hosting all the shared disks. - :vartype is_shared_disk_virtual_node: bool - """ - - _attribute_map = { - "cluster_node_fqdn": {"key": "clusterNodeFqdn", "type": "str"}, - "machine_id": {"key": "machineId", "type": "str"}, - "bios_id": {"key": "biosId", "type": "str"}, - "is_shared_disk_virtual_node": {"key": "isSharedDiskVirtualNode", "type": "bool"}, - } - - def __init__( - self, - *, - cluster_node_fqdn: Optional[str] = None, - machine_id: Optional[str] = None, - bios_id: Optional[str] = None, - is_shared_disk_virtual_node: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :keyword cluster_node_fqdn: The cluster node name. - :paramtype cluster_node_fqdn: str - :keyword machine_id: The machine ID. - :paramtype machine_id: str - :keyword bios_id: The BIOS ID. - :paramtype bios_id: str - :keyword is_shared_disk_virtual_node: A value indicating whether this represents virtual entity - hosting all the shared disks. - :paramtype is_shared_disk_virtual_node: bool - """ - super().__init__(**kwargs) - self.cluster_node_fqdn = cluster_node_fqdn - self.machine_id = machine_id - self.bios_id = bios_id - self.is_shared_disk_virtual_node = is_shared_disk_virtual_node - - -class RemoveDisksInput(_serialization.Model): - """Input for remove disk(s) operation. - - :ivar properties: Remove disk input properties. - :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.RemoveDisksInputProperties - """ - - _attribute_map = { - "properties": {"key": "properties", "type": "RemoveDisksInputProperties"}, - } - - def __init__(self, *, properties: Optional["_models.RemoveDisksInputProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Remove disk input properties. - :paramtype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.RemoveDisksInputProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class RemoveDisksInputProperties(_serialization.Model): - """Remove Disk input properties. - - :ivar provider_specific_details: The ReplicationProviderInput. For HyperVReplicaAzure provider, - it will be AzureEnableProtectionInput object. For San provider, it will be - SanEnableProtectionInput object. For HyperVReplicaAzure provider, it can be null. - :vartype provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.RemoveDisksProviderSpecificInput - """ - - _attribute_map = { - "provider_specific_details": {"key": "providerSpecificDetails", "type": "RemoveDisksProviderSpecificInput"}, - } - - def __init__( - self, *, provider_specific_details: Optional["_models.RemoveDisksProviderSpecificInput"] = None, **kwargs: Any - ) -> None: - """ - :keyword provider_specific_details: The ReplicationProviderInput. For HyperVReplicaAzure - provider, it will be AzureEnableProtectionInput object. For San provider, it will be - SanEnableProtectionInput object. For HyperVReplicaAzure provider, it can be null. - :paramtype provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.RemoveDisksProviderSpecificInput - """ - super().__init__(**kwargs) - self.provider_specific_details = provider_specific_details - - -class RemoveProtectionContainerMappingInput(_serialization.Model): - """Container unpairing input. - - :ivar properties: Configure protection input properties. - :vartype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.RemoveProtectionContainerMappingInputProperties - """ - - _attribute_map = { - "properties": {"key": "properties", "type": "RemoveProtectionContainerMappingInputProperties"}, - } - - def __init__( - self, *, properties: Optional["_models.RemoveProtectionContainerMappingInputProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: Configure protection input properties. - :paramtype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.RemoveProtectionContainerMappingInputProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class RemoveProtectionContainerMappingInputProperties(_serialization.Model): # pylint: disable=name-too-long - """Unpairing input properties. - - :ivar provider_specific_input: Provider specific input for unpairing. - :vartype provider_specific_input: - ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProviderContainerUnmappingInput - """ - - _attribute_map = { - "provider_specific_input": { - "key": "providerSpecificInput", - "type": "ReplicationProviderContainerUnmappingInput", - }, - } - - def __init__( - self, - *, - provider_specific_input: Optional["_models.ReplicationProviderContainerUnmappingInput"] = None, - **kwargs: Any - ) -> None: - """ - :keyword provider_specific_input: Provider specific input for unpairing. - :paramtype provider_specific_input: - ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProviderContainerUnmappingInput - """ - super().__init__(**kwargs) - self.provider_specific_input = provider_specific_input - - -class RenewCertificateInput(_serialization.Model): - """Certificate renewal input. - - :ivar properties: Renew certificate input properties. - :vartype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.RenewCertificateInputProperties - """ - - _attribute_map = { - "properties": {"key": "properties", "type": "RenewCertificateInputProperties"}, - } - - def __init__( - self, *, properties: Optional["_models.RenewCertificateInputProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: Renew certificate input properties. - :paramtype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.RenewCertificateInputProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class RenewCertificateInputProperties(_serialization.Model): - """Renew Certificate input properties. - - :ivar renew_certificate_type: Renew certificate type. - :vartype renew_certificate_type: str - """ - - _attribute_map = { - "renew_certificate_type": {"key": "renewCertificateType", "type": "str"}, - } - - def __init__(self, *, renew_certificate_type: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword renew_certificate_type: Renew certificate type. - :paramtype renew_certificate_type: str - """ - super().__init__(**kwargs) - self.renew_certificate_type = renew_certificate_type - - -class ReplicationAgentDetails(_serialization.Model): - """Replication agent details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The replication agent Id. - :vartype id: str - :ivar name: The replication agent name. - :vartype name: str - :ivar bios_id: The replication agent Bios Id. - :vartype bios_id: str - :ivar fabric_object_id: The fabric object Id. - :vartype fabric_object_id: str - :ivar fqdn: The replication agent Fqdn. - :vartype fqdn: str - :ivar version: The version. - :vartype version: str - :ivar last_heartbeat_utc: The last heartbeat received from the replication agent. - :vartype last_heartbeat_utc: ~datetime.datetime - :ivar health: The health of the replication agent. Known values are: "None", "Normal", - "Warning", and "Critical". - :vartype health: str or ~azure.mgmt.recoveryservicessiterecovery.models.ProtectionHealth - :ivar health_errors: The health errors. - :vartype health_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "bios_id": {"readonly": True}, - "fabric_object_id": {"readonly": True}, - "fqdn": {"readonly": True}, - "version": {"readonly": True}, - "last_heartbeat_utc": {"readonly": True}, - "health": {"readonly": True}, - "health_errors": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "bios_id": {"key": "biosId", "type": "str"}, - "fabric_object_id": {"key": "fabricObjectId", "type": "str"}, - "fqdn": {"key": "fqdn", "type": "str"}, - "version": {"key": "version", "type": "str"}, - "last_heartbeat_utc": {"key": "lastHeartbeatUtc", "type": "iso-8601"}, - "health": {"key": "health", "type": "str"}, - "health_errors": {"key": "healthErrors", "type": "[HealthError]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.id: Optional[str] = None - self.name: Optional[str] = None - self.bios_id: Optional[str] = None - self.fabric_object_id: Optional[str] = None - self.fqdn: Optional[str] = None - self.version: Optional[str] = None - self.last_heartbeat_utc: Optional[datetime.datetime] = None - self.health: Optional[Union[str, "_models.ProtectionHealth"]] = None - self.health_errors: Optional[List["_models.HealthError"]] = None - - -class ReplicationAppliance(_serialization.Model): - """Replication appliance definition. - - :ivar properties: Appliance related data. - :vartype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationApplianceProperties - """ - - _attribute_map = { - "properties": {"key": "properties", "type": "ReplicationApplianceProperties"}, - } - - def __init__(self, *, properties: Optional["_models.ReplicationApplianceProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Appliance related data. - :paramtype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationApplianceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ReplicationApplianceProperties(_serialization.Model): - """Replication appliance properties. - - :ivar provider_specific_details: Provider specific settings. - :vartype provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.ApplianceSpecificDetails - """ - - _attribute_map = { - "provider_specific_details": {"key": "providerSpecificDetails", "type": "ApplianceSpecificDetails"}, - } - - def __init__( - self, *, provider_specific_details: Optional["_models.ApplianceSpecificDetails"] = None, **kwargs: Any - ) -> None: - """ - :keyword provider_specific_details: Provider specific settings. - :paramtype provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.ApplianceSpecificDetails - """ - super().__init__(**kwargs) - self.provider_specific_details = provider_specific_details - - -class ReplicationEligibilityResults(_serialization.Model): - """Replication eligibility results response model. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Gets the name of this object. - :vartype name: str - :ivar type: Gets the object type. - :vartype type: str - :ivar id: Gets Unique ARM identifier for this object. - :vartype id: str - :ivar properties: Gets properties model for replication eligibility results API. - :vartype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationEligibilityResultsProperties - """ - - _validation = { - "name": {"readonly": True}, - "type": {"readonly": True}, - "id": {"readonly": True}, - "properties": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "id": {"key": "id", "type": "str"}, - "properties": {"key": "properties", "type": "ReplicationEligibilityResultsProperties"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name: Optional[str] = None - self.type: Optional[str] = None - self.id: Optional[str] = None - self.properties: Optional["_models.ReplicationEligibilityResultsProperties"] = None - - -class ReplicationEligibilityResultsCollection(_serialization.Model): - """Replication eligibility results collection response model. - - :ivar value: The replication eligibility results details. - :vartype value: - list[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationEligibilityResults] - """ - - _attribute_map = { - "value": {"key": "value", "type": "[ReplicationEligibilityResults]"}, - } - - def __init__(self, *, value: Optional[List["_models.ReplicationEligibilityResults"]] = None, **kwargs: Any) -> None: - """ - :keyword value: The replication eligibility results details. - :paramtype value: - list[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationEligibilityResults] - """ - super().__init__(**kwargs) - self.value = value - - -class ReplicationEligibilityResultsErrorInfo(_serialization.Model): - """Error model that can be exposed to the user. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar code: The error code. - :vartype code: str - :ivar message: The error message. - :vartype message: str - :ivar possible_causes: The possible causes. - :vartype possible_causes: str - :ivar recommended_action: The recommended action. - :vartype recommended_action: str - :ivar status: The error status. - :vartype status: str - """ - - _validation = { - "status": {"readonly": True}, - } - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - "possible_causes": {"key": "possibleCauses", "type": "str"}, - "recommended_action": {"key": "recommendedAction", "type": "str"}, - "status": {"key": "status", "type": "str"}, - } - - def __init__( - self, - *, - code: Optional[str] = None, - message: Optional[str] = None, - possible_causes: Optional[str] = None, - recommended_action: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword code: The error code. - :paramtype code: str - :keyword message: The error message. - :paramtype message: str - :keyword possible_causes: The possible causes. - :paramtype possible_causes: str - :keyword recommended_action: The recommended action. - :paramtype recommended_action: str - """ - super().__init__(**kwargs) - self.code = code - self.message = message - self.possible_causes = possible_causes - self.recommended_action = recommended_action - self.status: Optional[str] = None - - -class ReplicationEligibilityResultsProperties(_serialization.Model): - """Properties model for replication eligibility results API. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar client_request_id: The client request Id. - :vartype client_request_id: str - :ivar errors: The error details. - :vartype errors: - list[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationEligibilityResultsErrorInfo] - """ - - _validation = { - "client_request_id": {"readonly": True}, - } - - _attribute_map = { - "client_request_id": {"key": "clientRequestId", "type": "str"}, - "errors": {"key": "errors", "type": "[ReplicationEligibilityResultsErrorInfo]"}, - } - - def __init__( - self, *, errors: Optional[List["_models.ReplicationEligibilityResultsErrorInfo"]] = None, **kwargs: Any - ) -> None: - """ - :keyword errors: The error details. - :paramtype errors: - list[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationEligibilityResultsErrorInfo] - """ - super().__init__(**kwargs) - self.client_request_id: Optional[str] = None - self.errors = errors - - -class ReplicationGroupDetails(ConfigurationSettings): - """Replication group details. This will be used in case of San. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: Gets the class type. Overridden in derived classes. Required. - :vartype instance_type: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.instance_type: str = "ReplicationGroupDetails" - - -class ReplicationProtectedItem(Resource): - """Replication protected item. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :ivar type: Resource Type. - :vartype type: str - :ivar location: Resource Location. - :vartype location: str - :ivar properties: The custom data. - :vartype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItemProperties - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "properties": {"key": "properties", "type": "ReplicationProtectedItemProperties"}, - } - - def __init__( - self, - *, - location: Optional[str] = None, - properties: Optional["_models.ReplicationProtectedItemProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword location: Resource Location. - :paramtype location: str - :keyword properties: The custom data. - :paramtype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItemProperties - """ - super().__init__(location=location, **kwargs) - self.properties = properties - - -class ReplicationProtectedItemCollection(_serialization.Model): - """Replication protected item collection. - - :ivar value: The Replication protected item details. - :vartype value: list[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :ivar next_link: The value of next link. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[ReplicationProtectedItem]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.ReplicationProtectedItem"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The Replication protected item details. - :paramtype value: - list[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :keyword next_link: The value of next link. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ReplicationProtectedItemProperties(_serialization.Model): - """Replication protected item custom data details. - - :ivar friendly_name: The name. - :vartype friendly_name: str - :ivar protected_item_type: The type of protected item type. - :vartype protected_item_type: str - :ivar protectable_item_id: The protected item ARM Id. - :vartype protectable_item_id: str - :ivar recovery_services_provider_id: The recovery provider ARM Id. - :vartype recovery_services_provider_id: str - :ivar primary_fabric_friendly_name: The friendly name of the primary fabric. - :vartype primary_fabric_friendly_name: str - :ivar primary_fabric_provider: The fabric provider of the primary fabric. - :vartype primary_fabric_provider: str - :ivar recovery_fabric_friendly_name: The friendly name of recovery fabric. - :vartype recovery_fabric_friendly_name: str - :ivar recovery_fabric_id: The Arm Id of recovery fabric. - :vartype recovery_fabric_id: str - :ivar primary_protection_container_friendly_name: The name of primary protection container - friendly name. - :vartype primary_protection_container_friendly_name: str - :ivar recovery_protection_container_friendly_name: The name of recovery container friendly - name. - :vartype recovery_protection_container_friendly_name: str - :ivar protection_state: The protection status. - :vartype protection_state: str - :ivar protection_state_description: The protection state description. - :vartype protection_state_description: str - :ivar active_location: The Current active location of the PE. - :vartype active_location: str - :ivar test_failover_state: The Test failover state. - :vartype test_failover_state: str - :ivar test_failover_state_description: The Test failover state description. - :vartype test_failover_state_description: str - :ivar switch_provider_state: The switch provider state. - :vartype switch_provider_state: str - :ivar switch_provider_state_description: The switch provider state description. - :vartype switch_provider_state_description: str - :ivar allowed_operations: The allowed operations on the Replication protected item. - :vartype allowed_operations: list[str] - :ivar replication_health: The consolidated protection health for the VM taking any issues with - SRS as well as all the replication units associated with the VM's replication group into - account. This is a string representation of the ProtectionHealth enumeration. - :vartype replication_health: str - :ivar failover_health: The consolidated failover health for the VM. - :vartype failover_health: str - :ivar health_errors: List of health errors. - :vartype health_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] - :ivar policy_id: The ID of Policy governing this PE. - :vartype policy_id: str - :ivar policy_friendly_name: The name of Policy governing this PE. - :vartype policy_friendly_name: str - :ivar last_successful_failover_time: The Last successful failover time. - :vartype last_successful_failover_time: ~datetime.datetime - :ivar last_successful_test_failover_time: The Last successful test failover time. - :vartype last_successful_test_failover_time: ~datetime.datetime - :ivar current_scenario: The current scenario. - :vartype current_scenario: - ~azure.mgmt.recoveryservicessiterecovery.models.CurrentScenarioDetails - :ivar failover_recovery_point_id: The recovery point ARM Id to which the Vm was failed over. - :vartype failover_recovery_point_id: str - :ivar provider_specific_details: The Replication provider custom settings. - :vartype provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProviderSpecificSettings - :ivar recovery_container_id: The recovery container Id. - :vartype recovery_container_id: str - :ivar event_correlation_id: The correlation Id for events associated with this protected item. - :vartype event_correlation_id: str - """ - - _attribute_map = { - "friendly_name": {"key": "friendlyName", "type": "str"}, - "protected_item_type": {"key": "protectedItemType", "type": "str"}, - "protectable_item_id": {"key": "protectableItemId", "type": "str"}, - "recovery_services_provider_id": {"key": "recoveryServicesProviderId", "type": "str"}, - "primary_fabric_friendly_name": {"key": "primaryFabricFriendlyName", "type": "str"}, - "primary_fabric_provider": {"key": "primaryFabricProvider", "type": "str"}, - "recovery_fabric_friendly_name": {"key": "recoveryFabricFriendlyName", "type": "str"}, - "recovery_fabric_id": {"key": "recoveryFabricId", "type": "str"}, - "primary_protection_container_friendly_name": {"key": "primaryProtectionContainerFriendlyName", "type": "str"}, - "recovery_protection_container_friendly_name": { - "key": "recoveryProtectionContainerFriendlyName", - "type": "str", - }, - "protection_state": {"key": "protectionState", "type": "str"}, - "protection_state_description": {"key": "protectionStateDescription", "type": "str"}, - "active_location": {"key": "activeLocation", "type": "str"}, - "test_failover_state": {"key": "testFailoverState", "type": "str"}, - "test_failover_state_description": {"key": "testFailoverStateDescription", "type": "str"}, - "switch_provider_state": {"key": "switchProviderState", "type": "str"}, - "switch_provider_state_description": {"key": "switchProviderStateDescription", "type": "str"}, - "allowed_operations": {"key": "allowedOperations", "type": "[str]"}, - "replication_health": {"key": "replicationHealth", "type": "str"}, - "failover_health": {"key": "failoverHealth", "type": "str"}, - "health_errors": {"key": "healthErrors", "type": "[HealthError]"}, - "policy_id": {"key": "policyId", "type": "str"}, - "policy_friendly_name": {"key": "policyFriendlyName", "type": "str"}, - "last_successful_failover_time": {"key": "lastSuccessfulFailoverTime", "type": "iso-8601"}, - "last_successful_test_failover_time": {"key": "lastSuccessfulTestFailoverTime", "type": "iso-8601"}, - "current_scenario": {"key": "currentScenario", "type": "CurrentScenarioDetails"}, - "failover_recovery_point_id": {"key": "failoverRecoveryPointId", "type": "str"}, - "provider_specific_details": {"key": "providerSpecificDetails", "type": "ReplicationProviderSpecificSettings"}, - "recovery_container_id": {"key": "recoveryContainerId", "type": "str"}, - "event_correlation_id": {"key": "eventCorrelationId", "type": "str"}, - } - - def __init__( # pylint: disable=too-many-locals - self, - *, - friendly_name: Optional[str] = None, - protected_item_type: Optional[str] = None, - protectable_item_id: Optional[str] = None, - recovery_services_provider_id: Optional[str] = None, - primary_fabric_friendly_name: Optional[str] = None, - primary_fabric_provider: Optional[str] = None, - recovery_fabric_friendly_name: Optional[str] = None, - recovery_fabric_id: Optional[str] = None, - primary_protection_container_friendly_name: Optional[str] = None, - recovery_protection_container_friendly_name: Optional[str] = None, - protection_state: Optional[str] = None, - protection_state_description: Optional[str] = None, - active_location: Optional[str] = None, - test_failover_state: Optional[str] = None, - test_failover_state_description: Optional[str] = None, - switch_provider_state: Optional[str] = None, - switch_provider_state_description: Optional[str] = None, - allowed_operations: Optional[List[str]] = None, - replication_health: Optional[str] = None, - failover_health: Optional[str] = None, - health_errors: Optional[List["_models.HealthError"]] = None, - policy_id: Optional[str] = None, - policy_friendly_name: Optional[str] = None, - last_successful_failover_time: Optional[datetime.datetime] = None, - last_successful_test_failover_time: Optional[datetime.datetime] = None, - current_scenario: Optional["_models.CurrentScenarioDetails"] = None, - failover_recovery_point_id: Optional[str] = None, - provider_specific_details: Optional["_models.ReplicationProviderSpecificSettings"] = None, - recovery_container_id: Optional[str] = None, - event_correlation_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword friendly_name: The name. - :paramtype friendly_name: str - :keyword protected_item_type: The type of protected item type. - :paramtype protected_item_type: str - :keyword protectable_item_id: The protected item ARM Id. - :paramtype protectable_item_id: str - :keyword recovery_services_provider_id: The recovery provider ARM Id. - :paramtype recovery_services_provider_id: str - :keyword primary_fabric_friendly_name: The friendly name of the primary fabric. - :paramtype primary_fabric_friendly_name: str - :keyword primary_fabric_provider: The fabric provider of the primary fabric. - :paramtype primary_fabric_provider: str - :keyword recovery_fabric_friendly_name: The friendly name of recovery fabric. - :paramtype recovery_fabric_friendly_name: str - :keyword recovery_fabric_id: The Arm Id of recovery fabric. - :paramtype recovery_fabric_id: str - :keyword primary_protection_container_friendly_name: The name of primary protection container - friendly name. - :paramtype primary_protection_container_friendly_name: str - :keyword recovery_protection_container_friendly_name: The name of recovery container friendly - name. - :paramtype recovery_protection_container_friendly_name: str - :keyword protection_state: The protection status. - :paramtype protection_state: str - :keyword protection_state_description: The protection state description. - :paramtype protection_state_description: str - :keyword active_location: The Current active location of the PE. - :paramtype active_location: str - :keyword test_failover_state: The Test failover state. - :paramtype test_failover_state: str - :keyword test_failover_state_description: The Test failover state description. - :paramtype test_failover_state_description: str - :keyword switch_provider_state: The switch provider state. - :paramtype switch_provider_state: str - :keyword switch_provider_state_description: The switch provider state description. - :paramtype switch_provider_state_description: str - :keyword allowed_operations: The allowed operations on the Replication protected item. - :paramtype allowed_operations: list[str] - :keyword replication_health: The consolidated protection health for the VM taking any issues - with SRS as well as all the replication units associated with the VM's replication group into - account. This is a string representation of the ProtectionHealth enumeration. - :paramtype replication_health: str - :keyword failover_health: The consolidated failover health for the VM. - :paramtype failover_health: str - :keyword health_errors: List of health errors. - :paramtype health_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] - :keyword policy_id: The ID of Policy governing this PE. - :paramtype policy_id: str - :keyword policy_friendly_name: The name of Policy governing this PE. - :paramtype policy_friendly_name: str - :keyword last_successful_failover_time: The Last successful failover time. - :paramtype last_successful_failover_time: ~datetime.datetime - :keyword last_successful_test_failover_time: The Last successful test failover time. - :paramtype last_successful_test_failover_time: ~datetime.datetime - :keyword current_scenario: The current scenario. - :paramtype current_scenario: - ~azure.mgmt.recoveryservicessiterecovery.models.CurrentScenarioDetails - :keyword failover_recovery_point_id: The recovery point ARM Id to which the Vm was failed over. - :paramtype failover_recovery_point_id: str - :keyword provider_specific_details: The Replication provider custom settings. - :paramtype provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProviderSpecificSettings - :keyword recovery_container_id: The recovery container Id. - :paramtype recovery_container_id: str - :keyword event_correlation_id: The correlation Id for events associated with this protected - item. - :paramtype event_correlation_id: str - """ - super().__init__(**kwargs) - self.friendly_name = friendly_name - self.protected_item_type = protected_item_type - self.protectable_item_id = protectable_item_id - self.recovery_services_provider_id = recovery_services_provider_id - self.primary_fabric_friendly_name = primary_fabric_friendly_name - self.primary_fabric_provider = primary_fabric_provider - self.recovery_fabric_friendly_name = recovery_fabric_friendly_name - self.recovery_fabric_id = recovery_fabric_id - self.primary_protection_container_friendly_name = primary_protection_container_friendly_name - self.recovery_protection_container_friendly_name = recovery_protection_container_friendly_name - self.protection_state = protection_state - self.protection_state_description = protection_state_description - self.active_location = active_location - self.test_failover_state = test_failover_state - self.test_failover_state_description = test_failover_state_description - self.switch_provider_state = switch_provider_state - self.switch_provider_state_description = switch_provider_state_description - self.allowed_operations = allowed_operations - self.replication_health = replication_health - self.failover_health = failover_health - self.health_errors = health_errors - self.policy_id = policy_id - self.policy_friendly_name = policy_friendly_name - self.last_successful_failover_time = last_successful_failover_time - self.last_successful_test_failover_time = last_successful_test_failover_time - self.current_scenario = current_scenario - self.failover_recovery_point_id = failover_recovery_point_id - self.provider_specific_details = provider_specific_details - self.recovery_container_id = recovery_container_id - self.event_correlation_id = event_correlation_id - - -class ReplicationProtectionCluster(_serialization.Model): - """Replication protection Cluster. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The protection cluster Id. - :vartype id: str - :ivar name: The name of the protection cluster. - :vartype name: str - :ivar type: The Type of the object. - :vartype type: str - :ivar properties: The custom data. - :vartype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionClusterProperties - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "properties": {"key": "properties", "type": "ReplicationProtectionClusterProperties"}, - } - - def __init__( - self, *, properties: Optional["_models.ReplicationProtectionClusterProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: The custom data. - :paramtype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionClusterProperties - """ - super().__init__(**kwargs) - self.id: Optional[str] = None - self.name: Optional[str] = None - self.type: Optional[str] = None - self.properties = properties - - -class ReplicationProtectionClusterCollection(_serialization.Model): - """Replication protected item collection. - - :ivar value: The Replication protection cluster details. - :vartype value: - list[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster] - :ivar next_link: The value of next link. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[ReplicationProtectionCluster]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.ReplicationProtectionCluster"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The Replication protection cluster details. - :paramtype value: - list[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster] - :keyword next_link: The value of next link. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ReplicationProtectionClusterProperties(_serialization.Model): - """Replication protection cluster custom data details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar protection_cluster_type: The type of protection cluster type. - :vartype protection_cluster_type: str - :ivar primary_fabric_friendly_name: The friendly name of the primary fabric. - :vartype primary_fabric_friendly_name: str - :ivar primary_fabric_provider: The fabric provider of the primary fabric. - :vartype primary_fabric_provider: str - :ivar recovery_fabric_friendly_name: The friendly name of recovery fabric. - :vartype recovery_fabric_friendly_name: str - :ivar recovery_fabric_id: The Arm Id of recovery fabric. - :vartype recovery_fabric_id: str - :ivar primary_protection_container_friendly_name: The name of primary protection container - friendly name. - :vartype primary_protection_container_friendly_name: str - :ivar recovery_protection_container_friendly_name: The name of recovery container friendly - name. - :vartype recovery_protection_container_friendly_name: str - :ivar protection_state: The protection status. - :vartype protection_state: str - :ivar protection_state_description: The protection state description. - :vartype protection_state_description: str - :ivar active_location: The Current active location of the Protection cluster. - :vartype active_location: str - :ivar test_failover_state: The Test failover state. - :vartype test_failover_state: str - :ivar test_failover_state_description: The Test failover state description. - :vartype test_failover_state_description: str - :ivar allowed_operations: The allowed operations on the Replication protection cluster. - :vartype allowed_operations: list[str] - :ivar replication_health: The consolidated protection health for the VM taking any issues with - SRS as well as all the replication units associated with the VM's replication group into - account. This is a string representation of the ProtectionHealth enumeration. - :vartype replication_health: str - :ivar health_errors: List of health errors. - :vartype health_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] - :ivar last_successful_failover_time: The last successful failover time. - :vartype last_successful_failover_time: ~datetime.datetime - :ivar last_successful_test_failover_time: The last successful test failover time. - :vartype last_successful_test_failover_time: ~datetime.datetime - :ivar policy_friendly_name: The name of Policy governing this PE. - :vartype policy_friendly_name: str - :ivar current_scenario: The current scenario. - :vartype current_scenario: - ~azure.mgmt.recoveryservicessiterecovery.models.CurrentScenarioDetails - :ivar recovery_container_id: The recovery container Id. - :vartype recovery_container_id: str - :ivar agent_cluster_id: The Agent cluster Id. - :vartype agent_cluster_id: str - :ivar cluster_fqdn: The cluster FQDN. - :vartype cluster_fqdn: str - :ivar cluster_node_fqdns: The List of cluster Node FQDNs. - :vartype cluster_node_fqdns: list[str] - :ivar cluster_protected_item_ids: The List of Protected Item Id's. - :vartype cluster_protected_item_ids: list[str] - :ivar provisioning_state: The provisioning state of the cluster. - :vartype provisioning_state: str - :ivar are_all_cluster_nodes_registered: A value indicating whether all nodes of the cluster are - registered or not. - :vartype are_all_cluster_nodes_registered: bool - :ivar cluster_registered_nodes: The registered node details. - :vartype cluster_registered_nodes: - list[~azure.mgmt.recoveryservicessiterecovery.models.RegisteredClusterNodes] - :ivar provider_specific_details: The Replication cluster provider custom settings. - :vartype provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationClusterProviderSpecificSettings - :ivar shared_disk_properties: The shared disk properties. - :vartype shared_disk_properties: - ~azure.mgmt.recoveryservicessiterecovery.models.SharedDiskReplicationItemProperties - :ivar policy_id: The Policy Id. - :vartype policy_id: str - """ - - _validation = { - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "protection_cluster_type": {"key": "protectionClusterType", "type": "str"}, - "primary_fabric_friendly_name": {"key": "primaryFabricFriendlyName", "type": "str"}, - "primary_fabric_provider": {"key": "primaryFabricProvider", "type": "str"}, - "recovery_fabric_friendly_name": {"key": "recoveryFabricFriendlyName", "type": "str"}, - "recovery_fabric_id": {"key": "recoveryFabricId", "type": "str"}, - "primary_protection_container_friendly_name": {"key": "primaryProtectionContainerFriendlyName", "type": "str"}, - "recovery_protection_container_friendly_name": { - "key": "recoveryProtectionContainerFriendlyName", - "type": "str", - }, - "protection_state": {"key": "protectionState", "type": "str"}, - "protection_state_description": {"key": "protectionStateDescription", "type": "str"}, - "active_location": {"key": "activeLocation", "type": "str"}, - "test_failover_state": {"key": "testFailoverState", "type": "str"}, - "test_failover_state_description": {"key": "testFailoverStateDescription", "type": "str"}, - "allowed_operations": {"key": "allowedOperations", "type": "[str]"}, - "replication_health": {"key": "replicationHealth", "type": "str"}, - "health_errors": {"key": "healthErrors", "type": "[HealthError]"}, - "last_successful_failover_time": {"key": "lastSuccessfulFailoverTime", "type": "iso-8601"}, - "last_successful_test_failover_time": {"key": "lastSuccessfulTestFailoverTime", "type": "iso-8601"}, - "policy_friendly_name": {"key": "policyFriendlyName", "type": "str"}, - "current_scenario": {"key": "currentScenario", "type": "CurrentScenarioDetails"}, - "recovery_container_id": {"key": "recoveryContainerId", "type": "str"}, - "agent_cluster_id": {"key": "agentClusterId", "type": "str"}, - "cluster_fqdn": {"key": "clusterFqdn", "type": "str"}, - "cluster_node_fqdns": {"key": "clusterNodeFqdns", "type": "[str]"}, - "cluster_protected_item_ids": {"key": "clusterProtectedItemIds", "type": "[str]"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "are_all_cluster_nodes_registered": {"key": "areAllClusterNodesRegistered", "type": "bool"}, - "cluster_registered_nodes": {"key": "clusterRegisteredNodes", "type": "[RegisteredClusterNodes]"}, - "provider_specific_details": { - "key": "providerSpecificDetails", - "type": "ReplicationClusterProviderSpecificSettings", - }, - "shared_disk_properties": {"key": "sharedDiskProperties", "type": "SharedDiskReplicationItemProperties"}, - "policy_id": {"key": "policyId", "type": "str"}, - } - - def __init__( # pylint: disable=too-many-locals - self, - *, - protection_cluster_type: Optional[str] = None, - primary_fabric_friendly_name: Optional[str] = None, - primary_fabric_provider: Optional[str] = None, - recovery_fabric_friendly_name: Optional[str] = None, - recovery_fabric_id: Optional[str] = None, - primary_protection_container_friendly_name: Optional[str] = None, - recovery_protection_container_friendly_name: Optional[str] = None, - protection_state: Optional[str] = None, - protection_state_description: Optional[str] = None, - active_location: Optional[str] = None, - test_failover_state: Optional[str] = None, - test_failover_state_description: Optional[str] = None, - allowed_operations: Optional[List[str]] = None, - replication_health: Optional[str] = None, - health_errors: Optional[List["_models.HealthError"]] = None, - last_successful_failover_time: Optional[datetime.datetime] = None, - last_successful_test_failover_time: Optional[datetime.datetime] = None, - policy_friendly_name: Optional[str] = None, - current_scenario: Optional["_models.CurrentScenarioDetails"] = None, - recovery_container_id: Optional[str] = None, - agent_cluster_id: Optional[str] = None, - cluster_fqdn: Optional[str] = None, - cluster_node_fqdns: Optional[List[str]] = None, - cluster_protected_item_ids: Optional[List[str]] = None, - are_all_cluster_nodes_registered: Optional[bool] = None, - cluster_registered_nodes: Optional[List["_models.RegisteredClusterNodes"]] = None, - provider_specific_details: Optional["_models.ReplicationClusterProviderSpecificSettings"] = None, - shared_disk_properties: Optional["_models.SharedDiskReplicationItemProperties"] = None, - policy_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword protection_cluster_type: The type of protection cluster type. - :paramtype protection_cluster_type: str - :keyword primary_fabric_friendly_name: The friendly name of the primary fabric. - :paramtype primary_fabric_friendly_name: str - :keyword primary_fabric_provider: The fabric provider of the primary fabric. - :paramtype primary_fabric_provider: str - :keyword recovery_fabric_friendly_name: The friendly name of recovery fabric. - :paramtype recovery_fabric_friendly_name: str - :keyword recovery_fabric_id: The Arm Id of recovery fabric. - :paramtype recovery_fabric_id: str - :keyword primary_protection_container_friendly_name: The name of primary protection container - friendly name. - :paramtype primary_protection_container_friendly_name: str - :keyword recovery_protection_container_friendly_name: The name of recovery container friendly - name. - :paramtype recovery_protection_container_friendly_name: str - :keyword protection_state: The protection status. - :paramtype protection_state: str - :keyword protection_state_description: The protection state description. - :paramtype protection_state_description: str - :keyword active_location: The Current active location of the Protection cluster. - :paramtype active_location: str - :keyword test_failover_state: The Test failover state. - :paramtype test_failover_state: str - :keyword test_failover_state_description: The Test failover state description. - :paramtype test_failover_state_description: str - :keyword allowed_operations: The allowed operations on the Replication protection cluster. - :paramtype allowed_operations: list[str] - :keyword replication_health: The consolidated protection health for the VM taking any issues - with SRS as well as all the replication units associated with the VM's replication group into - account. This is a string representation of the ProtectionHealth enumeration. - :paramtype replication_health: str - :keyword health_errors: List of health errors. - :paramtype health_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] - :keyword last_successful_failover_time: The last successful failover time. - :paramtype last_successful_failover_time: ~datetime.datetime - :keyword last_successful_test_failover_time: The last successful test failover time. - :paramtype last_successful_test_failover_time: ~datetime.datetime - :keyword policy_friendly_name: The name of Policy governing this PE. - :paramtype policy_friendly_name: str - :keyword current_scenario: The current scenario. - :paramtype current_scenario: - ~azure.mgmt.recoveryservicessiterecovery.models.CurrentScenarioDetails - :keyword recovery_container_id: The recovery container Id. - :paramtype recovery_container_id: str - :keyword agent_cluster_id: The Agent cluster Id. - :paramtype agent_cluster_id: str - :keyword cluster_fqdn: The cluster FQDN. - :paramtype cluster_fqdn: str - :keyword cluster_node_fqdns: The List of cluster Node FQDNs. - :paramtype cluster_node_fqdns: list[str] - :keyword cluster_protected_item_ids: The List of Protected Item Id's. - :paramtype cluster_protected_item_ids: list[str] - :keyword are_all_cluster_nodes_registered: A value indicating whether all nodes of the cluster - are registered or not. - :paramtype are_all_cluster_nodes_registered: bool - :keyword cluster_registered_nodes: The registered node details. - :paramtype cluster_registered_nodes: - list[~azure.mgmt.recoveryservicessiterecovery.models.RegisteredClusterNodes] - :keyword provider_specific_details: The Replication cluster provider custom settings. - :paramtype provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationClusterProviderSpecificSettings - :keyword shared_disk_properties: The shared disk properties. - :paramtype shared_disk_properties: - ~azure.mgmt.recoveryservicessiterecovery.models.SharedDiskReplicationItemProperties - :keyword policy_id: The Policy Id. - :paramtype policy_id: str - """ - super().__init__(**kwargs) - self.protection_cluster_type = protection_cluster_type - self.primary_fabric_friendly_name = primary_fabric_friendly_name - self.primary_fabric_provider = primary_fabric_provider - self.recovery_fabric_friendly_name = recovery_fabric_friendly_name - self.recovery_fabric_id = recovery_fabric_id - self.primary_protection_container_friendly_name = primary_protection_container_friendly_name - self.recovery_protection_container_friendly_name = recovery_protection_container_friendly_name - self.protection_state = protection_state - self.protection_state_description = protection_state_description - self.active_location = active_location - self.test_failover_state = test_failover_state - self.test_failover_state_description = test_failover_state_description - self.allowed_operations = allowed_operations - self.replication_health = replication_health - self.health_errors = health_errors - self.last_successful_failover_time = last_successful_failover_time - self.last_successful_test_failover_time = last_successful_test_failover_time - self.policy_friendly_name = policy_friendly_name - self.current_scenario = current_scenario - self.recovery_container_id = recovery_container_id - self.agent_cluster_id = agent_cluster_id - self.cluster_fqdn = cluster_fqdn - self.cluster_node_fqdns = cluster_node_fqdns - self.cluster_protected_item_ids = cluster_protected_item_ids - self.provisioning_state: Optional[str] = None - self.are_all_cluster_nodes_registered = are_all_cluster_nodes_registered - self.cluster_registered_nodes = cluster_registered_nodes - self.provider_specific_details = provider_specific_details - self.shared_disk_properties = shared_disk_properties - self.policy_id = policy_id - - -class ReplicationProtectionIntent(Resource): - """Replication protection intent. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :ivar type: Resource Type. - :vartype type: str - :ivar location: Resource Location. - :vartype location: str - :ivar properties: The custom data. - :vartype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionIntentProperties - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "properties": {"key": "properties", "type": "ReplicationProtectionIntentProperties"}, - } - - def __init__( - self, - *, - location: Optional[str] = None, - properties: Optional["_models.ReplicationProtectionIntentProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword location: Resource Location. - :paramtype location: str - :keyword properties: The custom data. - :paramtype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionIntentProperties - """ - super().__init__(location=location, **kwargs) - self.properties = properties - - -class ReplicationProtectionIntentCollection(_serialization.Model): - """Replication protection intent objects collection. - - :ivar value: The Replication protection intent details. - :vartype value: - list[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionIntent] - :ivar next_link: The value of next link. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[ReplicationProtectionIntent]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.ReplicationProtectionIntent"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The Replication protection intent details. - :paramtype value: - list[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionIntent] - :keyword next_link: The value of next link. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ReplicationProtectionIntentProperties(_serialization.Model): - """Replication protection intent custom data details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar friendly_name: The name. - :vartype friendly_name: str - :ivar job_id: The job Id. - :vartype job_id: str - :ivar job_state: The job state. - :vartype job_state: str - :ivar is_active: A value indicating whether the intent object is active. - :vartype is_active: bool - :ivar creation_time_utc: The creation time in UTC. - :vartype creation_time_utc: str - :ivar provider_specific_details: The Replication provider custom settings. - :vartype provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionIntentProviderSpecificSettings - """ - - _validation = { - "job_id": {"readonly": True}, - "job_state": {"readonly": True}, - "is_active": {"readonly": True}, - "creation_time_utc": {"readonly": True}, - } - - _attribute_map = { - "friendly_name": {"key": "friendlyName", "type": "str"}, - "job_id": {"key": "jobId", "type": "str"}, - "job_state": {"key": "jobState", "type": "str"}, - "is_active": {"key": "isActive", "type": "bool"}, - "creation_time_utc": {"key": "creationTimeUTC", "type": "str"}, - "provider_specific_details": { - "key": "providerSpecificDetails", - "type": "ReplicationProtectionIntentProviderSpecificSettings", - }, - } - - def __init__( - self, - *, - friendly_name: Optional[str] = None, - provider_specific_details: Optional["_models.ReplicationProtectionIntentProviderSpecificSettings"] = None, - **kwargs: Any - ) -> None: - """ - :keyword friendly_name: The name. - :paramtype friendly_name: str - :keyword provider_specific_details: The Replication provider custom settings. - :paramtype provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionIntentProviderSpecificSettings - """ - super().__init__(**kwargs) - self.friendly_name = friendly_name - self.job_id: Optional[str] = None - self.job_state: Optional[str] = None - self.is_active: Optional[bool] = None - self.creation_time_utc: Optional[str] = None - self.provider_specific_details = provider_specific_details - - -class ReplicationProviderContainerUnmappingInput(_serialization.Model): # pylint: disable=name-too-long - """Provider specific input for unpairing operations. - - :ivar instance_type: The class type. - :vartype instance_type: str - """ - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - } - - def __init__(self, *, instance_type: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword instance_type: The class type. - :paramtype instance_type: str - """ - super().__init__(**kwargs) - self.instance_type = instance_type - - -class ReprotectAgentDetails(_serialization.Model): - """Reprotect agent details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The reprotect agent Id. - :vartype id: str - :ivar name: The reprotect agent name. - :vartype name: str - :ivar bios_id: The reprotect agent Bios Id. - :vartype bios_id: str - :ivar fabric_object_id: The fabric object Id. - :vartype fabric_object_id: str - :ivar fqdn: The reprotect agent Fqdn. - :vartype fqdn: str - :ivar version: The version. - :vartype version: str - :ivar last_heartbeat_utc: The last heartbeat received from the reprotect agent. - :vartype last_heartbeat_utc: ~datetime.datetime - :ivar health: The health of the reprotect agent. Known values are: "None", "Normal", "Warning", - and "Critical". - :vartype health: str or ~azure.mgmt.recoveryservicessiterecovery.models.ProtectionHealth - :ivar health_errors: The health errors. - :vartype health_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] - :ivar protected_item_count: The protected item count. - :vartype protected_item_count: int - :ivar accessible_datastores: The list of accessible datastores fetched from discovery. - :vartype accessible_datastores: list[str] - :ivar vcenter_id: The Vcenter Id. - :vartype vcenter_id: str - :ivar last_discovery_in_utc: The last time when SDS information discovered in SRS. - :vartype last_discovery_in_utc: ~datetime.datetime - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "bios_id": {"readonly": True}, - "fabric_object_id": {"readonly": True}, - "fqdn": {"readonly": True}, - "version": {"readonly": True}, - "last_heartbeat_utc": {"readonly": True}, - "health": {"readonly": True}, - "health_errors": {"readonly": True}, - "protected_item_count": {"readonly": True}, - "accessible_datastores": {"readonly": True}, - "vcenter_id": {"readonly": True}, - "last_discovery_in_utc": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "bios_id": {"key": "biosId", "type": "str"}, - "fabric_object_id": {"key": "fabricObjectId", "type": "str"}, - "fqdn": {"key": "fqdn", "type": "str"}, - "version": {"key": "version", "type": "str"}, - "last_heartbeat_utc": {"key": "lastHeartbeatUtc", "type": "iso-8601"}, - "health": {"key": "health", "type": "str"}, - "health_errors": {"key": "healthErrors", "type": "[HealthError]"}, - "protected_item_count": {"key": "protectedItemCount", "type": "int"}, - "accessible_datastores": {"key": "accessibleDatastores", "type": "[str]"}, - "vcenter_id": {"key": "vcenterId", "type": "str"}, - "last_discovery_in_utc": {"key": "lastDiscoveryInUtc", "type": "iso-8601"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.id: Optional[str] = None - self.name: Optional[str] = None - self.bios_id: Optional[str] = None - self.fabric_object_id: Optional[str] = None - self.fqdn: Optional[str] = None - self.version: Optional[str] = None - self.last_heartbeat_utc: Optional[datetime.datetime] = None - self.health: Optional[Union[str, "_models.ProtectionHealth"]] = None - self.health_errors: Optional[List["_models.HealthError"]] = None - self.protected_item_count: Optional[int] = None - self.accessible_datastores: Optional[List[str]] = None - self.vcenter_id: Optional[str] = None - self.last_discovery_in_utc: Optional[datetime.datetime] = None - - -class ResolveHealthError(_serialization.Model): - """Resolve health errors input properties. - - :ivar health_error_id: Health error id. - :vartype health_error_id: str - """ - - _attribute_map = { - "health_error_id": {"key": "healthErrorId", "type": "str"}, - } - - def __init__(self, *, health_error_id: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword health_error_id: Health error id. - :paramtype health_error_id: str - """ - super().__init__(**kwargs) - self.health_error_id = health_error_id - - -class ResolveHealthInput(_serialization.Model): - """Resolve health input. - - :ivar properties: Disable resolve health input properties. - :vartype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.ResolveHealthInputProperties - """ - - _attribute_map = { - "properties": {"key": "properties", "type": "ResolveHealthInputProperties"}, - } - - def __init__(self, *, properties: Optional["_models.ResolveHealthInputProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Disable resolve health input properties. - :paramtype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.ResolveHealthInputProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ResolveHealthInputProperties(_serialization.Model): - """Resolve health input properties. - - :ivar health_errors: Health errors. - :vartype health_errors: - list[~azure.mgmt.recoveryservicessiterecovery.models.ResolveHealthError] - """ - - _attribute_map = { - "health_errors": {"key": "healthErrors", "type": "[ResolveHealthError]"}, - } - - def __init__(self, *, health_errors: Optional[List["_models.ResolveHealthError"]] = None, **kwargs: Any) -> None: - """ - :keyword health_errors: Health errors. - :paramtype health_errors: - list[~azure.mgmt.recoveryservicessiterecovery.models.ResolveHealthError] - """ - super().__init__(**kwargs) - self.health_errors = health_errors - - -class ResourceHealthSummary(_serialization.Model): - """Base class to define the health summary of the resources contained under an Arm resource. - - :ivar resource_count: The count of total resources under the container. - :vartype resource_count: int - :ivar issues: The list of summary of health errors across the resources under the container. - :vartype issues: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthErrorSummary] - :ivar categorized_resource_counts: The categorized resource counts. - :vartype categorized_resource_counts: dict[str, int] - """ - - _attribute_map = { - "resource_count": {"key": "resourceCount", "type": "int"}, - "issues": {"key": "issues", "type": "[HealthErrorSummary]"}, - "categorized_resource_counts": {"key": "categorizedResourceCounts", "type": "{int}"}, - } - - def __init__( - self, - *, - resource_count: Optional[int] = None, - issues: Optional[List["_models.HealthErrorSummary"]] = None, - categorized_resource_counts: Optional[Dict[str, int]] = None, - **kwargs: Any - ) -> None: - """ - :keyword resource_count: The count of total resources under the container. - :paramtype resource_count: int - :keyword issues: The list of summary of health errors across the resources under the container. - :paramtype issues: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthErrorSummary] - :keyword categorized_resource_counts: The categorized resource counts. - :paramtype categorized_resource_counts: dict[str, int] - """ - super().__init__(**kwargs) - self.resource_count = resource_count - self.issues = issues - self.categorized_resource_counts = categorized_resource_counts - - -class ResumeJobParams(_serialization.Model): - """Resume job params. - - :ivar properties: Resume job properties. - :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.ResumeJobParamsProperties - """ - - _attribute_map = { - "properties": {"key": "properties", "type": "ResumeJobParamsProperties"}, - } - - def __init__(self, *, properties: Optional["_models.ResumeJobParamsProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Resume job properties. - :paramtype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.ResumeJobParamsProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ResumeJobParamsProperties(_serialization.Model): - """Resume job properties. - - :ivar comments: Resume job comments. - :vartype comments: str - """ - - _attribute_map = { - "comments": {"key": "comments", "type": "str"}, - } - - def __init__(self, *, comments: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword comments: Resume job comments. - :paramtype comments: str - """ - super().__init__(**kwargs) - self.comments = comments - - -class ResumeReplicationInput(_serialization.Model): - """Resume replication input. - - All required parameters must be populated in order to send to server. - - :ivar properties: Resume replication input properties. Required. - :vartype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.ResumeReplicationInputProperties - """ - - _validation = { - "properties": {"required": True}, - } - - _attribute_map = { - "properties": {"key": "properties", "type": "ResumeReplicationInputProperties"}, - } - - def __init__(self, *, properties: "_models.ResumeReplicationInputProperties", **kwargs: Any) -> None: - """ - :keyword properties: Resume replication input properties. Required. - :paramtype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.ResumeReplicationInputProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ResumeReplicationInputProperties(_serialization.Model): - """Resume replication input properties. - - All required parameters must be populated in order to send to server. - - :ivar provider_specific_details: The provider specific input for resume replication. Required. - :vartype provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.ResumeReplicationProviderSpecificInput - """ - - _validation = { - "provider_specific_details": {"required": True}, - } - - _attribute_map = { - "provider_specific_details": { - "key": "providerSpecificDetails", - "type": "ResumeReplicationProviderSpecificInput", - }, - } - - def __init__( - self, *, provider_specific_details: "_models.ResumeReplicationProviderSpecificInput", **kwargs: Any - ) -> None: - """ - :keyword provider_specific_details: The provider specific input for resume replication. - Required. - :paramtype provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.ResumeReplicationProviderSpecificInput - """ - super().__init__(**kwargs) - self.provider_specific_details = provider_specific_details - - -class ResumeReplicationProviderSpecificInput(_serialization.Model): - """Resume replication provider specific input. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - VMwareCbtResumeReplicationInput - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - } - - _subtype_map = {"instance_type": {"VMwareCbt": "VMwareCbtResumeReplicationInput"}} - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.instance_type: Optional[str] = None - - -class ResyncInput(_serialization.Model): - """Resync input. - - All required parameters must be populated in order to send to server. - - :ivar properties: Resync input properties. Required. - :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.ResyncInputProperties - """ - - _validation = { - "properties": {"required": True}, - } - - _attribute_map = { - "properties": {"key": "properties", "type": "ResyncInputProperties"}, - } - - def __init__(self, *, properties: "_models.ResyncInputProperties", **kwargs: Any) -> None: - """ - :keyword properties: Resync input properties. Required. - :paramtype properties: ~azure.mgmt.recoveryservicessiterecovery.models.ResyncInputProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ResyncInputProperties(_serialization.Model): - """Resync input properties. - - All required parameters must be populated in order to send to server. - - :ivar provider_specific_details: The provider specific details. Required. - :vartype provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.ResyncProviderSpecificInput - """ - - _validation = { - "provider_specific_details": {"required": True}, - } - - _attribute_map = { - "provider_specific_details": {"key": "providerSpecificDetails", "type": "ResyncProviderSpecificInput"}, - } - - def __init__(self, *, provider_specific_details: "_models.ResyncProviderSpecificInput", **kwargs: Any) -> None: - """ - :keyword provider_specific_details: The provider specific details. Required. - :paramtype provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.ResyncProviderSpecificInput - """ - super().__init__(**kwargs) - self.provider_specific_details = provider_specific_details - - -class ResyncProviderSpecificInput(_serialization.Model): - """Resync provider specific input. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - VMwareCbtResyncInput - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - } - - _subtype_map = {"instance_type": {"VMwareCbt": "VMwareCbtResyncInput"}} - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.instance_type: Optional[str] = None - - -class RetentionVolume(_serialization.Model): - """The retention details of the MT. - - :ivar volume_name: The volume name. - :vartype volume_name: str - :ivar capacity_in_bytes: The volume capacity. - :vartype capacity_in_bytes: int - :ivar free_space_in_bytes: The free space available in this volume. - :vartype free_space_in_bytes: int - :ivar threshold_percentage: The threshold percentage. - :vartype threshold_percentage: int - """ - - _attribute_map = { - "volume_name": {"key": "volumeName", "type": "str"}, - "capacity_in_bytes": {"key": "capacityInBytes", "type": "int"}, - "free_space_in_bytes": {"key": "freeSpaceInBytes", "type": "int"}, - "threshold_percentage": {"key": "thresholdPercentage", "type": "int"}, - } - - def __init__( - self, - *, - volume_name: Optional[str] = None, - capacity_in_bytes: Optional[int] = None, - free_space_in_bytes: Optional[int] = None, - threshold_percentage: Optional[int] = None, - **kwargs: Any - ) -> None: - """ - :keyword volume_name: The volume name. - :paramtype volume_name: str - :keyword capacity_in_bytes: The volume capacity. - :paramtype capacity_in_bytes: int - :keyword free_space_in_bytes: The free space available in this volume. - :paramtype free_space_in_bytes: int - :keyword threshold_percentage: The threshold percentage. - :paramtype threshold_percentage: int - """ - super().__init__(**kwargs) - self.volume_name = volume_name - self.capacity_in_bytes = capacity_in_bytes - self.free_space_in_bytes = free_space_in_bytes - self.threshold_percentage = threshold_percentage - - -class ReverseReplicationInput(_serialization.Model): - """Reverse replication input. - - :ivar properties: Reverse replication properties. - :vartype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.ReverseReplicationInputProperties - """ - - _attribute_map = { - "properties": {"key": "properties", "type": "ReverseReplicationInputProperties"}, - } - - def __init__( - self, *, properties: Optional["_models.ReverseReplicationInputProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: Reverse replication properties. - :paramtype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.ReverseReplicationInputProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ReverseReplicationInputProperties(_serialization.Model): - """Reverse replication input properties. - - :ivar failover_direction: Failover direction. - :vartype failover_direction: str - :ivar provider_specific_details: Provider specific reverse replication input. - :vartype provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.ReverseReplicationProviderSpecificInput - """ - - _attribute_map = { - "failover_direction": {"key": "failoverDirection", "type": "str"}, - "provider_specific_details": { - "key": "providerSpecificDetails", - "type": "ReverseReplicationProviderSpecificInput", - }, - } - - def __init__( - self, - *, - failover_direction: Optional[str] = None, - provider_specific_details: Optional["_models.ReverseReplicationProviderSpecificInput"] = None, - **kwargs: Any - ) -> None: - """ - :keyword failover_direction: Failover direction. - :paramtype failover_direction: str - :keyword provider_specific_details: Provider specific reverse replication input. - :paramtype provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.ReverseReplicationProviderSpecificInput - """ - super().__init__(**kwargs) - self.failover_direction = failover_direction - self.provider_specific_details = provider_specific_details - - -class RoleAssignment(_serialization.Model): - """Azure role assignment details. - - :ivar id: The ARM Id of the role assignment. - :vartype id: str - :ivar name: The name of the role assignment. - :vartype name: str - :ivar scope: Role assignment scope. - :vartype scope: str - :ivar principal_id: Principal Id. - :vartype principal_id: str - :ivar role_definition_id: Role definition id. - :vartype role_definition_id: str - """ - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "scope": {"key": "scope", "type": "str"}, - "principal_id": {"key": "principalId", "type": "str"}, - "role_definition_id": {"key": "roleDefinitionId", "type": "str"}, - } - - def __init__( - self, - *, - id: Optional[str] = None, # pylint: disable=redefined-builtin - name: Optional[str] = None, - scope: Optional[str] = None, - principal_id: Optional[str] = None, - role_definition_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: The ARM Id of the role assignment. - :paramtype id: str - :keyword name: The name of the role assignment. - :paramtype name: str - :keyword scope: Role assignment scope. - :paramtype scope: str - :keyword principal_id: Principal Id. - :paramtype principal_id: str - :keyword role_definition_id: Role definition id. - :paramtype role_definition_id: str - """ - super().__init__(**kwargs) - self.id = id - self.name = name - self.scope = scope - self.principal_id = principal_id - self.role_definition_id = role_definition_id - - -class RunAsAccount(_serialization.Model): - """CS Accounts Details. - - :ivar account_id: The CS RunAs account Id. - :vartype account_id: str - :ivar account_name: The CS RunAs account name. - :vartype account_name: str - """ - - _attribute_map = { - "account_id": {"key": "accountId", "type": "str"}, - "account_name": {"key": "accountName", "type": "str"}, - } - - def __init__(self, *, account_id: Optional[str] = None, account_name: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword account_id: The CS RunAs account Id. - :paramtype account_id: str - :keyword account_name: The CS RunAs account name. - :paramtype account_name: str - """ - super().__init__(**kwargs) - self.account_id = account_id - self.account_name = account_name - - -class ScriptActionTaskDetails(TaskTypeDetails): - """This class represents the script action task details. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The type of task details. Required. - :vartype instance_type: str - :ivar name: The name. - :vartype name: str - :ivar path: The path. - :vartype path: str - :ivar output: The output. - :vartype output: str - :ivar is_primary_side_script: A value indicating whether it is a primary side script or not. - :vartype is_primary_side_script: bool - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "path": {"key": "path", "type": "str"}, - "output": {"key": "output", "type": "str"}, - "is_primary_side_script": {"key": "isPrimarySideScript", "type": "bool"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - path: Optional[str] = None, - output: Optional[str] = None, - is_primary_side_script: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: The name. - :paramtype name: str - :keyword path: The path. - :paramtype path: str - :keyword output: The output. - :paramtype output: str - :keyword is_primary_side_script: A value indicating whether it is a primary side script or not. - :paramtype is_primary_side_script: bool - """ - super().__init__(**kwargs) - self.instance_type: str = "ScriptActionTaskDetails" - self.name = name - self.path = path - self.output = output - self.is_primary_side_script = is_primary_side_script - - -class SecurityProfileProperties(_serialization.Model): - """Security profile input. - - :ivar target_vm_security_type: The target VM security type. Known values are: "None", - "TrustedLaunch", and "ConfidentialVM". - :vartype target_vm_security_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.SecurityType - :ivar target_vm_secure_boot: A value indicating whether secure boot to be enabled. Known values - are: "Disabled" and "Enabled". - :vartype target_vm_secure_boot: str or - ~azure.mgmt.recoveryservicessiterecovery.models.SecurityConfiguration - :ivar target_vm_tpm: A value indicating whether trusted platform module to be enabled. Known - values are: "Disabled" and "Enabled". - :vartype target_vm_tpm: str or - ~azure.mgmt.recoveryservicessiterecovery.models.SecurityConfiguration - :ivar target_vm_monitoring: A value indicating whether integrity monitoring to be enabled. - Known values are: "Disabled" and "Enabled". - :vartype target_vm_monitoring: str or - ~azure.mgmt.recoveryservicessiterecovery.models.SecurityConfiguration - :ivar target_vm_confidential_encryption: A value indicating whether confidential compute - encryption to be enabled. Known values are: "Disabled" and "Enabled". - :vartype target_vm_confidential_encryption: str or - ~azure.mgmt.recoveryservicessiterecovery.models.SecurityConfiguration - """ - - _attribute_map = { - "target_vm_security_type": {"key": "targetVmSecurityType", "type": "str"}, - "target_vm_secure_boot": {"key": "targetVmSecureBoot", "type": "str"}, - "target_vm_tpm": {"key": "targetVmTpm", "type": "str"}, - "target_vm_monitoring": {"key": "targetVmMonitoring", "type": "str"}, - "target_vm_confidential_encryption": {"key": "targetVmConfidentialEncryption", "type": "str"}, - } - - def __init__( - self, - *, - target_vm_security_type: Optional[Union[str, "_models.SecurityType"]] = None, - target_vm_secure_boot: Optional[Union[str, "_models.SecurityConfiguration"]] = None, - target_vm_tpm: Optional[Union[str, "_models.SecurityConfiguration"]] = None, - target_vm_monitoring: Optional[Union[str, "_models.SecurityConfiguration"]] = None, - target_vm_confidential_encryption: Optional[Union[str, "_models.SecurityConfiguration"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword target_vm_security_type: The target VM security type. Known values are: "None", - "TrustedLaunch", and "ConfidentialVM". - :paramtype target_vm_security_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.SecurityType - :keyword target_vm_secure_boot: A value indicating whether secure boot to be enabled. Known - values are: "Disabled" and "Enabled". - :paramtype target_vm_secure_boot: str or - ~azure.mgmt.recoveryservicessiterecovery.models.SecurityConfiguration - :keyword target_vm_tpm: A value indicating whether trusted platform module to be enabled. Known - values are: "Disabled" and "Enabled". - :paramtype target_vm_tpm: str or - ~azure.mgmt.recoveryservicessiterecovery.models.SecurityConfiguration - :keyword target_vm_monitoring: A value indicating whether integrity monitoring to be enabled. - Known values are: "Disabled" and "Enabled". - :paramtype target_vm_monitoring: str or - ~azure.mgmt.recoveryservicessiterecovery.models.SecurityConfiguration - :keyword target_vm_confidential_encryption: A value indicating whether confidential compute - encryption to be enabled. Known values are: "Disabled" and "Enabled". - :paramtype target_vm_confidential_encryption: str or - ~azure.mgmt.recoveryservicessiterecovery.models.SecurityConfiguration - """ - super().__init__(**kwargs) - self.target_vm_security_type = target_vm_security_type - self.target_vm_secure_boot = target_vm_secure_boot - self.target_vm_tpm = target_vm_tpm - self.target_vm_monitoring = target_vm_monitoring - self.target_vm_confidential_encryption = target_vm_confidential_encryption - - -class ServiceError(_serialization.Model): - """ASR error model. - - :ivar code: Error code. - :vartype code: str - :ivar message: Error message. - :vartype message: str - :ivar possible_causes: Possible causes of error. - :vartype possible_causes: str - :ivar recommended_action: Recommended action to resolve error. - :vartype recommended_action: str - :ivar activity_id: Activity Id. - :vartype activity_id: str - """ - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - "possible_causes": {"key": "possibleCauses", "type": "str"}, - "recommended_action": {"key": "recommendedAction", "type": "str"}, - "activity_id": {"key": "activityId", "type": "str"}, - } - - def __init__( - self, - *, - code: Optional[str] = None, - message: Optional[str] = None, - possible_causes: Optional[str] = None, - recommended_action: Optional[str] = None, - activity_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword code: Error code. - :paramtype code: str - :keyword message: Error message. - :paramtype message: str - :keyword possible_causes: Possible causes of error. - :paramtype possible_causes: str - :keyword recommended_action: Recommended action to resolve error. - :paramtype recommended_action: str - :keyword activity_id: Activity Id. - :paramtype activity_id: str - """ - super().__init__(**kwargs) - self.code = code - self.message = message - self.possible_causes = possible_causes - self.recommended_action = recommended_action - self.activity_id = activity_id - - -class SharedDiskReplicationItemProperties(_serialization.Model): - """Shared Disk Replication item custom data details. - - :ivar protection_state: The protection state of shared disk. - :vartype protection_state: str - :ivar test_failover_state: The tfo state of shared disk. - :vartype test_failover_state: str - :ivar active_location: The Current active location of the PE. - :vartype active_location: str - :ivar allowed_operations: The allowed operations on the Replication protected item. - :vartype allowed_operations: list[str] - :ivar replication_health: The consolidated protection health for the VM taking any issues with - SRS as well as all the replication units associated with the VM's replication group into - account. This is a string representation of the ProtectionHealth enumeration. - :vartype replication_health: str - :ivar health_errors: List of health errors. - :vartype health_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] - :ivar current_scenario: The current scenario. - :vartype current_scenario: - ~azure.mgmt.recoveryservicessiterecovery.models.CurrentScenarioDetails - :ivar shared_disk_provider_specific_details: The Replication provider custom settings. - :vartype shared_disk_provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.SharedDiskReplicationProviderSpecificSettings - """ - - _attribute_map = { - "protection_state": {"key": "protectionState", "type": "str"}, - "test_failover_state": {"key": "testFailoverState", "type": "str"}, - "active_location": {"key": "activeLocation", "type": "str"}, - "allowed_operations": {"key": "allowedOperations", "type": "[str]"}, - "replication_health": {"key": "replicationHealth", "type": "str"}, - "health_errors": {"key": "healthErrors", "type": "[HealthError]"}, - "current_scenario": {"key": "currentScenario", "type": "CurrentScenarioDetails"}, - "shared_disk_provider_specific_details": { - "key": "sharedDiskProviderSpecificDetails", - "type": "SharedDiskReplicationProviderSpecificSettings", - }, - } - - def __init__( - self, - *, - protection_state: Optional[str] = None, - test_failover_state: Optional[str] = None, - active_location: Optional[str] = None, - allowed_operations: Optional[List[str]] = None, - replication_health: Optional[str] = None, - health_errors: Optional[List["_models.HealthError"]] = None, - current_scenario: Optional["_models.CurrentScenarioDetails"] = None, - shared_disk_provider_specific_details: Optional["_models.SharedDiskReplicationProviderSpecificSettings"] = None, - **kwargs: Any - ) -> None: - """ - :keyword protection_state: The protection state of shared disk. - :paramtype protection_state: str - :keyword test_failover_state: The tfo state of shared disk. - :paramtype test_failover_state: str - :keyword active_location: The Current active location of the PE. - :paramtype active_location: str - :keyword allowed_operations: The allowed operations on the Replication protected item. - :paramtype allowed_operations: list[str] - :keyword replication_health: The consolidated protection health for the VM taking any issues - with SRS as well as all the replication units associated with the VM's replication group into - account. This is a string representation of the ProtectionHealth enumeration. - :paramtype replication_health: str - :keyword health_errors: List of health errors. - :paramtype health_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] - :keyword current_scenario: The current scenario. - :paramtype current_scenario: - ~azure.mgmt.recoveryservicessiterecovery.models.CurrentScenarioDetails - :keyword shared_disk_provider_specific_details: The Replication provider custom settings. - :paramtype shared_disk_provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.SharedDiskReplicationProviderSpecificSettings - """ - super().__init__(**kwargs) - self.protection_state = protection_state - self.test_failover_state = test_failover_state - self.active_location = active_location - self.allowed_operations = allowed_operations - self.replication_health = replication_health - self.health_errors = health_errors - self.current_scenario = current_scenario - self.shared_disk_provider_specific_details = shared_disk_provider_specific_details - - -class StorageClassification(Resource): - """Storage object definition. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :ivar type: Resource Type. - :vartype type: str - :ivar location: Resource Location. - :vartype location: str - :ivar properties: Properties of the storage object. - :vartype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.StorageClassificationProperties - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "properties": {"key": "properties", "type": "StorageClassificationProperties"}, - } - - def __init__( - self, - *, - location: Optional[str] = None, - properties: Optional["_models.StorageClassificationProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword location: Resource Location. - :paramtype location: str - :keyword properties: Properties of the storage object. - :paramtype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.StorageClassificationProperties - """ - super().__init__(location=location, **kwargs) - self.properties = properties - - -class StorageClassificationCollection(_serialization.Model): - """Collection of storage details. - - :ivar value: The storage details. - :vartype value: list[~azure.mgmt.recoveryservicessiterecovery.models.StorageClassification] - :ivar next_link: The value of next link. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[StorageClassification]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.StorageClassification"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The storage details. - :paramtype value: list[~azure.mgmt.recoveryservicessiterecovery.models.StorageClassification] - :keyword next_link: The value of next link. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class StorageClassificationMapping(Resource): - """Storage mapping object. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :ivar type: Resource Type. - :vartype type: str - :ivar location: Resource Location. - :vartype location: str - :ivar properties: Properties of the storage mapping object. - :vartype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.StorageClassificationMappingProperties - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "properties": {"key": "properties", "type": "StorageClassificationMappingProperties"}, - } - - def __init__( - self, - *, - location: Optional[str] = None, - properties: Optional["_models.StorageClassificationMappingProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword location: Resource Location. - :paramtype location: str - :keyword properties: Properties of the storage mapping object. - :paramtype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.StorageClassificationMappingProperties - """ - super().__init__(location=location, **kwargs) - self.properties = properties - - -class StorageClassificationMappingCollection(_serialization.Model): - """Collection of storage mapping details. - - :ivar value: The storage details. - :vartype value: - list[~azure.mgmt.recoveryservicessiterecovery.models.StorageClassificationMapping] - :ivar next_link: The value of next link. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[StorageClassificationMapping]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.StorageClassificationMapping"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The storage details. - :paramtype value: - list[~azure.mgmt.recoveryservicessiterecovery.models.StorageClassificationMapping] - :keyword next_link: The value of next link. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class StorageClassificationMappingInput(_serialization.Model): - """Storage mapping input. - - :ivar properties: Storage mapping input properties. - :vartype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.StorageMappingInputProperties - """ - - _attribute_map = { - "properties": {"key": "properties", "type": "StorageMappingInputProperties"}, - } - - def __init__(self, *, properties: Optional["_models.StorageMappingInputProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Storage mapping input properties. - :paramtype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.StorageMappingInputProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class StorageClassificationMappingProperties(_serialization.Model): - """Storage mapping properties. - - :ivar target_storage_classification_id: Target storage object Id. - :vartype target_storage_classification_id: str - """ - - _attribute_map = { - "target_storage_classification_id": {"key": "targetStorageClassificationId", "type": "str"}, - } - - def __init__(self, *, target_storage_classification_id: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword target_storage_classification_id: Target storage object Id. - :paramtype target_storage_classification_id: str - """ - super().__init__(**kwargs) - self.target_storage_classification_id = target_storage_classification_id - - -class StorageClassificationProperties(_serialization.Model): - """Storage object properties. - - :ivar friendly_name: Friendly name of the Storage classification. - :vartype friendly_name: str - """ - - _attribute_map = { - "friendly_name": {"key": "friendlyName", "type": "str"}, - } - - def __init__(self, *, friendly_name: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword friendly_name: Friendly name of the Storage classification. - :paramtype friendly_name: str - """ - super().__init__(**kwargs) - self.friendly_name = friendly_name - - -class StorageMappingInputProperties(_serialization.Model): - """Storage mapping input properties. - - :ivar target_storage_classification_id: The ID of the storage object. - :vartype target_storage_classification_id: str - """ - - _attribute_map = { - "target_storage_classification_id": {"key": "targetStorageClassificationId", "type": "str"}, - } - - def __init__(self, *, target_storage_classification_id: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword target_storage_classification_id: The ID of the storage object. - :paramtype target_storage_classification_id: str - """ - super().__init__(**kwargs) - self.target_storage_classification_id = target_storage_classification_id - - -class Subnet(_serialization.Model): - """Subnets of the network. - - :ivar name: The subnet name. - :vartype name: str - :ivar friendly_name: The subnet friendly name. - :vartype friendly_name: str - :ivar address_list: The list of addresses for the subnet. - :vartype address_list: list[str] - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "friendly_name": {"key": "friendlyName", "type": "str"}, - "address_list": {"key": "addressList", "type": "[str]"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - friendly_name: Optional[str] = None, - address_list: Optional[List[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: The subnet name. - :paramtype name: str - :keyword friendly_name: The subnet friendly name. - :paramtype friendly_name: str - :keyword address_list: The list of addresses for the subnet. - :paramtype address_list: list[str] - """ - super().__init__(**kwargs) - self.name = name - self.friendly_name = friendly_name - self.address_list = address_list - - -class SupportedOperatingSystems(Resource): - """Supported operating systems. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :ivar type: Resource Type. - :vartype type: str - :ivar location: Resource Location. - :vartype location: str - :ivar properties: The supported operating systems properties. - :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.SupportedOSProperties - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "properties": {"key": "properties", "type": "SupportedOSProperties"}, - } - - def __init__( - self, - *, - location: Optional[str] = None, - properties: Optional["_models.SupportedOSProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword location: Resource Location. - :paramtype location: str - :keyword properties: The supported operating systems properties. - :paramtype properties: ~azure.mgmt.recoveryservicessiterecovery.models.SupportedOSProperties - """ - super().__init__(location=location, **kwargs) - self.properties = properties - - -class SupportedOSDetails(_serialization.Model): - """Supported operating system details. - - :ivar os_name: The name. - :vartype os_name: str - :ivar os_type: The type. - :vartype os_type: str - :ivar os_versions: The list of version for operating system. - :vartype os_versions: list[~azure.mgmt.recoveryservicessiterecovery.models.OSVersionWrapper] - """ - - _attribute_map = { - "os_name": {"key": "osName", "type": "str"}, - "os_type": {"key": "osType", "type": "str"}, - "os_versions": {"key": "osVersions", "type": "[OSVersionWrapper]"}, - } - - def __init__( - self, - *, - os_name: Optional[str] = None, - os_type: Optional[str] = None, - os_versions: Optional[List["_models.OSVersionWrapper"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword os_name: The name. - :paramtype os_name: str - :keyword os_type: The type. - :paramtype os_type: str - :keyword os_versions: The list of version for operating system. - :paramtype os_versions: list[~azure.mgmt.recoveryservicessiterecovery.models.OSVersionWrapper] - """ - super().__init__(**kwargs) - self.os_name = os_name - self.os_type = os_type - self.os_versions = os_versions - - -class SupportedOSProperties(_serialization.Model): - """Supported operating systems properties. - - :ivar supported_os_list: The supported operating systems property list. - :vartype supported_os_list: - list[~azure.mgmt.recoveryservicessiterecovery.models.SupportedOSProperty] - """ - - _attribute_map = { - "supported_os_list": {"key": "supportedOsList", "type": "[SupportedOSProperty]"}, - } - - def __init__( - self, *, supported_os_list: Optional[List["_models.SupportedOSProperty"]] = None, **kwargs: Any - ) -> None: - """ - :keyword supported_os_list: The supported operating systems property list. - :paramtype supported_os_list: - list[~azure.mgmt.recoveryservicessiterecovery.models.SupportedOSProperty] - """ - super().__init__(**kwargs) - self.supported_os_list = supported_os_list - - -class SupportedOSProperty(_serialization.Model): - """Supported operating systems property. - - :ivar instance_type: The replication provider type. - :vartype instance_type: str - :ivar supported_os: The list of supported operating systems. - :vartype supported_os: list[~azure.mgmt.recoveryservicessiterecovery.models.SupportedOSDetails] - """ - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "supported_os": {"key": "supportedOs", "type": "[SupportedOSDetails]"}, - } - - def __init__( - self, - *, - instance_type: Optional[str] = None, - supported_os: Optional[List["_models.SupportedOSDetails"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword instance_type: The replication provider type. - :paramtype instance_type: str - :keyword supported_os: The list of supported operating systems. - :paramtype supported_os: - list[~azure.mgmt.recoveryservicessiterecovery.models.SupportedOSDetails] - """ - super().__init__(**kwargs) - self.instance_type = instance_type - self.supported_os = supported_os - - -class SwitchClusterProtectionInput(_serialization.Model): - """Switch cluster protection input. - - :ivar properties: Switch cluster protection properties. - :vartype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.SwitchClusterProtectionInputProperties - """ - - _attribute_map = { - "properties": {"key": "properties", "type": "SwitchClusterProtectionInputProperties"}, - } - - def __init__( - self, *, properties: Optional["_models.SwitchClusterProtectionInputProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: Switch cluster protection properties. - :paramtype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.SwitchClusterProtectionInputProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class SwitchClusterProtectionInputProperties(_serialization.Model): - """Switch cluster protection input properties. - - :ivar replication_protection_cluster_name: The unique replication protection cluster name. - :vartype replication_protection_cluster_name: str - :ivar provider_specific_details: Provider specific switch protection input. - :vartype provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.SwitchClusterProtectionProviderSpecificInput - """ - - _attribute_map = { - "replication_protection_cluster_name": {"key": "replicationProtectionClusterName", "type": "str"}, - "provider_specific_details": { - "key": "providerSpecificDetails", - "type": "SwitchClusterProtectionProviderSpecificInput", - }, - } - - def __init__( - self, - *, - replication_protection_cluster_name: Optional[str] = None, - provider_specific_details: Optional["_models.SwitchClusterProtectionProviderSpecificInput"] = None, - **kwargs: Any - ) -> None: - """ - :keyword replication_protection_cluster_name: The unique replication protection cluster name. - :paramtype replication_protection_cluster_name: str - :keyword provider_specific_details: Provider specific switch protection input. - :paramtype provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.SwitchClusterProtectionProviderSpecificInput - """ - super().__init__(**kwargs) - self.replication_protection_cluster_name = replication_protection_cluster_name - self.provider_specific_details = provider_specific_details - - -class SwitchProtectionInput(_serialization.Model): - """Switch protection input. - - :ivar properties: Switch protection properties. - :vartype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.SwitchProtectionInputProperties - """ - - _attribute_map = { - "properties": {"key": "properties", "type": "SwitchProtectionInputProperties"}, - } - - def __init__( - self, *, properties: Optional["_models.SwitchProtectionInputProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: Switch protection properties. - :paramtype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.SwitchProtectionInputProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class SwitchProtectionInputProperties(_serialization.Model): - """Switch protection input properties. - - :ivar replication_protected_item_name: The unique replication protected item name. - :vartype replication_protected_item_name: str - :ivar provider_specific_details: Provider specific switch protection input. - :vartype provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.SwitchProtectionProviderSpecificInput - """ - - _attribute_map = { - "replication_protected_item_name": {"key": "replicationProtectedItemName", "type": "str"}, - "provider_specific_details": { - "key": "providerSpecificDetails", - "type": "SwitchProtectionProviderSpecificInput", - }, - } - - def __init__( - self, - *, - replication_protected_item_name: Optional[str] = None, - provider_specific_details: Optional["_models.SwitchProtectionProviderSpecificInput"] = None, - **kwargs: Any - ) -> None: - """ - :keyword replication_protected_item_name: The unique replication protected item name. - :paramtype replication_protected_item_name: str - :keyword provider_specific_details: Provider specific switch protection input. - :paramtype provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.SwitchProtectionProviderSpecificInput - """ - super().__init__(**kwargs) - self.replication_protected_item_name = replication_protected_item_name - self.provider_specific_details = provider_specific_details - - -class SwitchProtectionJobDetails(JobDetails): - """This class represents details for switch protection job. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: Gets the type of job details (see JobDetailsTypes enum for possible - values). Required. - :vartype instance_type: str - :ivar affected_object_details: The affected object properties like source server, source cloud, - target server, target cloud etc. based on the workflow object details. - :vartype affected_object_details: dict[str, str] - :ivar new_replication_protected_item_id: ARM Id of the new replication protected item. - :vartype new_replication_protected_item_id: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "affected_object_details": {"key": "affectedObjectDetails", "type": "{str}"}, - "new_replication_protected_item_id": {"key": "newReplicationProtectedItemId", "type": "str"}, - } - - def __init__( - self, - *, - affected_object_details: Optional[Dict[str, str]] = None, - new_replication_protected_item_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword affected_object_details: The affected object properties like source server, source - cloud, target server, target cloud etc. based on the workflow object details. - :paramtype affected_object_details: dict[str, str] - :keyword new_replication_protected_item_id: ARM Id of the new replication protected item. - :paramtype new_replication_protected_item_id: str - """ - super().__init__(affected_object_details=affected_object_details, **kwargs) - self.instance_type: str = "SwitchProtectionJobDetails" - self.new_replication_protected_item_id = new_replication_protected_item_id - - -class SwitchProviderInput(_serialization.Model): - """Input definition for switch provider. - - :ivar properties: Switch provider input properties. - :vartype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.SwitchProviderInputProperties - """ - - _attribute_map = { - "properties": {"key": "properties", "type": "SwitchProviderInputProperties"}, - } - - def __init__(self, *, properties: Optional["_models.SwitchProviderInputProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Switch provider input properties. - :paramtype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.SwitchProviderInputProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class SwitchProviderInputProperties(_serialization.Model): - """Input definition for switch provider input properties. - - :ivar target_instance_type: Target provider type. - :vartype target_instance_type: str - :ivar provider_specific_details: Provider specific settings. - :vartype provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.SwitchProviderSpecificInput - """ - - _attribute_map = { - "target_instance_type": {"key": "targetInstanceType", "type": "str"}, - "provider_specific_details": {"key": "providerSpecificDetails", "type": "SwitchProviderSpecificInput"}, - } - - def __init__( - self, - *, - target_instance_type: Optional[str] = None, - provider_specific_details: Optional["_models.SwitchProviderSpecificInput"] = None, - **kwargs: Any - ) -> None: - """ - :keyword target_instance_type: Target provider type. - :paramtype target_instance_type: str - :keyword provider_specific_details: Provider specific settings. - :paramtype provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.SwitchProviderSpecificInput - """ - super().__init__(**kwargs) - self.target_instance_type = target_instance_type - self.provider_specific_details = provider_specific_details - - -class TargetComputeSize(_serialization.Model): - """Represents applicable recovery vm sizes. - - :ivar id: The Id. - :vartype id: str - :ivar name: The name. - :vartype name: str - :ivar type: The Type of the object. - :vartype type: str - :ivar properties: The custom data. - :vartype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.TargetComputeSizeProperties - """ - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "properties": {"key": "properties", "type": "TargetComputeSizeProperties"}, - } - - def __init__( - self, - *, - id: Optional[str] = None, # pylint: disable=redefined-builtin - name: Optional[str] = None, - type: Optional[str] = None, - properties: Optional["_models.TargetComputeSizeProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: The Id. - :paramtype id: str - :keyword name: The name. - :paramtype name: str - :keyword type: The Type of the object. - :paramtype type: str - :keyword properties: The custom data. - :paramtype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.TargetComputeSizeProperties - """ - super().__init__(**kwargs) - self.id = id - self.name = name - self.type = type - self.properties = properties - - -class TargetComputeSizeCollection(_serialization.Model): - """Target compute size collection. - - :ivar value: The list of target compute sizes. - :vartype value: list[~azure.mgmt.recoveryservicessiterecovery.models.TargetComputeSize] - :ivar next_link: The value of next link. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[TargetComputeSize]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.TargetComputeSize"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The list of target compute sizes. - :paramtype value: list[~azure.mgmt.recoveryservicessiterecovery.models.TargetComputeSize] - :keyword next_link: The value of next link. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class TargetComputeSizeProperties(_serialization.Model): - """Represents applicable recovery vm sizes properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Target compute size name. - :vartype name: str - :ivar friendly_name: Target compute size display name. - :vartype friendly_name: str - :ivar cpu_cores_count: The maximum cpu cores count supported by target compute size. - :vartype cpu_cores_count: int - :ivar v_cpus_available: The Available vCPUs supported by target compute size. - :vartype v_cpus_available: int - :ivar memory_in_gb: The maximum memory in GB supported by target compute size. - :vartype memory_in_gb: float - :ivar max_data_disk_count: The maximum data disks count supported by target compute size. - :vartype max_data_disk_count: int - :ivar max_nics_count: The maximum Nics count supported by target compute size. - :vartype max_nics_count: int - :ivar errors: The reasons why the target compute size is not applicable for the protected item. - :vartype errors: list[~azure.mgmt.recoveryservicessiterecovery.models.ComputeSizeErrorDetails] - :ivar high_iops_supported: The value indicating whether the target compute size supports high - Iops. - :vartype high_iops_supported: str - :ivar hyper_v_generations: The supported HyperV Generations. - :vartype hyper_v_generations: list[str] - """ - - _validation = { - "v_cpus_available": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "friendly_name": {"key": "friendlyName", "type": "str"}, - "cpu_cores_count": {"key": "cpuCoresCount", "type": "int"}, - "v_cpus_available": {"key": "vCPUsAvailable", "type": "int"}, - "memory_in_gb": {"key": "memoryInGB", "type": "float"}, - "max_data_disk_count": {"key": "maxDataDiskCount", "type": "int"}, - "max_nics_count": {"key": "maxNicsCount", "type": "int"}, - "errors": {"key": "errors", "type": "[ComputeSizeErrorDetails]"}, - "high_iops_supported": {"key": "highIopsSupported", "type": "str"}, - "hyper_v_generations": {"key": "hyperVGenerations", "type": "[str]"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - friendly_name: Optional[str] = None, - cpu_cores_count: Optional[int] = None, - memory_in_gb: Optional[float] = None, - max_data_disk_count: Optional[int] = None, - max_nics_count: Optional[int] = None, - errors: Optional[List["_models.ComputeSizeErrorDetails"]] = None, - high_iops_supported: Optional[str] = None, - hyper_v_generations: Optional[List[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Target compute size name. - :paramtype name: str - :keyword friendly_name: Target compute size display name. - :paramtype friendly_name: str - :keyword cpu_cores_count: The maximum cpu cores count supported by target compute size. - :paramtype cpu_cores_count: int - :keyword memory_in_gb: The maximum memory in GB supported by target compute size. - :paramtype memory_in_gb: float - :keyword max_data_disk_count: The maximum data disks count supported by target compute size. - :paramtype max_data_disk_count: int - :keyword max_nics_count: The maximum Nics count supported by target compute size. - :paramtype max_nics_count: int - :keyword errors: The reasons why the target compute size is not applicable for the protected - item. - :paramtype errors: - list[~azure.mgmt.recoveryservicessiterecovery.models.ComputeSizeErrorDetails] - :keyword high_iops_supported: The value indicating whether the target compute size supports - high Iops. - :paramtype high_iops_supported: str - :keyword hyper_v_generations: The supported HyperV Generations. - :paramtype hyper_v_generations: list[str] - """ - super().__init__(**kwargs) - self.name = name - self.friendly_name = friendly_name - self.cpu_cores_count = cpu_cores_count - self.v_cpus_available: Optional[int] = None - self.memory_in_gb = memory_in_gb - self.max_data_disk_count = max_data_disk_count - self.max_nics_count = max_nics_count - self.errors = errors - self.high_iops_supported = high_iops_supported - self.hyper_v_generations = hyper_v_generations - - -class TestFailoverCleanupInput(_serialization.Model): - """Input definition for test failover cleanup. - - All required parameters must be populated in order to send to server. - - :ivar properties: Test failover cleanup input properties. Required. - :vartype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.TestFailoverCleanupInputProperties - """ - - _validation = { - "properties": {"required": True}, - } - - _attribute_map = { - "properties": {"key": "properties", "type": "TestFailoverCleanupInputProperties"}, - } - - def __init__(self, *, properties: "_models.TestFailoverCleanupInputProperties", **kwargs: Any) -> None: - """ - :keyword properties: Test failover cleanup input properties. Required. - :paramtype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.TestFailoverCleanupInputProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class TestFailoverCleanupInputProperties(_serialization.Model): - """Input definition for test failover cleanup input properties. - - :ivar comments: Test failover cleanup comments. - :vartype comments: str - """ - - _validation = { - "comments": {"max_length": 1024}, - } - - _attribute_map = { - "comments": {"key": "comments", "type": "str"}, - } - - def __init__(self, *, comments: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword comments: Test failover cleanup comments. - :paramtype comments: str - """ - super().__init__(**kwargs) - self.comments = comments - - -class TestFailoverInput(_serialization.Model): - """Input definition for test failover. - - All required parameters must be populated in order to send to server. - - :ivar properties: Test failover input properties. Required. - :vartype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.TestFailoverInputProperties - """ - - _validation = { - "properties": {"required": True}, - } - - _attribute_map = { - "properties": {"key": "properties", "type": "TestFailoverInputProperties"}, - } - - def __init__(self, *, properties: "_models.TestFailoverInputProperties", **kwargs: Any) -> None: - """ - :keyword properties: Test failover input properties. Required. - :paramtype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.TestFailoverInputProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class TestFailoverInputProperties(_serialization.Model): - """Input definition for test failover input properties. - - :ivar failover_direction: Test failover direction. - :vartype failover_direction: str - :ivar network_type: Network type to be used for test failover. - :vartype network_type: str - :ivar network_id: The id of the network to be used for test failover. - :vartype network_id: str - :ivar provider_specific_details: Provider specific settings. - :vartype provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.TestFailoverProviderSpecificInput - """ - - _attribute_map = { - "failover_direction": {"key": "failoverDirection", "type": "str"}, - "network_type": {"key": "networkType", "type": "str"}, - "network_id": {"key": "networkId", "type": "str"}, - "provider_specific_details": {"key": "providerSpecificDetails", "type": "TestFailoverProviderSpecificInput"}, - } - - def __init__( - self, - *, - failover_direction: Optional[str] = None, - network_type: Optional[str] = None, - network_id: Optional[str] = None, - provider_specific_details: Optional["_models.TestFailoverProviderSpecificInput"] = None, - **kwargs: Any - ) -> None: - """ - :keyword failover_direction: Test failover direction. - :paramtype failover_direction: str - :keyword network_type: Network type to be used for test failover. - :paramtype network_type: str - :keyword network_id: The id of the network to be used for test failover. - :paramtype network_id: str - :keyword provider_specific_details: Provider specific settings. - :paramtype provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.TestFailoverProviderSpecificInput - """ - super().__init__(**kwargs) - self.failover_direction = failover_direction - self.network_type = network_type - self.network_id = network_id - self.provider_specific_details = provider_specific_details - - -class TestFailoverJobDetails(JobDetails): - """This class represents the details for a test failover job. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: Gets the type of job details (see JobDetailsTypes enum for possible - values). Required. - :vartype instance_type: str - :ivar affected_object_details: The affected object properties like source server, source cloud, - target server, target cloud etc. based on the workflow object details. - :vartype affected_object_details: dict[str, str] - :ivar test_failover_status: The test failover status. - :vartype test_failover_status: str - :ivar comments: The test failover comments. - :vartype comments: str - :ivar network_name: The test network name. - :vartype network_name: str - :ivar network_friendly_name: The test network friendly name. - :vartype network_friendly_name: str - :ivar network_type: The test network type (see TestFailoverInput enum for possible values). - :vartype network_type: str - :ivar protected_item_details: The test VM details. - :vartype protected_item_details: - list[~azure.mgmt.recoveryservicessiterecovery.models.FailoverReplicationProtectedItemDetails] - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "affected_object_details": {"key": "affectedObjectDetails", "type": "{str}"}, - "test_failover_status": {"key": "testFailoverStatus", "type": "str"}, - "comments": {"key": "comments", "type": "str"}, - "network_name": {"key": "networkName", "type": "str"}, - "network_friendly_name": {"key": "networkFriendlyName", "type": "str"}, - "network_type": {"key": "networkType", "type": "str"}, - "protected_item_details": {"key": "protectedItemDetails", "type": "[FailoverReplicationProtectedItemDetails]"}, - } - - def __init__( - self, - *, - affected_object_details: Optional[Dict[str, str]] = None, - test_failover_status: Optional[str] = None, - comments: Optional[str] = None, - network_name: Optional[str] = None, - network_friendly_name: Optional[str] = None, - network_type: Optional[str] = None, - protected_item_details: Optional[List["_models.FailoverReplicationProtectedItemDetails"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword affected_object_details: The affected object properties like source server, source - cloud, target server, target cloud etc. based on the workflow object details. - :paramtype affected_object_details: dict[str, str] - :keyword test_failover_status: The test failover status. - :paramtype test_failover_status: str - :keyword comments: The test failover comments. - :paramtype comments: str - :keyword network_name: The test network name. - :paramtype network_name: str - :keyword network_friendly_name: The test network friendly name. - :paramtype network_friendly_name: str - :keyword network_type: The test network type (see TestFailoverInput enum for possible values). - :paramtype network_type: str - :keyword protected_item_details: The test VM details. - :paramtype protected_item_details: - list[~azure.mgmt.recoveryservicessiterecovery.models.FailoverReplicationProtectedItemDetails] - """ - super().__init__(affected_object_details=affected_object_details, **kwargs) - self.instance_type: str = "TestFailoverJobDetails" - self.test_failover_status = test_failover_status - self.comments = comments - self.network_name = network_name - self.network_friendly_name = network_friendly_name - self.network_type = network_type - self.protected_item_details = protected_item_details - - -class TestMigrateCleanupInput(_serialization.Model): - """Input for test migrate cleanup. - - All required parameters must be populated in order to send to server. - - :ivar properties: Test migrate cleanup input properties. Required. - :vartype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.TestMigrateCleanupInputProperties - """ - - _validation = { - "properties": {"required": True}, - } - - _attribute_map = { - "properties": {"key": "properties", "type": "TestMigrateCleanupInputProperties"}, - } - - def __init__(self, *, properties: "_models.TestMigrateCleanupInputProperties", **kwargs: Any) -> None: - """ - :keyword properties: Test migrate cleanup input properties. Required. - :paramtype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.TestMigrateCleanupInputProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class TestMigrateCleanupInputProperties(_serialization.Model): - """Test migrate cleanup input properties. - - :ivar comments: Test migrate cleanup comments. - :vartype comments: str - """ - - _validation = { - "comments": {"max_length": 1024}, - } - - _attribute_map = { - "comments": {"key": "comments", "type": "str"}, - } - - def __init__(self, *, comments: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword comments: Test migrate cleanup comments. - :paramtype comments: str - """ - super().__init__(**kwargs) - self.comments = comments - - -class TestMigrateInput(_serialization.Model): - """Input for test migrate. - - All required parameters must be populated in order to send to server. - - :ivar properties: Test migrate input properties. Required. - :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.TestMigrateInputProperties - """ - - _validation = { - "properties": {"required": True}, - } - - _attribute_map = { - "properties": {"key": "properties", "type": "TestMigrateInputProperties"}, - } - - def __init__(self, *, properties: "_models.TestMigrateInputProperties", **kwargs: Any) -> None: - """ - :keyword properties: Test migrate input properties. Required. - :paramtype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.TestMigrateInputProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class TestMigrateInputProperties(_serialization.Model): - """Test migrate input properties. - - All required parameters must be populated in order to send to server. - - :ivar provider_specific_details: The provider specific details. Required. - :vartype provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.TestMigrateProviderSpecificInput - """ - - _validation = { - "provider_specific_details": {"required": True}, - } - - _attribute_map = { - "provider_specific_details": {"key": "providerSpecificDetails", "type": "TestMigrateProviderSpecificInput"}, - } - - def __init__(self, *, provider_specific_details: "_models.TestMigrateProviderSpecificInput", **kwargs: Any) -> None: - """ - :keyword provider_specific_details: The provider specific details. Required. - :paramtype provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.TestMigrateProviderSpecificInput - """ - super().__init__(**kwargs) - self.provider_specific_details = provider_specific_details - - -class TestMigrateProviderSpecificInput(_serialization.Model): - """Test migrate provider specific input. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - VMwareCbtTestMigrateInput - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - } - - _subtype_map = {"instance_type": {"VMwareCbt": "VMwareCbtTestMigrateInput"}} - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.instance_type: Optional[str] = None - - -class UnplannedFailoverInput(_serialization.Model): - """Input definition for unplanned failover. - - All required parameters must be populated in order to send to server. - - :ivar properties: Unplanned failover input properties. Required. - :vartype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.UnplannedFailoverInputProperties - """ - - _validation = { - "properties": {"required": True}, - } - - _attribute_map = { - "properties": {"key": "properties", "type": "UnplannedFailoverInputProperties"}, - } - - def __init__(self, *, properties: "_models.UnplannedFailoverInputProperties", **kwargs: Any) -> None: - """ - :keyword properties: Unplanned failover input properties. Required. - :paramtype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.UnplannedFailoverInputProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class UnplannedFailoverInputProperties(_serialization.Model): - """Input definition for unplanned failover input properties. - - :ivar failover_direction: Failover direction. - :vartype failover_direction: str - :ivar source_site_operations: Source site operations status. - :vartype source_site_operations: str - :ivar provider_specific_details: Provider specific settings. - :vartype provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.UnplannedFailoverProviderSpecificInput - """ - - _attribute_map = { - "failover_direction": {"key": "failoverDirection", "type": "str"}, - "source_site_operations": {"key": "sourceSiteOperations", "type": "str"}, - "provider_specific_details": { - "key": "providerSpecificDetails", - "type": "UnplannedFailoverProviderSpecificInput", - }, - } - - def __init__( - self, - *, - failover_direction: Optional[str] = None, - source_site_operations: Optional[str] = None, - provider_specific_details: Optional["_models.UnplannedFailoverProviderSpecificInput"] = None, - **kwargs: Any - ) -> None: - """ - :keyword failover_direction: Failover direction. - :paramtype failover_direction: str - :keyword source_site_operations: Source site operations status. - :paramtype source_site_operations: str - :keyword provider_specific_details: Provider specific settings. - :paramtype provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.UnplannedFailoverProviderSpecificInput - """ - super().__init__(**kwargs) - self.failover_direction = failover_direction - self.source_site_operations = source_site_operations - self.provider_specific_details = provider_specific_details - - -class UpdateApplianceForReplicationProtectedItemInput(_serialization.Model): # pylint: disable=name-too-long - """Update appliance for replication protected item input. - - All required parameters must be populated in order to send to server. - - :ivar properties: Update appliance replication protected item properties. Required. - :vartype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.UpdateApplianceForReplicationProtectedItemInputProperties - """ - - _validation = { - "properties": {"required": True}, - } - - _attribute_map = { - "properties": {"key": "properties", "type": "UpdateApplianceForReplicationProtectedItemInputProperties"}, - } - - def __init__( - self, *, properties: "_models.UpdateApplianceForReplicationProtectedItemInputProperties", **kwargs: Any - ) -> None: - """ - :keyword properties: Update appliance replication protected item properties. Required. - :paramtype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.UpdateApplianceForReplicationProtectedItemInputProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class UpdateApplianceForReplicationProtectedItemInputProperties(_serialization.Model): # pylint: disable=name-too-long - """Update appliance for protected item input properties. - - All required parameters must be populated in order to send to server. - - :ivar target_appliance_id: The target appliance Id. Required. - :vartype target_appliance_id: str - :ivar provider_specific_details: The provider specific input to update replication protected - item. Required. - :vartype provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.UpdateApplianceForReplicationProtectedItemProviderSpecificInput - """ - - _validation = { - "target_appliance_id": {"required": True}, - "provider_specific_details": {"required": True}, - } - - _attribute_map = { - "target_appliance_id": {"key": "targetApplianceId", "type": "str"}, - "provider_specific_details": { - "key": "providerSpecificDetails", - "type": "UpdateApplianceForReplicationProtectedItemProviderSpecificInput", - }, - } - - def __init__( - self, - *, - target_appliance_id: str, - provider_specific_details: "_models.UpdateApplianceForReplicationProtectedItemProviderSpecificInput", - **kwargs: Any - ) -> None: - """ - :keyword target_appliance_id: The target appliance Id. Required. - :paramtype target_appliance_id: str - :keyword provider_specific_details: The provider specific input to update replication protected - item. Required. - :paramtype provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.UpdateApplianceForReplicationProtectedItemProviderSpecificInput - """ - super().__init__(**kwargs) - self.target_appliance_id = target_appliance_id - self.provider_specific_details = provider_specific_details - - -class UpdateDiskInput(_serialization.Model): - """Disk input for update. - - All required parameters must be populated in order to send to server. - - :ivar disk_id: The disk Id. Required. - :vartype disk_id: str - :ivar target_disk_name: The target disk name. - :vartype target_disk_name: str - """ - - _validation = { - "disk_id": {"required": True}, - } - - _attribute_map = { - "disk_id": {"key": "diskId", "type": "str"}, - "target_disk_name": {"key": "targetDiskName", "type": "str"}, - } - - def __init__(self, *, disk_id: str, target_disk_name: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword disk_id: The disk Id. Required. - :paramtype disk_id: str - :keyword target_disk_name: The target disk name. - :paramtype target_disk_name: str - """ - super().__init__(**kwargs) - self.disk_id = disk_id - self.target_disk_name = target_disk_name - - -class UpdateMigrationItemInput(_serialization.Model): - """Update migration item input. - - :ivar properties: Update migration item input properties. - :vartype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.UpdateMigrationItemInputProperties - """ - - _attribute_map = { - "properties": {"key": "properties", "type": "UpdateMigrationItemInputProperties"}, - } - - def __init__( - self, *, properties: Optional["_models.UpdateMigrationItemInputProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: Update migration item input properties. - :paramtype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.UpdateMigrationItemInputProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class UpdateMigrationItemInputProperties(_serialization.Model): - """Update migration item input properties. - - All required parameters must be populated in order to send to server. - - :ivar provider_specific_details: The provider specific input to update migration item. - Required. - :vartype provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.UpdateMigrationItemProviderSpecificInput - """ - - _validation = { - "provider_specific_details": {"required": True}, - } - - _attribute_map = { - "provider_specific_details": { - "key": "providerSpecificDetails", - "type": "UpdateMigrationItemProviderSpecificInput", - }, - } - - def __init__( - self, *, provider_specific_details: "_models.UpdateMigrationItemProviderSpecificInput", **kwargs: Any - ) -> None: - """ - :keyword provider_specific_details: The provider specific input to update migration item. - Required. - :paramtype provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.UpdateMigrationItemProviderSpecificInput - """ - super().__init__(**kwargs) - self.provider_specific_details = provider_specific_details - - -class UpdateMigrationItemProviderSpecificInput(_serialization.Model): - """Update migration item provider specific input. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - VMwareCbtUpdateMigrationItemInput - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - } - - _subtype_map = {"instance_type": {"VMwareCbt": "VMwareCbtUpdateMigrationItemInput"}} - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.instance_type: Optional[str] = None - - -class UpdateMobilityServiceRequest(_serialization.Model): - """Request to update the mobility service on a protected item. - - :ivar properties: The properties of the update mobility service request. - :vartype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.UpdateMobilityServiceRequestProperties - """ - - _attribute_map = { - "properties": {"key": "properties", "type": "UpdateMobilityServiceRequestProperties"}, - } - - def __init__( - self, *, properties: Optional["_models.UpdateMobilityServiceRequestProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: The properties of the update mobility service request. - :paramtype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.UpdateMobilityServiceRequestProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class UpdateMobilityServiceRequestProperties(_serialization.Model): - """The properties of an update mobility service request. - - :ivar run_as_account_id: The CS run as account Id. - :vartype run_as_account_id: str - """ - - _attribute_map = { - "run_as_account_id": {"key": "runAsAccountId", "type": "str"}, - } - - def __init__(self, *, run_as_account_id: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword run_as_account_id: The CS run as account Id. - :paramtype run_as_account_id: str - """ - super().__init__(**kwargs) - self.run_as_account_id = run_as_account_id - - -class UpdateNetworkMappingInput(_serialization.Model): - """Update network mapping input. - - :ivar properties: The input properties needed to update network mapping. - :vartype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.UpdateNetworkMappingInputProperties - """ - - _attribute_map = { - "properties": {"key": "properties", "type": "UpdateNetworkMappingInputProperties"}, - } - - def __init__( - self, *, properties: Optional["_models.UpdateNetworkMappingInputProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: The input properties needed to update network mapping. - :paramtype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.UpdateNetworkMappingInputProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class UpdateNetworkMappingInputProperties(_serialization.Model): - """Common input details for network mapping operation. - - :ivar recovery_fabric_name: Recovery fabric name. - :vartype recovery_fabric_name: str - :ivar recovery_network_id: Recovery network Id. - :vartype recovery_network_id: str - :ivar fabric_specific_details: Fabrics specific input network Id. - :vartype fabric_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.FabricSpecificUpdateNetworkMappingInput - """ - - _attribute_map = { - "recovery_fabric_name": {"key": "recoveryFabricName", "type": "str"}, - "recovery_network_id": {"key": "recoveryNetworkId", "type": "str"}, - "fabric_specific_details": {"key": "fabricSpecificDetails", "type": "FabricSpecificUpdateNetworkMappingInput"}, - } - - def __init__( - self, - *, - recovery_fabric_name: Optional[str] = None, - recovery_network_id: Optional[str] = None, - fabric_specific_details: Optional["_models.FabricSpecificUpdateNetworkMappingInput"] = None, - **kwargs: Any - ) -> None: - """ - :keyword recovery_fabric_name: Recovery fabric name. - :paramtype recovery_fabric_name: str - :keyword recovery_network_id: Recovery network Id. - :paramtype recovery_network_id: str - :keyword fabric_specific_details: Fabrics specific input network Id. - :paramtype fabric_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.FabricSpecificUpdateNetworkMappingInput - """ - super().__init__(**kwargs) - self.recovery_fabric_name = recovery_fabric_name - self.recovery_network_id = recovery_network_id - self.fabric_specific_details = fabric_specific_details - - -class UpdatePolicyInput(_serialization.Model): - """Update policy input. - - :ivar properties: The ReplicationProviderSettings. - :vartype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.UpdatePolicyInputProperties - """ - - _attribute_map = { - "properties": {"key": "properties", "type": "UpdatePolicyInputProperties"}, - } - - def __init__(self, *, properties: Optional["_models.UpdatePolicyInputProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: The ReplicationProviderSettings. - :paramtype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.UpdatePolicyInputProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class UpdatePolicyInputProperties(_serialization.Model): - """Policy update properties. - - :ivar replication_provider_settings: The ReplicationProviderSettings. - :vartype replication_provider_settings: - ~azure.mgmt.recoveryservicessiterecovery.models.PolicyProviderSpecificInput - """ - - _attribute_map = { - "replication_provider_settings": {"key": "replicationProviderSettings", "type": "PolicyProviderSpecificInput"}, - } - - def __init__( - self, *, replication_provider_settings: Optional["_models.PolicyProviderSpecificInput"] = None, **kwargs: Any - ) -> None: - """ - :keyword replication_provider_settings: The ReplicationProviderSettings. - :paramtype replication_provider_settings: - ~azure.mgmt.recoveryservicessiterecovery.models.PolicyProviderSpecificInput - """ - super().__init__(**kwargs) - self.replication_provider_settings = replication_provider_settings - - -class UpdateProtectionContainerMappingInput(_serialization.Model): - """Container pairing update input. - - :ivar properties: Update protection container mapping input properties. - :vartype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.UpdateProtectionContainerMappingInputProperties - """ - - _attribute_map = { - "properties": {"key": "properties", "type": "UpdateProtectionContainerMappingInputProperties"}, - } - - def __init__( - self, *, properties: Optional["_models.UpdateProtectionContainerMappingInputProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: Update protection container mapping input properties. - :paramtype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.UpdateProtectionContainerMappingInputProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class UpdateProtectionContainerMappingInputProperties(_serialization.Model): # pylint: disable=name-too-long - """Container pairing update input. - - :ivar provider_specific_input: Provider specific input for updating protection container - mapping. - :vartype provider_specific_input: - ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProviderSpecificUpdateContainerMappingInput - """ - - _attribute_map = { - "provider_specific_input": { - "key": "providerSpecificInput", - "type": "ReplicationProviderSpecificUpdateContainerMappingInput", - }, - } - - def __init__( - self, - *, - provider_specific_input: Optional["_models.ReplicationProviderSpecificUpdateContainerMappingInput"] = None, - **kwargs: Any - ) -> None: - """ - :keyword provider_specific_input: Provider specific input for updating protection container - mapping. - :paramtype provider_specific_input: - ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProviderSpecificUpdateContainerMappingInput - """ - super().__init__(**kwargs) - self.provider_specific_input = provider_specific_input - - -class UpdateRecoveryPlanInput(_serialization.Model): - """Update recovery plan input class. - - :ivar properties: Recovery plan update properties. - :vartype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.UpdateRecoveryPlanInputProperties - """ - - _attribute_map = { - "properties": {"key": "properties", "type": "UpdateRecoveryPlanInputProperties"}, - } - - def __init__( - self, *, properties: Optional["_models.UpdateRecoveryPlanInputProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: Recovery plan update properties. - :paramtype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.UpdateRecoveryPlanInputProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class UpdateRecoveryPlanInputProperties(_serialization.Model): - """Recovery plan update properties. - - :ivar groups: The recovery plan groups. - :vartype groups: list[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanGroup] - """ - - _attribute_map = { - "groups": {"key": "groups", "type": "[RecoveryPlanGroup]"}, - } - - def __init__(self, *, groups: Optional[List["_models.RecoveryPlanGroup"]] = None, **kwargs: Any) -> None: - """ - :keyword groups: The recovery plan groups. - :paramtype groups: list[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanGroup] - """ - super().__init__(**kwargs) - self.groups = groups - - -class UpdateReplicationProtectedItemInput(_serialization.Model): - """Update replication protected item input. - - :ivar properties: Update replication protected item properties. - :vartype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.UpdateReplicationProtectedItemInputProperties - """ - - _attribute_map = { - "properties": {"key": "properties", "type": "UpdateReplicationProtectedItemInputProperties"}, - } - - def __init__( - self, *, properties: Optional["_models.UpdateReplicationProtectedItemInputProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: Update replication protected item properties. - :paramtype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.UpdateReplicationProtectedItemInputProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class UpdateReplicationProtectedItemInputProperties(_serialization.Model): # pylint: disable=name-too-long - """Update protected item input properties. - - :ivar recovery_azure_vm_name: Target Azure VM name given by the user. - :vartype recovery_azure_vm_name: str - :ivar recovery_azure_vm_size: Target Azure VM size. - :vartype recovery_azure_vm_size: str - :ivar selected_recovery_azure_network_id: Target Azure Network Id. - :vartype selected_recovery_azure_network_id: str - :ivar selected_tfo_azure_network_id: The Azure Network Id for test failover. - :vartype selected_tfo_azure_network_id: str - :ivar selected_source_nic_id: The selected source nic Id which will be used as the primary nic - during failover. - :vartype selected_source_nic_id: str - :ivar enable_rdp_on_target_option: The selected option to enable RDP\\SSH on target vm after - failover. String value of SrsDataContract.EnableRDPOnTargetOption enum. - :vartype enable_rdp_on_target_option: str - :ivar vm_nics: The list of VM nic details. - :vartype vm_nics: list[~azure.mgmt.recoveryservicessiterecovery.models.VMNicInputDetails] - :ivar license_type: License type. Known values are: "NotSpecified", "NoLicenseType", and - "WindowsServer". - :vartype license_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.LicenseType - :ivar recovery_availability_set_id: The target availability set Id. - :vartype recovery_availability_set_id: str - :ivar provider_specific_details: The provider specific input to update replication protected - item. - :vartype provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.UpdateReplicationProtectedItemProviderInput - """ - - _attribute_map = { - "recovery_azure_vm_name": {"key": "recoveryAzureVMName", "type": "str"}, - "recovery_azure_vm_size": {"key": "recoveryAzureVMSize", "type": "str"}, - "selected_recovery_azure_network_id": {"key": "selectedRecoveryAzureNetworkId", "type": "str"}, - "selected_tfo_azure_network_id": {"key": "selectedTfoAzureNetworkId", "type": "str"}, - "selected_source_nic_id": {"key": "selectedSourceNicId", "type": "str"}, - "enable_rdp_on_target_option": {"key": "enableRdpOnTargetOption", "type": "str"}, - "vm_nics": {"key": "vmNics", "type": "[VMNicInputDetails]"}, - "license_type": {"key": "licenseType", "type": "str"}, - "recovery_availability_set_id": {"key": "recoveryAvailabilitySetId", "type": "str"}, - "provider_specific_details": { - "key": "providerSpecificDetails", - "type": "UpdateReplicationProtectedItemProviderInput", - }, - } - - def __init__( - self, - *, - recovery_azure_vm_name: Optional[str] = None, - recovery_azure_vm_size: Optional[str] = None, - selected_recovery_azure_network_id: Optional[str] = None, - selected_tfo_azure_network_id: Optional[str] = None, - selected_source_nic_id: Optional[str] = None, - enable_rdp_on_target_option: Optional[str] = None, - vm_nics: Optional[List["_models.VMNicInputDetails"]] = None, - license_type: Optional[Union[str, "_models.LicenseType"]] = None, - recovery_availability_set_id: Optional[str] = None, - provider_specific_details: Optional["_models.UpdateReplicationProtectedItemProviderInput"] = None, - **kwargs: Any - ) -> None: - """ - :keyword recovery_azure_vm_name: Target Azure VM name given by the user. - :paramtype recovery_azure_vm_name: str - :keyword recovery_azure_vm_size: Target Azure VM size. - :paramtype recovery_azure_vm_size: str - :keyword selected_recovery_azure_network_id: Target Azure Network Id. - :paramtype selected_recovery_azure_network_id: str - :keyword selected_tfo_azure_network_id: The Azure Network Id for test failover. - :paramtype selected_tfo_azure_network_id: str - :keyword selected_source_nic_id: The selected source nic Id which will be used as the primary - nic during failover. - :paramtype selected_source_nic_id: str - :keyword enable_rdp_on_target_option: The selected option to enable RDP\\SSH on target vm after - failover. String value of SrsDataContract.EnableRDPOnTargetOption enum. - :paramtype enable_rdp_on_target_option: str - :keyword vm_nics: The list of VM nic details. - :paramtype vm_nics: list[~azure.mgmt.recoveryservicessiterecovery.models.VMNicInputDetails] - :keyword license_type: License type. Known values are: "NotSpecified", "NoLicenseType", and - "WindowsServer". - :paramtype license_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.LicenseType - :keyword recovery_availability_set_id: The target availability set Id. - :paramtype recovery_availability_set_id: str - :keyword provider_specific_details: The provider specific input to update replication protected - item. - :paramtype provider_specific_details: - ~azure.mgmt.recoveryservicessiterecovery.models.UpdateReplicationProtectedItemProviderInput - """ - super().__init__(**kwargs) - self.recovery_azure_vm_name = recovery_azure_vm_name - self.recovery_azure_vm_size = recovery_azure_vm_size - self.selected_recovery_azure_network_id = selected_recovery_azure_network_id - self.selected_tfo_azure_network_id = selected_tfo_azure_network_id - self.selected_source_nic_id = selected_source_nic_id - self.enable_rdp_on_target_option = enable_rdp_on_target_option - self.vm_nics = vm_nics - self.license_type = license_type - self.recovery_availability_set_id = recovery_availability_set_id - self.provider_specific_details = provider_specific_details - - -class UpdateVCenterRequest(_serialization.Model): - """Input required to update vCenter. - - :ivar properties: The update VCenter Request Properties. - :vartype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.UpdateVCenterRequestProperties - """ - - _attribute_map = { - "properties": {"key": "properties", "type": "UpdateVCenterRequestProperties"}, - } - - def __init__(self, *, properties: Optional["_models.UpdateVCenterRequestProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: The update VCenter Request Properties. - :paramtype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.UpdateVCenterRequestProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class UpdateVCenterRequestProperties(_serialization.Model): - """The properties of an update vCenter request. - - :ivar friendly_name: The friendly name of the vCenter. - :vartype friendly_name: str - :ivar ip_address: The IP address of the vCenter to be discovered. - :vartype ip_address: str - :ivar process_server_id: The process server Id from where the update can be orchestrated. - :vartype process_server_id: str - :ivar port: The port number for discovery. - :vartype port: str - :ivar run_as_account_id: The CS account Id which has privileges to update the vCenter. - :vartype run_as_account_id: str - """ - - _attribute_map = { - "friendly_name": {"key": "friendlyName", "type": "str"}, - "ip_address": {"key": "ipAddress", "type": "str"}, - "process_server_id": {"key": "processServerId", "type": "str"}, - "port": {"key": "port", "type": "str"}, - "run_as_account_id": {"key": "runAsAccountId", "type": "str"}, - } - - def __init__( - self, - *, - friendly_name: Optional[str] = None, - ip_address: Optional[str] = None, - process_server_id: Optional[str] = None, - port: Optional[str] = None, - run_as_account_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword friendly_name: The friendly name of the vCenter. - :paramtype friendly_name: str - :keyword ip_address: The IP address of the vCenter to be discovered. - :paramtype ip_address: str - :keyword process_server_id: The process server Id from where the update can be orchestrated. - :paramtype process_server_id: str - :keyword port: The port number for discovery. - :paramtype port: str - :keyword run_as_account_id: The CS account Id which has privileges to update the vCenter. - :paramtype run_as_account_id: str - """ - super().__init__(**kwargs) - self.friendly_name = friendly_name - self.ip_address = ip_address - self.process_server_id = process_server_id - self.port = port - self.run_as_account_id = run_as_account_id - - -class UserCreatedResourceTag(_serialization.Model): - """Resource tag input. - - :ivar tag_name: The tag name. Please read for more information: - https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/tag-resources#limitations. - :vartype tag_name: str - :ivar tag_value: The tag value. Please read her for more information: - https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/tag-resources#limitations. - :vartype tag_value: str - """ - - _validation = { - "tag_name": {"max_length": 512}, - "tag_value": {"max_length": 256}, - } - - _attribute_map = { - "tag_name": {"key": "tagName", "type": "str"}, - "tag_value": {"key": "tagValue", "type": "str"}, - } - - def __init__(self, *, tag_name: Optional[str] = None, tag_value: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword tag_name: The tag name. Please read for more information: - https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/tag-resources#limitations. - :paramtype tag_name: str - :keyword tag_value: The tag value. Please read her for more information: - https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/tag-resources#limitations. - :paramtype tag_value: str - """ - super().__init__(**kwargs) - self.tag_name = tag_name - self.tag_value = tag_value - - -class VaultHealthDetails(Resource): - """Vault health details definition. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :ivar type: Resource Type. - :vartype type: str - :ivar location: Resource Location. - :vartype location: str - :ivar properties: The vault health related data. - :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.VaultHealthProperties - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "properties": {"key": "properties", "type": "VaultHealthProperties"}, - } - - def __init__( - self, - *, - location: Optional[str] = None, - properties: Optional["_models.VaultHealthProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword location: Resource Location. - :paramtype location: str - :keyword properties: The vault health related data. - :paramtype properties: ~azure.mgmt.recoveryservicessiterecovery.models.VaultHealthProperties - """ - super().__init__(location=location, **kwargs) - self.properties = properties - - -class VaultHealthProperties(_serialization.Model): - """class to define the health summary of the Vault. - - :ivar vault_errors: The list of errors on the vault. - :vartype vault_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] - :ivar protected_items_health: The list of the health detail of the protected items in the - vault. - :vartype protected_items_health: - ~azure.mgmt.recoveryservicessiterecovery.models.ResourceHealthSummary - :ivar fabrics_health: The list of the health detail of the fabrics in the vault. - :vartype fabrics_health: ~azure.mgmt.recoveryservicessiterecovery.models.ResourceHealthSummary - :ivar containers_health: The list of the health detail of the containers in the vault. - :vartype containers_health: - ~azure.mgmt.recoveryservicessiterecovery.models.ResourceHealthSummary - """ - - _attribute_map = { - "vault_errors": {"key": "vaultErrors", "type": "[HealthError]"}, - "protected_items_health": {"key": "protectedItemsHealth", "type": "ResourceHealthSummary"}, - "fabrics_health": {"key": "fabricsHealth", "type": "ResourceHealthSummary"}, - "containers_health": {"key": "containersHealth", "type": "ResourceHealthSummary"}, - } - - def __init__( - self, - *, - vault_errors: Optional[List["_models.HealthError"]] = None, - protected_items_health: Optional["_models.ResourceHealthSummary"] = None, - fabrics_health: Optional["_models.ResourceHealthSummary"] = None, - containers_health: Optional["_models.ResourceHealthSummary"] = None, - **kwargs: Any - ) -> None: - """ - :keyword vault_errors: The list of errors on the vault. - :paramtype vault_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] - :keyword protected_items_health: The list of the health detail of the protected items in the - vault. - :paramtype protected_items_health: - ~azure.mgmt.recoveryservicessiterecovery.models.ResourceHealthSummary - :keyword fabrics_health: The list of the health detail of the fabrics in the vault. - :paramtype fabrics_health: - ~azure.mgmt.recoveryservicessiterecovery.models.ResourceHealthSummary - :keyword containers_health: The list of the health detail of the containers in the vault. - :paramtype containers_health: - ~azure.mgmt.recoveryservicessiterecovery.models.ResourceHealthSummary - """ - super().__init__(**kwargs) - self.vault_errors = vault_errors - self.protected_items_health = protected_items_health - self.fabrics_health = fabrics_health - self.containers_health = containers_health - - -class VaultSetting(Resource): - """Vault setting. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :ivar type: Resource Type. - :vartype type: str - :ivar location: Resource Location. - :vartype location: str - :ivar properties: The vault setting properties. - :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.VaultSettingProperties - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "properties": {"key": "properties", "type": "VaultSettingProperties"}, - } - - def __init__( - self, - *, - location: Optional[str] = None, - properties: Optional["_models.VaultSettingProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword location: Resource Location. - :paramtype location: str - :keyword properties: The vault setting properties. - :paramtype properties: ~azure.mgmt.recoveryservicessiterecovery.models.VaultSettingProperties - """ - super().__init__(location=location, **kwargs) - self.properties = properties - - -class VaultSettingCollection(_serialization.Model): - """Vault setting collection. - - :ivar value: The list of vault setting. - :vartype value: list[~azure.mgmt.recoveryservicessiterecovery.models.VaultSetting] - :ivar next_link: The value of next link. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[VaultSetting]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.VaultSetting"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The list of vault setting. - :paramtype value: list[~azure.mgmt.recoveryservicessiterecovery.models.VaultSetting] - :keyword next_link: The value of next link. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class VaultSettingCreationInput(_serialization.Model): - """Input to create vault setting. - - All required parameters must be populated in order to send to server. - - :ivar properties: Vault setting creation input properties. Required. - :vartype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.VaultSettingCreationInputProperties - """ - - _validation = { - "properties": {"required": True}, - } - - _attribute_map = { - "properties": {"key": "properties", "type": "VaultSettingCreationInputProperties"}, - } - - def __init__(self, *, properties: "_models.VaultSettingCreationInputProperties", **kwargs: Any) -> None: - """ - :keyword properties: Vault setting creation input properties. Required. - :paramtype properties: - ~azure.mgmt.recoveryservicessiterecovery.models.VaultSettingCreationInputProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class VaultSettingCreationInputProperties(_serialization.Model): - """Input to create vault setting. - - :ivar migration_solution_id: The migration solution Id. - :vartype migration_solution_id: str - :ivar vmware_to_azure_provider_type: VMware to Azure provider type. - :vartype vmware_to_azure_provider_type: str - """ - - _attribute_map = { - "migration_solution_id": {"key": "migrationSolutionId", "type": "str"}, - "vmware_to_azure_provider_type": {"key": "vmwareToAzureProviderType", "type": "str"}, - } - - def __init__( - self, - *, - migration_solution_id: Optional[str] = None, - vmware_to_azure_provider_type: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword migration_solution_id: The migration solution Id. - :paramtype migration_solution_id: str - :keyword vmware_to_azure_provider_type: VMware to Azure provider type. - :paramtype vmware_to_azure_provider_type: str - """ - super().__init__(**kwargs) - self.migration_solution_id = migration_solution_id - self.vmware_to_azure_provider_type = vmware_to_azure_provider_type - - -class VaultSettingProperties(_serialization.Model): - """Vault setting properties. - - :ivar migration_solution_id: The migration solution ARM Id. - :vartype migration_solution_id: str - :ivar vmware_to_azure_provider_type: VMware to Azure provider type. - :vartype vmware_to_azure_provider_type: str - """ - - _attribute_map = { - "migration_solution_id": {"key": "migrationSolutionId", "type": "str"}, - "vmware_to_azure_provider_type": {"key": "vmwareToAzureProviderType", "type": "str"}, - } - - def __init__( - self, - *, - migration_solution_id: Optional[str] = None, - vmware_to_azure_provider_type: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword migration_solution_id: The migration solution ARM Id. - :paramtype migration_solution_id: str - :keyword vmware_to_azure_provider_type: VMware to Azure provider type. - :paramtype vmware_to_azure_provider_type: str - """ - super().__init__(**kwargs) - self.migration_solution_id = migration_solution_id - self.vmware_to_azure_provider_type = vmware_to_azure_provider_type - - -class VCenter(Resource): - """vCenter definition. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :ivar type: Resource Type. - :vartype type: str - :ivar location: Resource Location. - :vartype location: str - :ivar properties: VCenter related data. - :vartype properties: ~azure.mgmt.recoveryservicessiterecovery.models.VCenterProperties - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "properties": {"key": "properties", "type": "VCenterProperties"}, - } - - def __init__( - self, *, location: Optional[str] = None, properties: Optional["_models.VCenterProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword location: Resource Location. - :paramtype location: str - :keyword properties: VCenter related data. - :paramtype properties: ~azure.mgmt.recoveryservicessiterecovery.models.VCenterProperties - """ - super().__init__(location=location, **kwargs) - self.properties = properties - - -class VCenterCollection(_serialization.Model): - """Collection of vCenter details. - - :ivar value: The vCenter details. - :vartype value: list[~azure.mgmt.recoveryservicessiterecovery.models.VCenter] - :ivar next_link: The value of next link. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[VCenter]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.VCenter"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The vCenter details. - :paramtype value: list[~azure.mgmt.recoveryservicessiterecovery.models.VCenter] - :keyword next_link: The value of next link. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class VCenterProperties(_serialization.Model): - """vCenter properties. - - :ivar friendly_name: Friendly name of the vCenter. - :vartype friendly_name: str - :ivar internal_id: VCenter internal ID. - :vartype internal_id: str - :ivar last_heartbeat: The time when the last heartbeat was received by vCenter. - :vartype last_heartbeat: ~datetime.datetime - :ivar discovery_status: The VCenter discovery status. - :vartype discovery_status: str - :ivar process_server_id: The process server Id. - :vartype process_server_id: str - :ivar ip_address: The IP address of the vCenter. - :vartype ip_address: str - :ivar infrastructure_id: The infrastructure Id of vCenter. - :vartype infrastructure_id: str - :ivar port: The port number for discovery. - :vartype port: str - :ivar run_as_account_id: The account Id which has privileges to discover the vCenter. - :vartype run_as_account_id: str - :ivar fabric_arm_resource_name: The ARM resource name of the fabric containing this VCenter. - :vartype fabric_arm_resource_name: str - :ivar health_errors: The health errors for this VCenter. - :vartype health_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] - """ - - _attribute_map = { - "friendly_name": {"key": "friendlyName", "type": "str"}, - "internal_id": {"key": "internalId", "type": "str"}, - "last_heartbeat": {"key": "lastHeartbeat", "type": "iso-8601"}, - "discovery_status": {"key": "discoveryStatus", "type": "str"}, - "process_server_id": {"key": "processServerId", "type": "str"}, - "ip_address": {"key": "ipAddress", "type": "str"}, - "infrastructure_id": {"key": "infrastructureId", "type": "str"}, - "port": {"key": "port", "type": "str"}, - "run_as_account_id": {"key": "runAsAccountId", "type": "str"}, - "fabric_arm_resource_name": {"key": "fabricArmResourceName", "type": "str"}, - "health_errors": {"key": "healthErrors", "type": "[HealthError]"}, - } - - def __init__( - self, - *, - friendly_name: Optional[str] = None, - internal_id: Optional[str] = None, - last_heartbeat: Optional[datetime.datetime] = None, - discovery_status: Optional[str] = None, - process_server_id: Optional[str] = None, - ip_address: Optional[str] = None, - infrastructure_id: Optional[str] = None, - port: Optional[str] = None, - run_as_account_id: Optional[str] = None, - fabric_arm_resource_name: Optional[str] = None, - health_errors: Optional[List["_models.HealthError"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword friendly_name: Friendly name of the vCenter. - :paramtype friendly_name: str - :keyword internal_id: VCenter internal ID. - :paramtype internal_id: str - :keyword last_heartbeat: The time when the last heartbeat was received by vCenter. - :paramtype last_heartbeat: ~datetime.datetime - :keyword discovery_status: The VCenter discovery status. - :paramtype discovery_status: str - :keyword process_server_id: The process server Id. - :paramtype process_server_id: str - :keyword ip_address: The IP address of the vCenter. - :paramtype ip_address: str - :keyword infrastructure_id: The infrastructure Id of vCenter. - :paramtype infrastructure_id: str - :keyword port: The port number for discovery. - :paramtype port: str - :keyword run_as_account_id: The account Id which has privileges to discover the vCenter. - :paramtype run_as_account_id: str - :keyword fabric_arm_resource_name: The ARM resource name of the fabric containing this VCenter. - :paramtype fabric_arm_resource_name: str - :keyword health_errors: The health errors for this VCenter. - :paramtype health_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] - """ - super().__init__(**kwargs) - self.friendly_name = friendly_name - self.internal_id = internal_id - self.last_heartbeat = last_heartbeat - self.discovery_status = discovery_status - self.process_server_id = process_server_id - self.ip_address = ip_address - self.infrastructure_id = infrastructure_id - self.port = port - self.run_as_account_id = run_as_account_id - self.fabric_arm_resource_name = fabric_arm_resource_name - self.health_errors = health_errors - - -class VersionDetails(_serialization.Model): - """Version related details. - - :ivar version: The agent version. - :vartype version: str - :ivar expiry_date: Version expiry date. - :vartype expiry_date: ~datetime.datetime - :ivar status: A value indicating whether security update required. Known values are: - "Supported", "NotSupported", "Deprecated", "UpdateRequired", and "SecurityUpdateRequired". - :vartype status: str or ~azure.mgmt.recoveryservicessiterecovery.models.AgentVersionStatus - """ - - _attribute_map = { - "version": {"key": "version", "type": "str"}, - "expiry_date": {"key": "expiryDate", "type": "iso-8601"}, - "status": {"key": "status", "type": "str"}, - } - - def __init__( - self, - *, - version: Optional[str] = None, - expiry_date: Optional[datetime.datetime] = None, - status: Optional[Union[str, "_models.AgentVersionStatus"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword version: The agent version. - :paramtype version: str - :keyword expiry_date: Version expiry date. - :paramtype expiry_date: ~datetime.datetime - :keyword status: A value indicating whether security update required. Known values are: - "Supported", "NotSupported", "Deprecated", "UpdateRequired", and "SecurityUpdateRequired". - :paramtype status: str or ~azure.mgmt.recoveryservicessiterecovery.models.AgentVersionStatus - """ - super().__init__(**kwargs) - self.version = version - self.expiry_date = expiry_date - self.status = status - - -class VirtualMachineTaskDetails(JobTaskDetails): - """This class represents the virtual machine task details. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The type of task details. Required. - :vartype instance_type: str - :ivar job_task: The job entity. - :vartype job_task: ~azure.mgmt.recoveryservicessiterecovery.models.JobEntity - :ivar skipped_reason: The skipped reason. - :vartype skipped_reason: str - :ivar skipped_reason_string: The skipped reason string. - :vartype skipped_reason_string: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "job_task": {"key": "jobTask", "type": "JobEntity"}, - "skipped_reason": {"key": "skippedReason", "type": "str"}, - "skipped_reason_string": {"key": "skippedReasonString", "type": "str"}, - } - - def __init__( - self, - *, - job_task: Optional["_models.JobEntity"] = None, - skipped_reason: Optional[str] = None, - skipped_reason_string: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword job_task: The job entity. - :paramtype job_task: ~azure.mgmt.recoveryservicessiterecovery.models.JobEntity - :keyword skipped_reason: The skipped reason. - :paramtype skipped_reason: str - :keyword skipped_reason_string: The skipped reason string. - :paramtype skipped_reason_string: str - """ - super().__init__(job_task=job_task, **kwargs) - self.instance_type: str = "VirtualMachineTaskDetails" - self.skipped_reason = skipped_reason - self.skipped_reason_string = skipped_reason_string - - -class VmmDetails(FabricSpecificDetails): - """VMM fabric specific details. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: Gets the class type. Overridden in derived classes. Required. - :vartype instance_type: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.instance_type: str = "VMM" - - -class VmmToAzureCreateNetworkMappingInput(FabricSpecificCreateNetworkMappingInput): - """Create network mappings input properties/behavior specific to Vmm to Azure Network mapping. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The instance type. Required. - :vartype instance_type: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.instance_type: str = "VmmToAzure" - - -class VmmToAzureNetworkMappingSettings(NetworkMappingFabricSpecificSettings): - """E2A Network Mapping fabric specific settings. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: Gets the Instance type. Required. - :vartype instance_type: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.instance_type: str = "VmmToAzure" - - -class VmmToAzureUpdateNetworkMappingInput(FabricSpecificUpdateNetworkMappingInput): - """Update network mappings input properties/behavior specific to vmm to azure. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The instance type. Required. - :vartype instance_type: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.instance_type: str = "VmmToAzure" - - -class VmmToVmmCreateNetworkMappingInput(FabricSpecificCreateNetworkMappingInput): - """Create network mappings input properties/behavior specific to vmm to vmm Network mapping. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The instance type. Required. - :vartype instance_type: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.instance_type: str = "VmmToVmm" - - -class VmmToVmmNetworkMappingSettings(NetworkMappingFabricSpecificSettings): - """E2E Network Mapping fabric specific settings. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: Gets the Instance type. Required. - :vartype instance_type: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.instance_type: str = "VmmToVmm" - - -class VmmToVmmUpdateNetworkMappingInput(FabricSpecificUpdateNetworkMappingInput): - """Update network mappings input properties/behavior specific to vmm to vmm. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The instance type. Required. - :vartype instance_type: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.instance_type: str = "VmmToVmm" - - -class VmmVirtualMachineDetails(HyperVVirtualMachineDetails): - """VMM fabric provider specific VM settings. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: Gets the class type. Overridden in derived classes. Required. - :vartype instance_type: str - :ivar source_item_id: The source id of the object. - :vartype source_item_id: str - :ivar generation: The id of the object in fabric. - :vartype generation: str - :ivar os_details: The Last replication time. - :vartype os_details: ~azure.mgmt.recoveryservicessiterecovery.models.OSDetails - :ivar disk_details: The Last successful failover time. - :vartype disk_details: list[~azure.mgmt.recoveryservicessiterecovery.models.DiskDetails] - :ivar has_physical_disk: A value indicating whether the VM has a physical disk attached. String - value of SrsDataContract.PresenceStatus enum. Known values are: "Unknown", "Present", and - "NotPresent". - :vartype has_physical_disk: str or - ~azure.mgmt.recoveryservicessiterecovery.models.PresenceStatus - :ivar has_fibre_channel_adapter: A value indicating whether the VM has a fibre channel adapter - attached. String value of SrsDataContract.PresenceStatus enum. Known values are: "Unknown", - "Present", and "NotPresent". - :vartype has_fibre_channel_adapter: str or - ~azure.mgmt.recoveryservicessiterecovery.models.PresenceStatus - :ivar has_shared_vhd: A value indicating whether the VM has a shared VHD attached. String value - of SrsDataContract.PresenceStatus enum. Known values are: "Unknown", "Present", and - "NotPresent". - :vartype has_shared_vhd: str or ~azure.mgmt.recoveryservicessiterecovery.models.PresenceStatus - :ivar hyper_v_host_id: The Id of the hyper-v host in fabric. - :vartype hyper_v_host_id: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "source_item_id": {"key": "sourceItemId", "type": "str"}, - "generation": {"key": "generation", "type": "str"}, - "os_details": {"key": "osDetails", "type": "OSDetails"}, - "disk_details": {"key": "diskDetails", "type": "[DiskDetails]"}, - "has_physical_disk": {"key": "hasPhysicalDisk", "type": "str"}, - "has_fibre_channel_adapter": {"key": "hasFibreChannelAdapter", "type": "str"}, - "has_shared_vhd": {"key": "hasSharedVhd", "type": "str"}, - "hyper_v_host_id": {"key": "hyperVHostId", "type": "str"}, - } - - def __init__( - self, - *, - source_item_id: Optional[str] = None, - generation: Optional[str] = None, - os_details: Optional["_models.OSDetails"] = None, - disk_details: Optional[List["_models.DiskDetails"]] = None, - has_physical_disk: Optional[Union[str, "_models.PresenceStatus"]] = None, - has_fibre_channel_adapter: Optional[Union[str, "_models.PresenceStatus"]] = None, - has_shared_vhd: Optional[Union[str, "_models.PresenceStatus"]] = None, - hyper_v_host_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword source_item_id: The source id of the object. - :paramtype source_item_id: str - :keyword generation: The id of the object in fabric. - :paramtype generation: str - :keyword os_details: The Last replication time. - :paramtype os_details: ~azure.mgmt.recoveryservicessiterecovery.models.OSDetails - :keyword disk_details: The Last successful failover time. - :paramtype disk_details: list[~azure.mgmt.recoveryservicessiterecovery.models.DiskDetails] - :keyword has_physical_disk: A value indicating whether the VM has a physical disk attached. - String value of SrsDataContract.PresenceStatus enum. Known values are: "Unknown", "Present", - and "NotPresent". - :paramtype has_physical_disk: str or - ~azure.mgmt.recoveryservicessiterecovery.models.PresenceStatus - :keyword has_fibre_channel_adapter: A value indicating whether the VM has a fibre channel - adapter attached. String value of SrsDataContract.PresenceStatus enum. Known values are: - "Unknown", "Present", and "NotPresent". - :paramtype has_fibre_channel_adapter: str or - ~azure.mgmt.recoveryservicessiterecovery.models.PresenceStatus - :keyword has_shared_vhd: A value indicating whether the VM has a shared VHD attached. String - value of SrsDataContract.PresenceStatus enum. Known values are: "Unknown", "Present", and - "NotPresent". - :paramtype has_shared_vhd: str or - ~azure.mgmt.recoveryservicessiterecovery.models.PresenceStatus - :keyword hyper_v_host_id: The Id of the hyper-v host in fabric. - :paramtype hyper_v_host_id: str - """ - super().__init__( - source_item_id=source_item_id, - generation=generation, - os_details=os_details, - disk_details=disk_details, - has_physical_disk=has_physical_disk, - has_fibre_channel_adapter=has_fibre_channel_adapter, - has_shared_vhd=has_shared_vhd, - hyper_v_host_id=hyper_v_host_id, - **kwargs - ) - self.instance_type: str = "VmmVirtualMachine" - - -class VMNicDetails(_serialization.Model): - """Hyper V VM network details. - - :ivar nic_id: The nic Id. - :vartype nic_id: str - :ivar replica_nic_id: The replica nic Id. - :vartype replica_nic_id: str - :ivar source_nic_arm_id: The source nic ARM Id. - :vartype source_nic_arm_id: str - :ivar v_m_network_name: VM network name. - :vartype v_m_network_name: str - :ivar recovery_vm_network_id: Recovery VM network Id. - :vartype recovery_vm_network_id: str - :ivar ip_configs: The IP configurations of the NIC. - :vartype ip_configs: list[~azure.mgmt.recoveryservicessiterecovery.models.IPConfigDetails] - :ivar selection_type: Selection type for failover. - :vartype selection_type: str - :ivar recovery_network_security_group_id: The id of the NSG associated with the NIC. - :vartype recovery_network_security_group_id: str - :ivar enable_accelerated_networking_on_recovery: A value indicating whether the NIC has - accelerated networking enabled. - :vartype enable_accelerated_networking_on_recovery: bool - :ivar tfo_vm_network_id: The network to be used by NIC during test failover. - :vartype tfo_vm_network_id: str - :ivar tfo_network_security_group_id: The NSG to be used by NIC during test failover. - :vartype tfo_network_security_group_id: str - :ivar enable_accelerated_networking_on_tfo: Whether the TFO NIC has accelerated networking - enabled. - :vartype enable_accelerated_networking_on_tfo: bool - :ivar recovery_nic_name: The name of the NIC to be used when creating target NICs. - :vartype recovery_nic_name: str - :ivar recovery_nic_resource_group_name: The resource group of the NIC to be used when creating - target NICs. - :vartype recovery_nic_resource_group_name: str - :ivar reuse_existing_nic: A value indicating whether an existing NIC is allowed to be reused - during failover subject to availability. - :vartype reuse_existing_nic: bool - :ivar tfo_recovery_nic_name: The name of the NIC to be used when creating target NICs in TFO. - :vartype tfo_recovery_nic_name: str - :ivar tfo_recovery_nic_resource_group_name: The resource group of the NIC to be used when - creating target NICs in TFO. - :vartype tfo_recovery_nic_resource_group_name: str - :ivar tfo_reuse_existing_nic: A value indicating whether an existing NIC is allowed to be - reused during test failover subject to availability. - :vartype tfo_reuse_existing_nic: bool - :ivar target_nic_name: Target NIC name. - :vartype target_nic_name: str - """ - - _attribute_map = { - "nic_id": {"key": "nicId", "type": "str"}, - "replica_nic_id": {"key": "replicaNicId", "type": "str"}, - "source_nic_arm_id": {"key": "sourceNicArmId", "type": "str"}, - "v_m_network_name": {"key": "vMNetworkName", "type": "str"}, - "recovery_vm_network_id": {"key": "recoveryVMNetworkId", "type": "str"}, - "ip_configs": {"key": "ipConfigs", "type": "[IPConfigDetails]"}, - "selection_type": {"key": "selectionType", "type": "str"}, - "recovery_network_security_group_id": {"key": "recoveryNetworkSecurityGroupId", "type": "str"}, - "enable_accelerated_networking_on_recovery": {"key": "enableAcceleratedNetworkingOnRecovery", "type": "bool"}, - "tfo_vm_network_id": {"key": "tfoVMNetworkId", "type": "str"}, - "tfo_network_security_group_id": {"key": "tfoNetworkSecurityGroupId", "type": "str"}, - "enable_accelerated_networking_on_tfo": {"key": "enableAcceleratedNetworkingOnTfo", "type": "bool"}, - "recovery_nic_name": {"key": "recoveryNicName", "type": "str"}, - "recovery_nic_resource_group_name": {"key": "recoveryNicResourceGroupName", "type": "str"}, - "reuse_existing_nic": {"key": "reuseExistingNic", "type": "bool"}, - "tfo_recovery_nic_name": {"key": "tfoRecoveryNicName", "type": "str"}, - "tfo_recovery_nic_resource_group_name": {"key": "tfoRecoveryNicResourceGroupName", "type": "str"}, - "tfo_reuse_existing_nic": {"key": "tfoReuseExistingNic", "type": "bool"}, - "target_nic_name": {"key": "targetNicName", "type": "str"}, - } - - def __init__( - self, - *, - nic_id: Optional[str] = None, - replica_nic_id: Optional[str] = None, - source_nic_arm_id: Optional[str] = None, - v_m_network_name: Optional[str] = None, - recovery_vm_network_id: Optional[str] = None, - ip_configs: Optional[List["_models.IPConfigDetails"]] = None, - selection_type: Optional[str] = None, - recovery_network_security_group_id: Optional[str] = None, - enable_accelerated_networking_on_recovery: Optional[bool] = None, - tfo_vm_network_id: Optional[str] = None, - tfo_network_security_group_id: Optional[str] = None, - enable_accelerated_networking_on_tfo: Optional[bool] = None, - recovery_nic_name: Optional[str] = None, - recovery_nic_resource_group_name: Optional[str] = None, - reuse_existing_nic: bool = False, - tfo_recovery_nic_name: Optional[str] = None, - tfo_recovery_nic_resource_group_name: Optional[str] = None, - tfo_reuse_existing_nic: bool = False, - target_nic_name: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword nic_id: The nic Id. - :paramtype nic_id: str - :keyword replica_nic_id: The replica nic Id. - :paramtype replica_nic_id: str - :keyword source_nic_arm_id: The source nic ARM Id. - :paramtype source_nic_arm_id: str - :keyword v_m_network_name: VM network name. - :paramtype v_m_network_name: str - :keyword recovery_vm_network_id: Recovery VM network Id. - :paramtype recovery_vm_network_id: str - :keyword ip_configs: The IP configurations of the NIC. - :paramtype ip_configs: list[~azure.mgmt.recoveryservicessiterecovery.models.IPConfigDetails] - :keyword selection_type: Selection type for failover. - :paramtype selection_type: str - :keyword recovery_network_security_group_id: The id of the NSG associated with the NIC. - :paramtype recovery_network_security_group_id: str - :keyword enable_accelerated_networking_on_recovery: A value indicating whether the NIC has - accelerated networking enabled. - :paramtype enable_accelerated_networking_on_recovery: bool - :keyword tfo_vm_network_id: The network to be used by NIC during test failover. - :paramtype tfo_vm_network_id: str - :keyword tfo_network_security_group_id: The NSG to be used by NIC during test failover. - :paramtype tfo_network_security_group_id: str - :keyword enable_accelerated_networking_on_tfo: Whether the TFO NIC has accelerated networking - enabled. - :paramtype enable_accelerated_networking_on_tfo: bool - :keyword recovery_nic_name: The name of the NIC to be used when creating target NICs. - :paramtype recovery_nic_name: str - :keyword recovery_nic_resource_group_name: The resource group of the NIC to be used when - creating target NICs. - :paramtype recovery_nic_resource_group_name: str - :keyword reuse_existing_nic: A value indicating whether an existing NIC is allowed to be reused - during failover subject to availability. - :paramtype reuse_existing_nic: bool - :keyword tfo_recovery_nic_name: The name of the NIC to be used when creating target NICs in - TFO. - :paramtype tfo_recovery_nic_name: str - :keyword tfo_recovery_nic_resource_group_name: The resource group of the NIC to be used when - creating target NICs in TFO. - :paramtype tfo_recovery_nic_resource_group_name: str - :keyword tfo_reuse_existing_nic: A value indicating whether an existing NIC is allowed to be - reused during test failover subject to availability. - :paramtype tfo_reuse_existing_nic: bool - :keyword target_nic_name: Target NIC name. - :paramtype target_nic_name: str - """ - super().__init__(**kwargs) - self.nic_id = nic_id - self.replica_nic_id = replica_nic_id - self.source_nic_arm_id = source_nic_arm_id - self.v_m_network_name = v_m_network_name - self.recovery_vm_network_id = recovery_vm_network_id - self.ip_configs = ip_configs - self.selection_type = selection_type - self.recovery_network_security_group_id = recovery_network_security_group_id - self.enable_accelerated_networking_on_recovery = enable_accelerated_networking_on_recovery - self.tfo_vm_network_id = tfo_vm_network_id - self.tfo_network_security_group_id = tfo_network_security_group_id - self.enable_accelerated_networking_on_tfo = enable_accelerated_networking_on_tfo - self.recovery_nic_name = recovery_nic_name - self.recovery_nic_resource_group_name = recovery_nic_resource_group_name - self.reuse_existing_nic = reuse_existing_nic - self.tfo_recovery_nic_name = tfo_recovery_nic_name - self.tfo_recovery_nic_resource_group_name = tfo_recovery_nic_resource_group_name - self.tfo_reuse_existing_nic = tfo_reuse_existing_nic - self.target_nic_name = target_nic_name - - -class VMNicInputDetails(_serialization.Model): - """Hyper V VM network input details. - - :ivar nic_id: The nic Id. - :vartype nic_id: str - :ivar ip_configs: The IP configurations to be used by NIC during test failover and failover. - :vartype ip_configs: list[~azure.mgmt.recoveryservicessiterecovery.models.IPConfigInputDetails] - :ivar selection_type: Selection type for failover. - :vartype selection_type: str - :ivar recovery_network_security_group_id: The id of the NSG associated with the NIC. - :vartype recovery_network_security_group_id: str - :ivar enable_accelerated_networking_on_recovery: Whether the NIC has accelerated networking - enabled. - :vartype enable_accelerated_networking_on_recovery: bool - :ivar tfo_network_security_group_id: The NSG to be used by NIC during test failover. - :vartype tfo_network_security_group_id: str - :ivar enable_accelerated_networking_on_tfo: Whether the test NIC has accelerated networking - enabled. - :vartype enable_accelerated_networking_on_tfo: bool - :ivar recovery_nic_name: The name of the NIC to be used when creating target NICs. - :vartype recovery_nic_name: str - :ivar recovery_nic_resource_group_name: The resource group of the NIC to be used when creating - target NICs. - :vartype recovery_nic_resource_group_name: str - :ivar reuse_existing_nic: A value indicating whether an existing NIC is allowed to be reused - during failover subject to availability. - :vartype reuse_existing_nic: bool - :ivar tfo_nic_name: The name of the NIC to be used when creating target NICs in TFO. - :vartype tfo_nic_name: str - :ivar tfo_nic_resource_group_name: The resource group of the NIC to be used when creating - target NICs in TFO. - :vartype tfo_nic_resource_group_name: str - :ivar tfo_reuse_existing_nic: A value indicating whether an existing NIC is allowed to be - reused during test failover subject to availability. - :vartype tfo_reuse_existing_nic: bool - :ivar target_nic_name: Target NIC name. - :vartype target_nic_name: str - """ - - _attribute_map = { - "nic_id": {"key": "nicId", "type": "str"}, - "ip_configs": {"key": "ipConfigs", "type": "[IPConfigInputDetails]"}, - "selection_type": {"key": "selectionType", "type": "str"}, - "recovery_network_security_group_id": {"key": "recoveryNetworkSecurityGroupId", "type": "str"}, - "enable_accelerated_networking_on_recovery": {"key": "enableAcceleratedNetworkingOnRecovery", "type": "bool"}, - "tfo_network_security_group_id": {"key": "tfoNetworkSecurityGroupId", "type": "str"}, - "enable_accelerated_networking_on_tfo": {"key": "enableAcceleratedNetworkingOnTfo", "type": "bool"}, - "recovery_nic_name": {"key": "recoveryNicName", "type": "str"}, - "recovery_nic_resource_group_name": {"key": "recoveryNicResourceGroupName", "type": "str"}, - "reuse_existing_nic": {"key": "reuseExistingNic", "type": "bool"}, - "tfo_nic_name": {"key": "tfoNicName", "type": "str"}, - "tfo_nic_resource_group_name": {"key": "tfoNicResourceGroupName", "type": "str"}, - "tfo_reuse_existing_nic": {"key": "tfoReuseExistingNic", "type": "bool"}, - "target_nic_name": {"key": "targetNicName", "type": "str"}, - } - - def __init__( - self, - *, - nic_id: Optional[str] = None, - ip_configs: Optional[List["_models.IPConfigInputDetails"]] = None, - selection_type: Optional[str] = None, - recovery_network_security_group_id: Optional[str] = None, - enable_accelerated_networking_on_recovery: Optional[bool] = None, - tfo_network_security_group_id: Optional[str] = None, - enable_accelerated_networking_on_tfo: Optional[bool] = None, - recovery_nic_name: Optional[str] = None, - recovery_nic_resource_group_name: Optional[str] = None, - reuse_existing_nic: Optional[bool] = None, - tfo_nic_name: Optional[str] = None, - tfo_nic_resource_group_name: Optional[str] = None, - tfo_reuse_existing_nic: Optional[bool] = None, - target_nic_name: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword nic_id: The nic Id. - :paramtype nic_id: str - :keyword ip_configs: The IP configurations to be used by NIC during test failover and failover. - :paramtype ip_configs: - list[~azure.mgmt.recoveryservicessiterecovery.models.IPConfigInputDetails] - :keyword selection_type: Selection type for failover. - :paramtype selection_type: str - :keyword recovery_network_security_group_id: The id of the NSG associated with the NIC. - :paramtype recovery_network_security_group_id: str - :keyword enable_accelerated_networking_on_recovery: Whether the NIC has accelerated networking - enabled. - :paramtype enable_accelerated_networking_on_recovery: bool - :keyword tfo_network_security_group_id: The NSG to be used by NIC during test failover. - :paramtype tfo_network_security_group_id: str - :keyword enable_accelerated_networking_on_tfo: Whether the test NIC has accelerated networking - enabled. - :paramtype enable_accelerated_networking_on_tfo: bool - :keyword recovery_nic_name: The name of the NIC to be used when creating target NICs. - :paramtype recovery_nic_name: str - :keyword recovery_nic_resource_group_name: The resource group of the NIC to be used when - creating target NICs. - :paramtype recovery_nic_resource_group_name: str - :keyword reuse_existing_nic: A value indicating whether an existing NIC is allowed to be reused - during failover subject to availability. - :paramtype reuse_existing_nic: bool - :keyword tfo_nic_name: The name of the NIC to be used when creating target NICs in TFO. - :paramtype tfo_nic_name: str - :keyword tfo_nic_resource_group_name: The resource group of the NIC to be used when creating - target NICs in TFO. - :paramtype tfo_nic_resource_group_name: str - :keyword tfo_reuse_existing_nic: A value indicating whether an existing NIC is allowed to be - reused during test failover subject to availability. - :paramtype tfo_reuse_existing_nic: bool - :keyword target_nic_name: Target NIC name. - :paramtype target_nic_name: str - """ - super().__init__(**kwargs) - self.nic_id = nic_id - self.ip_configs = ip_configs - self.selection_type = selection_type - self.recovery_network_security_group_id = recovery_network_security_group_id - self.enable_accelerated_networking_on_recovery = enable_accelerated_networking_on_recovery - self.tfo_network_security_group_id = tfo_network_security_group_id - self.enable_accelerated_networking_on_tfo = enable_accelerated_networking_on_tfo - self.recovery_nic_name = recovery_nic_name - self.recovery_nic_resource_group_name = recovery_nic_resource_group_name - self.reuse_existing_nic = reuse_existing_nic - self.tfo_nic_name = tfo_nic_name - self.tfo_nic_resource_group_name = tfo_nic_resource_group_name - self.tfo_reuse_existing_nic = tfo_reuse_existing_nic - self.target_nic_name = target_nic_name - - -class VmNicUpdatesTaskDetails(TaskTypeDetails): - """This class represents the vm NicUpdates task details. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The type of task details. Required. - :vartype instance_type: str - :ivar vm_id: Virtual machine Id. - :vartype vm_id: str - :ivar nic_id: Nic Id. - :vartype nic_id: str - :ivar name: Name of the Nic. - :vartype name: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "vm_id": {"key": "vmId", "type": "str"}, - "nic_id": {"key": "nicId", "type": "str"}, - "name": {"key": "name", "type": "str"}, - } - - def __init__( - self, *, vm_id: Optional[str] = None, nic_id: Optional[str] = None, name: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword vm_id: Virtual machine Id. - :paramtype vm_id: str - :keyword nic_id: Nic Id. - :paramtype nic_id: str - :keyword name: Name of the Nic. - :paramtype name: str - """ - super().__init__(**kwargs) - self.instance_type: str = "VmNicUpdatesTaskDetails" - self.vm_id = vm_id - self.nic_id = nic_id - self.name = name - - -class VMwareCbtContainerCreationInput(ReplicationProviderSpecificContainerCreationInput): - """VMwareCbt container creation input. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.instance_type: str = "VMwareCbt" - - -class VMwareCbtContainerMappingInput(ReplicationProviderSpecificContainerMappingInput): - """VMwareCbt container mapping input. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - :ivar key_vault_id: The target key vault ARM Id. - :vartype key_vault_id: str - :ivar key_vault_uri: The target key vault URL. - :vartype key_vault_uri: str - :ivar storage_account_id: The storage account ARM Id. Required. - :vartype storage_account_id: str - :ivar storage_account_sas_secret_name: The secret name of the storage account. - :vartype storage_account_sas_secret_name: str - :ivar service_bus_connection_string_secret_name: The secret name of the service bus connection - string. - :vartype service_bus_connection_string_secret_name: str - :ivar target_location: The target location. Required. - :vartype target_location: str - """ - - _validation = { - "instance_type": {"required": True}, - "storage_account_id": {"required": True}, - "target_location": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "key_vault_id": {"key": "keyVaultId", "type": "str"}, - "key_vault_uri": {"key": "keyVaultUri", "type": "str"}, - "storage_account_id": {"key": "storageAccountId", "type": "str"}, - "storage_account_sas_secret_name": {"key": "storageAccountSasSecretName", "type": "str"}, - "service_bus_connection_string_secret_name": {"key": "serviceBusConnectionStringSecretName", "type": "str"}, - "target_location": {"key": "targetLocation", "type": "str"}, - } - - def __init__( - self, - *, - storage_account_id: str, - target_location: str, - key_vault_id: Optional[str] = None, - key_vault_uri: Optional[str] = None, - storage_account_sas_secret_name: Optional[str] = None, - service_bus_connection_string_secret_name: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword key_vault_id: The target key vault ARM Id. - :paramtype key_vault_id: str - :keyword key_vault_uri: The target key vault URL. - :paramtype key_vault_uri: str - :keyword storage_account_id: The storage account ARM Id. Required. - :paramtype storage_account_id: str - :keyword storage_account_sas_secret_name: The secret name of the storage account. - :paramtype storage_account_sas_secret_name: str - :keyword service_bus_connection_string_secret_name: The secret name of the service bus - connection string. - :paramtype service_bus_connection_string_secret_name: str - :keyword target_location: The target location. Required. - :paramtype target_location: str - """ - super().__init__(**kwargs) - self.instance_type: str = "VMwareCbt" - self.key_vault_id = key_vault_id - self.key_vault_uri = key_vault_uri - self.storage_account_id = storage_account_id - self.storage_account_sas_secret_name = storage_account_sas_secret_name - self.service_bus_connection_string_secret_name = service_bus_connection_string_secret_name - self.target_location = target_location - - -class VMwareCbtDiskInput(_serialization.Model): - """VMwareCbt disk input. - - All required parameters must be populated in order to send to server. - - :ivar disk_id: The disk Id. Required. - :vartype disk_id: str - :ivar disk_type: The disk type. Known values are: "Standard_LRS", "Premium_LRS", - "StandardSSD_LRS", "PremiumV2_LRS", "UltraSSD_LRS", "StandardSSD_ZRS", and "Premium_ZRS". - :vartype disk_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.DiskAccountType - :ivar is_os_disk: A value indicating whether the disk is the OS disk. Required. - :vartype is_os_disk: str - :ivar log_storage_account_id: The log storage account ARM Id. Required. - :vartype log_storage_account_id: str - :ivar log_storage_account_sas_secret_name: The key vault secret name of the log storage - account. Required. - :vartype log_storage_account_sas_secret_name: str - :ivar disk_encryption_set_id: The DiskEncryptionSet ARM Id. - :vartype disk_encryption_set_id: str - :ivar sector_size_in_bytes: The logical sector size (in bytes), 512 by default. - :vartype sector_size_in_bytes: int - """ - - _validation = { - "disk_id": {"required": True}, - "is_os_disk": {"required": True}, - "log_storage_account_id": {"required": True}, - "log_storage_account_sas_secret_name": {"required": True}, - } - - _attribute_map = { - "disk_id": {"key": "diskId", "type": "str"}, - "disk_type": {"key": "diskType", "type": "str"}, - "is_os_disk": {"key": "isOSDisk", "type": "str"}, - "log_storage_account_id": {"key": "logStorageAccountId", "type": "str"}, - "log_storage_account_sas_secret_name": {"key": "logStorageAccountSasSecretName", "type": "str"}, - "disk_encryption_set_id": {"key": "diskEncryptionSetId", "type": "str"}, - "sector_size_in_bytes": {"key": "sectorSizeInBytes", "type": "int"}, - } - - def __init__( - self, - *, - disk_id: str, - is_os_disk: str, - log_storage_account_id: str, - log_storage_account_sas_secret_name: str, - disk_type: Optional[Union[str, "_models.DiskAccountType"]] = None, - disk_encryption_set_id: Optional[str] = None, - sector_size_in_bytes: Optional[int] = None, - **kwargs: Any - ) -> None: - """ - :keyword disk_id: The disk Id. Required. - :paramtype disk_id: str - :keyword disk_type: The disk type. Known values are: "Standard_LRS", "Premium_LRS", - "StandardSSD_LRS", "PremiumV2_LRS", "UltraSSD_LRS", "StandardSSD_ZRS", and "Premium_ZRS". - :paramtype disk_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.DiskAccountType - :keyword is_os_disk: A value indicating whether the disk is the OS disk. Required. - :paramtype is_os_disk: str - :keyword log_storage_account_id: The log storage account ARM Id. Required. - :paramtype log_storage_account_id: str - :keyword log_storage_account_sas_secret_name: The key vault secret name of the log storage - account. Required. - :paramtype log_storage_account_sas_secret_name: str - :keyword disk_encryption_set_id: The DiskEncryptionSet ARM Id. - :paramtype disk_encryption_set_id: str - :keyword sector_size_in_bytes: The logical sector size (in bytes), 512 by default. - :paramtype sector_size_in_bytes: int - """ - super().__init__(**kwargs) - self.disk_id = disk_id - self.disk_type = disk_type - self.is_os_disk = is_os_disk - self.log_storage_account_id = log_storage_account_id - self.log_storage_account_sas_secret_name = log_storage_account_sas_secret_name - self.disk_encryption_set_id = disk_encryption_set_id - self.sector_size_in_bytes = sector_size_in_bytes - - -class VMwareCbtEnableMigrationInput(EnableMigrationProviderSpecificInput): - """VMwareCbt specific enable migration input. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - :ivar vmware_machine_id: The ARM Id of the VM discovered in VMware. Required. - :vartype vmware_machine_id: str - :ivar disks_to_include: The disks to include list. Required. - :vartype disks_to_include: - list[~azure.mgmt.recoveryservicessiterecovery.models.VMwareCbtDiskInput] - :ivar license_type: License type. Known values are: "NotSpecified", "NoLicenseType", and - "WindowsServer". - :vartype license_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.LicenseType - :ivar sql_server_license_type: The SQL Server license type. Known values are: "NotSpecified", - "NoLicenseType", "PAYG", and "AHUB". - :vartype sql_server_license_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.SqlServerLicenseType - :ivar linux_license_type: The license type for Linux VM's. Known values are: "NotSpecified", - "NoLicenseType", and "LinuxServer". - :vartype linux_license_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.LinuxLicenseType - :ivar perform_sql_bulk_registration: A value indicating whether bulk SQL RP registration to be - done. - :vartype perform_sql_bulk_registration: str - :ivar data_mover_run_as_account_id: The data mover run as account Id. Required. - :vartype data_mover_run_as_account_id: str - :ivar snapshot_run_as_account_id: The snapshot run as account Id. Required. - :vartype snapshot_run_as_account_id: str - :ivar target_vm_name: The target VM name. - :vartype target_vm_name: str - :ivar target_vm_size: The target VM size. - :vartype target_vm_size: str - :ivar target_resource_group_id: The target resource group ARM Id. Required. - :vartype target_resource_group_id: str - :ivar target_network_id: The target network ARM Id. Required. - :vartype target_network_id: str - :ivar test_network_id: The selected test network ARM Id. - :vartype test_network_id: str - :ivar target_subnet_name: The target subnet name. - :vartype target_subnet_name: str - :ivar test_subnet_name: The selected test subnet name. - :vartype test_subnet_name: str - :ivar target_availability_set_id: The target availability set ARM Id. - :vartype target_availability_set_id: str - :ivar target_availability_zone: The target availability zone. - :vartype target_availability_zone: str - :ivar target_proximity_placement_group_id: The target proximity placement group ARM Id. - :vartype target_proximity_placement_group_id: str - :ivar confidential_vm_key_vault_id: The confidential VM key vault Id for ADE installation. - :vartype confidential_vm_key_vault_id: str - :ivar target_vm_security_profile: The target VM security profile. - :vartype target_vm_security_profile: - ~azure.mgmt.recoveryservicessiterecovery.models.VMwareCbtSecurityProfileProperties - :ivar target_boot_diagnostics_storage_account_id: The target boot diagnostics storage account - ARM Id. - :vartype target_boot_diagnostics_storage_account_id: str - :ivar perform_auto_resync: A value indicating whether auto resync is to be done. - :vartype perform_auto_resync: str - :ivar target_vm_tags: The target VM tags. - :vartype target_vm_tags: dict[str, str] - :ivar seed_disk_tags: The tags for the seed disks. - :vartype seed_disk_tags: dict[str, str] - :ivar target_disk_tags: The tags for the target disks. - :vartype target_disk_tags: dict[str, str] - :ivar target_nic_tags: The tags for the target NICs. - :vartype target_nic_tags: dict[str, str] - :ivar user_selected_os_name: The OS name selected by user. - :vartype user_selected_os_name: str - """ - - _validation = { - "instance_type": {"required": True}, - "vmware_machine_id": {"required": True}, - "disks_to_include": {"required": True}, - "data_mover_run_as_account_id": {"required": True}, - "snapshot_run_as_account_id": {"required": True}, - "target_resource_group_id": {"required": True}, - "target_network_id": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "vmware_machine_id": {"key": "vmwareMachineId", "type": "str"}, - "disks_to_include": {"key": "disksToInclude", "type": "[VMwareCbtDiskInput]"}, - "license_type": {"key": "licenseType", "type": "str"}, - "sql_server_license_type": {"key": "sqlServerLicenseType", "type": "str"}, - "linux_license_type": {"key": "linuxLicenseType", "type": "str"}, - "perform_sql_bulk_registration": {"key": "performSqlBulkRegistration", "type": "str"}, - "data_mover_run_as_account_id": {"key": "dataMoverRunAsAccountId", "type": "str"}, - "snapshot_run_as_account_id": {"key": "snapshotRunAsAccountId", "type": "str"}, - "target_vm_name": {"key": "targetVmName", "type": "str"}, - "target_vm_size": {"key": "targetVmSize", "type": "str"}, - "target_resource_group_id": {"key": "targetResourceGroupId", "type": "str"}, - "target_network_id": {"key": "targetNetworkId", "type": "str"}, - "test_network_id": {"key": "testNetworkId", "type": "str"}, - "target_subnet_name": {"key": "targetSubnetName", "type": "str"}, - "test_subnet_name": {"key": "testSubnetName", "type": "str"}, - "target_availability_set_id": {"key": "targetAvailabilitySetId", "type": "str"}, - "target_availability_zone": {"key": "targetAvailabilityZone", "type": "str"}, - "target_proximity_placement_group_id": {"key": "targetProximityPlacementGroupId", "type": "str"}, - "confidential_vm_key_vault_id": {"key": "confidentialVmKeyVaultId", "type": "str"}, - "target_vm_security_profile": {"key": "targetVmSecurityProfile", "type": "VMwareCbtSecurityProfileProperties"}, - "target_boot_diagnostics_storage_account_id": {"key": "targetBootDiagnosticsStorageAccountId", "type": "str"}, - "perform_auto_resync": {"key": "performAutoResync", "type": "str"}, - "target_vm_tags": {"key": "targetVmTags", "type": "{str}"}, - "seed_disk_tags": {"key": "seedDiskTags", "type": "{str}"}, - "target_disk_tags": {"key": "targetDiskTags", "type": "{str}"}, - "target_nic_tags": {"key": "targetNicTags", "type": "{str}"}, - "user_selected_os_name": {"key": "userSelectedOSName", "type": "str"}, - } - - def __init__( # pylint: disable=too-many-locals - self, - *, - vmware_machine_id: str, - disks_to_include: List["_models.VMwareCbtDiskInput"], - data_mover_run_as_account_id: str, - snapshot_run_as_account_id: str, - target_resource_group_id: str, - target_network_id: str, - license_type: Optional[Union[str, "_models.LicenseType"]] = None, - sql_server_license_type: Optional[Union[str, "_models.SqlServerLicenseType"]] = None, - linux_license_type: Optional[Union[str, "_models.LinuxLicenseType"]] = None, - perform_sql_bulk_registration: Optional[str] = None, - target_vm_name: Optional[str] = None, - target_vm_size: Optional[str] = None, - test_network_id: Optional[str] = None, - target_subnet_name: Optional[str] = None, - test_subnet_name: Optional[str] = None, - target_availability_set_id: Optional[str] = None, - target_availability_zone: Optional[str] = None, - target_proximity_placement_group_id: Optional[str] = None, - confidential_vm_key_vault_id: Optional[str] = None, - target_vm_security_profile: Optional["_models.VMwareCbtSecurityProfileProperties"] = None, - target_boot_diagnostics_storage_account_id: Optional[str] = None, - perform_auto_resync: Optional[str] = None, - target_vm_tags: Optional[Dict[str, str]] = None, - seed_disk_tags: Optional[Dict[str, str]] = None, - target_disk_tags: Optional[Dict[str, str]] = None, - target_nic_tags: Optional[Dict[str, str]] = None, - user_selected_os_name: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword vmware_machine_id: The ARM Id of the VM discovered in VMware. Required. - :paramtype vmware_machine_id: str - :keyword disks_to_include: The disks to include list. Required. - :paramtype disks_to_include: - list[~azure.mgmt.recoveryservicessiterecovery.models.VMwareCbtDiskInput] - :keyword license_type: License type. Known values are: "NotSpecified", "NoLicenseType", and - "WindowsServer". - :paramtype license_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.LicenseType - :keyword sql_server_license_type: The SQL Server license type. Known values are: - "NotSpecified", "NoLicenseType", "PAYG", and "AHUB". - :paramtype sql_server_license_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.SqlServerLicenseType - :keyword linux_license_type: The license type for Linux VM's. Known values are: "NotSpecified", - "NoLicenseType", and "LinuxServer". - :paramtype linux_license_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.LinuxLicenseType - :keyword perform_sql_bulk_registration: A value indicating whether bulk SQL RP registration to - be done. - :paramtype perform_sql_bulk_registration: str - :keyword data_mover_run_as_account_id: The data mover run as account Id. Required. - :paramtype data_mover_run_as_account_id: str - :keyword snapshot_run_as_account_id: The snapshot run as account Id. Required. - :paramtype snapshot_run_as_account_id: str - :keyword target_vm_name: The target VM name. - :paramtype target_vm_name: str - :keyword target_vm_size: The target VM size. - :paramtype target_vm_size: str - :keyword target_resource_group_id: The target resource group ARM Id. Required. - :paramtype target_resource_group_id: str - :keyword target_network_id: The target network ARM Id. Required. - :paramtype target_network_id: str - :keyword test_network_id: The selected test network ARM Id. - :paramtype test_network_id: str - :keyword target_subnet_name: The target subnet name. - :paramtype target_subnet_name: str - :keyword test_subnet_name: The selected test subnet name. - :paramtype test_subnet_name: str - :keyword target_availability_set_id: The target availability set ARM Id. - :paramtype target_availability_set_id: str - :keyword target_availability_zone: The target availability zone. - :paramtype target_availability_zone: str - :keyword target_proximity_placement_group_id: The target proximity placement group ARM Id. - :paramtype target_proximity_placement_group_id: str - :keyword confidential_vm_key_vault_id: The confidential VM key vault Id for ADE installation. - :paramtype confidential_vm_key_vault_id: str - :keyword target_vm_security_profile: The target VM security profile. - :paramtype target_vm_security_profile: - ~azure.mgmt.recoveryservicessiterecovery.models.VMwareCbtSecurityProfileProperties - :keyword target_boot_diagnostics_storage_account_id: The target boot diagnostics storage - account ARM Id. - :paramtype target_boot_diagnostics_storage_account_id: str - :keyword perform_auto_resync: A value indicating whether auto resync is to be done. - :paramtype perform_auto_resync: str - :keyword target_vm_tags: The target VM tags. - :paramtype target_vm_tags: dict[str, str] - :keyword seed_disk_tags: The tags for the seed disks. - :paramtype seed_disk_tags: dict[str, str] - :keyword target_disk_tags: The tags for the target disks. - :paramtype target_disk_tags: dict[str, str] - :keyword target_nic_tags: The tags for the target NICs. - :paramtype target_nic_tags: dict[str, str] - :keyword user_selected_os_name: The OS name selected by user. - :paramtype user_selected_os_name: str - """ - super().__init__(**kwargs) - self.instance_type: str = "VMwareCbt" - self.vmware_machine_id = vmware_machine_id - self.disks_to_include = disks_to_include - self.license_type = license_type - self.sql_server_license_type = sql_server_license_type - self.linux_license_type = linux_license_type - self.perform_sql_bulk_registration = perform_sql_bulk_registration - self.data_mover_run_as_account_id = data_mover_run_as_account_id - self.snapshot_run_as_account_id = snapshot_run_as_account_id - self.target_vm_name = target_vm_name - self.target_vm_size = target_vm_size - self.target_resource_group_id = target_resource_group_id - self.target_network_id = target_network_id - self.test_network_id = test_network_id - self.target_subnet_name = target_subnet_name - self.test_subnet_name = test_subnet_name - self.target_availability_set_id = target_availability_set_id - self.target_availability_zone = target_availability_zone - self.target_proximity_placement_group_id = target_proximity_placement_group_id - self.confidential_vm_key_vault_id = confidential_vm_key_vault_id - self.target_vm_security_profile = target_vm_security_profile - self.target_boot_diagnostics_storage_account_id = target_boot_diagnostics_storage_account_id - self.perform_auto_resync = perform_auto_resync - self.target_vm_tags = target_vm_tags - self.seed_disk_tags = seed_disk_tags - self.target_disk_tags = target_disk_tags - self.target_nic_tags = target_nic_tags - self.user_selected_os_name = user_selected_os_name - - -class VMwareCbtEventDetails(EventProviderSpecificDetails): - """Event details for VMwareCbt provider. - - 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 instance_type: Gets the class type. Overridden in derived classes. Required. - :vartype instance_type: str - :ivar migration_item_name: The migration item name. - :vartype migration_item_name: str - """ - - _validation = { - "instance_type": {"required": True}, - "migration_item_name": {"readonly": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "migration_item_name": {"key": "migrationItemName", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.instance_type: str = "VMwareCbt" - self.migration_item_name: Optional[str] = None - - -class VMwareCbtMigrateInput(MigrateProviderSpecificInput): - """VMwareCbt specific migrate input. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - :ivar perform_shutdown: A value indicating whether VM is to be shutdown. Required. - :vartype perform_shutdown: str - :ivar os_upgrade_version: A value indicating the inplace OS Upgrade version. - :vartype os_upgrade_version: str - :ivar post_migration_steps: The managed run command script input. - :vartype post_migration_steps: - list[~azure.mgmt.recoveryservicessiterecovery.models.ManagedRunCommandScriptInput] - """ - - _validation = { - "instance_type": {"required": True}, - "perform_shutdown": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "perform_shutdown": {"key": "performShutdown", "type": "str"}, - "os_upgrade_version": {"key": "osUpgradeVersion", "type": "str"}, - "post_migration_steps": {"key": "postMigrationSteps", "type": "[ManagedRunCommandScriptInput]"}, - } - - def __init__( - self, - *, - perform_shutdown: str, - os_upgrade_version: Optional[str] = None, - post_migration_steps: Optional[List["_models.ManagedRunCommandScriptInput"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword perform_shutdown: A value indicating whether VM is to be shutdown. Required. - :paramtype perform_shutdown: str - :keyword os_upgrade_version: A value indicating the inplace OS Upgrade version. - :paramtype os_upgrade_version: str - :keyword post_migration_steps: The managed run command script input. - :paramtype post_migration_steps: - list[~azure.mgmt.recoveryservicessiterecovery.models.ManagedRunCommandScriptInput] - """ - super().__init__(**kwargs) - self.instance_type: str = "VMwareCbt" - self.perform_shutdown = perform_shutdown - self.os_upgrade_version = os_upgrade_version - self.post_migration_steps = post_migration_steps - - -class VMwareCbtMigrationDetails(MigrationProviderSpecificSettings): - """VMwareCbt provider specific settings. - - 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 instance_type: Gets the instance type. Required. - :vartype instance_type: str - :ivar vmware_machine_id: The ARM Id of the VM discovered in VMware. - :vartype vmware_machine_id: str - :ivar os_type: The type of the OS on the VM. - :vartype os_type: str - :ivar os_name: The name of the OS on the VM. - :vartype os_name: str - :ivar firmware_type: The firmware type. - :vartype firmware_type: str - :ivar target_generation: The target generation. - :vartype target_generation: str - :ivar license_type: License Type of the VM to be used. - :vartype license_type: str - :ivar sql_server_license_type: The SQL Server license type. - :vartype sql_server_license_type: str - :ivar linux_license_type: The license type for Linux VM's. Known values are: "NotSpecified", - "NoLicenseType", and "LinuxServer". - :vartype linux_license_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.LinuxLicenseType - :ivar data_mover_run_as_account_id: The data mover run as account Id. - :vartype data_mover_run_as_account_id: str - :ivar snapshot_run_as_account_id: The snapshot run as account Id. - :vartype snapshot_run_as_account_id: str - :ivar storage_account_id: The replication storage account ARM Id. This is applicable only for - the blob based replication test hook. - :vartype storage_account_id: str - :ivar target_vm_name: Target VM name. - :vartype target_vm_name: str - :ivar target_vm_size: The target VM size. - :vartype target_vm_size: str - :ivar target_location: The target location. - :vartype target_location: str - :ivar target_resource_group_id: The target resource group Id. - :vartype target_resource_group_id: str - :ivar target_availability_set_id: The target availability set Id. - :vartype target_availability_set_id: str - :ivar target_availability_zone: The target availability zone. - :vartype target_availability_zone: str - :ivar target_proximity_placement_group_id: The target proximity placement group Id. - :vartype target_proximity_placement_group_id: str - :ivar confidential_vm_key_vault_id: The confidential VM key vault Id for ADE installation. - :vartype confidential_vm_key_vault_id: str - :ivar target_vm_security_profile: The target VM security profile. - :vartype target_vm_security_profile: - ~azure.mgmt.recoveryservicessiterecovery.models.VMwareCbtSecurityProfileProperties - :ivar target_boot_diagnostics_storage_account_id: The target boot diagnostics storage account - ARM Id. - :vartype target_boot_diagnostics_storage_account_id: str - :ivar target_vm_tags: The target VM tags. - :vartype target_vm_tags: dict[str, str] - :ivar protected_disks: The list of protected disks. - :vartype protected_disks: - list[~azure.mgmt.recoveryservicessiterecovery.models.VMwareCbtProtectedDiskDetails] - :ivar target_network_id: The target network Id. - :vartype target_network_id: str - :ivar test_network_id: The test network Id. - :vartype test_network_id: str - :ivar vm_nics: The network details. - :vartype vm_nics: list[~azure.mgmt.recoveryservicessiterecovery.models.VMwareCbtNicDetails] - :ivar target_nic_tags: The tags for the target NICs. - :vartype target_nic_tags: dict[str, str] - :ivar migration_recovery_point_id: The recovery point Id to which the VM was migrated. - :vartype migration_recovery_point_id: str - :ivar last_recovery_point_received: The last recovery point received time. - :vartype last_recovery_point_received: ~datetime.datetime - :ivar last_recovery_point_id: The last recovery point Id. - :vartype last_recovery_point_id: str - :ivar initial_seeding_progress_percentage: The initial seeding progress percentage. - :vartype initial_seeding_progress_percentage: int - :ivar migration_progress_percentage: The migration progress percentage. - :vartype migration_progress_percentage: int - :ivar resync_progress_percentage: The resync progress percentage. - :vartype resync_progress_percentage: int - :ivar resume_progress_percentage: The resume progress percentage. - :vartype resume_progress_percentage: int - :ivar delta_sync_progress_percentage: The delta sync progress percentage. - :vartype delta_sync_progress_percentage: int - :ivar is_check_sum_resync_cycle: A value indicating whether checksum resync cycle is in - progress. - :vartype is_check_sum_resync_cycle: str - :ivar initial_seeding_retry_count: The initial seeding retry count. - :vartype initial_seeding_retry_count: int - :ivar resync_retry_count: The resync retry count. - :vartype resync_retry_count: int - :ivar resume_retry_count: The resume retry count. - :vartype resume_retry_count: int - :ivar delta_sync_retry_count: The delta sync retry count. - :vartype delta_sync_retry_count: int - :ivar resync_required: A value indicating whether resync is required. - :vartype resync_required: str - :ivar resync_state: The resync state. Known values are: "None", "PreparedForResynchronization", - and "StartedResynchronization". - :vartype resync_state: str or ~azure.mgmt.recoveryservicessiterecovery.models.ResyncState - :ivar perform_auto_resync: A value indicating whether auto resync is to be done. - :vartype perform_auto_resync: str - :ivar seed_disk_tags: The tags for the seed disks. - :vartype seed_disk_tags: dict[str, str] - :ivar target_disk_tags: The tags for the target disks. - :vartype target_disk_tags: dict[str, str] - :ivar supported_os_versions: A value indicating the inplace OS Upgrade version. - :vartype supported_os_versions: list[str] - :ivar appliance_monitoring_details: A value indicating the appliance monitoring details. - :vartype appliance_monitoring_details: - ~azure.mgmt.recoveryservicessiterecovery.models.ApplianceMonitoringDetails - :ivar gateway_operation_details: A value indicating the gateway operation details. - :vartype gateway_operation_details: - ~azure.mgmt.recoveryservicessiterecovery.models.GatewayOperationDetails - :ivar operation_name: A value indicating the SRS operation name. - :vartype operation_name: str - """ - - _validation = { - "instance_type": {"required": True}, - "vmware_machine_id": {"readonly": True}, - "os_type": {"readonly": True}, - "os_name": {"readonly": True}, - "firmware_type": {"readonly": True}, - "target_generation": {"readonly": True}, - "data_mover_run_as_account_id": {"readonly": True}, - "snapshot_run_as_account_id": {"readonly": True}, - "storage_account_id": {"readonly": True}, - "target_location": {"readonly": True}, - "migration_recovery_point_id": {"readonly": True}, - "last_recovery_point_received": {"readonly": True}, - "last_recovery_point_id": {"readonly": True}, - "initial_seeding_progress_percentage": {"readonly": True}, - "migration_progress_percentage": {"readonly": True}, - "resync_progress_percentage": {"readonly": True}, - "resume_progress_percentage": {"readonly": True}, - "delta_sync_progress_percentage": {"readonly": True}, - "is_check_sum_resync_cycle": {"readonly": True}, - "initial_seeding_retry_count": {"readonly": True}, - "resync_retry_count": {"readonly": True}, - "resume_retry_count": {"readonly": True}, - "delta_sync_retry_count": {"readonly": True}, - "resync_required": {"readonly": True}, - "resync_state": {"readonly": True}, - "appliance_monitoring_details": {"readonly": True}, - "gateway_operation_details": {"readonly": True}, - "operation_name": {"readonly": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "vmware_machine_id": {"key": "vmwareMachineId", "type": "str"}, - "os_type": {"key": "osType", "type": "str"}, - "os_name": {"key": "osName", "type": "str"}, - "firmware_type": {"key": "firmwareType", "type": "str"}, - "target_generation": {"key": "targetGeneration", "type": "str"}, - "license_type": {"key": "licenseType", "type": "str"}, - "sql_server_license_type": {"key": "sqlServerLicenseType", "type": "str"}, - "linux_license_type": {"key": "linuxLicenseType", "type": "str"}, - "data_mover_run_as_account_id": {"key": "dataMoverRunAsAccountId", "type": "str"}, - "snapshot_run_as_account_id": {"key": "snapshotRunAsAccountId", "type": "str"}, - "storage_account_id": {"key": "storageAccountId", "type": "str"}, - "target_vm_name": {"key": "targetVmName", "type": "str"}, - "target_vm_size": {"key": "targetVmSize", "type": "str"}, - "target_location": {"key": "targetLocation", "type": "str"}, - "target_resource_group_id": {"key": "targetResourceGroupId", "type": "str"}, - "target_availability_set_id": {"key": "targetAvailabilitySetId", "type": "str"}, - "target_availability_zone": {"key": "targetAvailabilityZone", "type": "str"}, - "target_proximity_placement_group_id": {"key": "targetProximityPlacementGroupId", "type": "str"}, - "confidential_vm_key_vault_id": {"key": "confidentialVmKeyVaultId", "type": "str"}, - "target_vm_security_profile": {"key": "targetVmSecurityProfile", "type": "VMwareCbtSecurityProfileProperties"}, - "target_boot_diagnostics_storage_account_id": {"key": "targetBootDiagnosticsStorageAccountId", "type": "str"}, - "target_vm_tags": {"key": "targetVmTags", "type": "{str}"}, - "protected_disks": {"key": "protectedDisks", "type": "[VMwareCbtProtectedDiskDetails]"}, - "target_network_id": {"key": "targetNetworkId", "type": "str"}, - "test_network_id": {"key": "testNetworkId", "type": "str"}, - "vm_nics": {"key": "vmNics", "type": "[VMwareCbtNicDetails]"}, - "target_nic_tags": {"key": "targetNicTags", "type": "{str}"}, - "migration_recovery_point_id": {"key": "migrationRecoveryPointId", "type": "str"}, - "last_recovery_point_received": {"key": "lastRecoveryPointReceived", "type": "iso-8601"}, - "last_recovery_point_id": {"key": "lastRecoveryPointId", "type": "str"}, - "initial_seeding_progress_percentage": {"key": "initialSeedingProgressPercentage", "type": "int"}, - "migration_progress_percentage": {"key": "migrationProgressPercentage", "type": "int"}, - "resync_progress_percentage": {"key": "resyncProgressPercentage", "type": "int"}, - "resume_progress_percentage": {"key": "resumeProgressPercentage", "type": "int"}, - "delta_sync_progress_percentage": {"key": "deltaSyncProgressPercentage", "type": "int"}, - "is_check_sum_resync_cycle": {"key": "isCheckSumResyncCycle", "type": "str"}, - "initial_seeding_retry_count": {"key": "initialSeedingRetryCount", "type": "int"}, - "resync_retry_count": {"key": "resyncRetryCount", "type": "int"}, - "resume_retry_count": {"key": "resumeRetryCount", "type": "int"}, - "delta_sync_retry_count": {"key": "deltaSyncRetryCount", "type": "int"}, - "resync_required": {"key": "resyncRequired", "type": "str"}, - "resync_state": {"key": "resyncState", "type": "str"}, - "perform_auto_resync": {"key": "performAutoResync", "type": "str"}, - "seed_disk_tags": {"key": "seedDiskTags", "type": "{str}"}, - "target_disk_tags": {"key": "targetDiskTags", "type": "{str}"}, - "supported_os_versions": {"key": "supportedOSVersions", "type": "[str]"}, - "appliance_monitoring_details": {"key": "applianceMonitoringDetails", "type": "ApplianceMonitoringDetails"}, - "gateway_operation_details": {"key": "gatewayOperationDetails", "type": "GatewayOperationDetails"}, - "operation_name": {"key": "operationName", "type": "str"}, - } - - def __init__( # pylint: disable=too-many-locals - self, - *, - license_type: Optional[str] = None, - sql_server_license_type: Optional[str] = None, - linux_license_type: Optional[Union[str, "_models.LinuxLicenseType"]] = None, - target_vm_name: Optional[str] = None, - target_vm_size: Optional[str] = None, - target_resource_group_id: Optional[str] = None, - target_availability_set_id: Optional[str] = None, - target_availability_zone: Optional[str] = None, - target_proximity_placement_group_id: Optional[str] = None, - confidential_vm_key_vault_id: Optional[str] = None, - target_vm_security_profile: Optional["_models.VMwareCbtSecurityProfileProperties"] = None, - target_boot_diagnostics_storage_account_id: Optional[str] = None, - target_vm_tags: Optional[Dict[str, str]] = None, - protected_disks: Optional[List["_models.VMwareCbtProtectedDiskDetails"]] = None, - target_network_id: Optional[str] = None, - test_network_id: Optional[str] = None, - vm_nics: Optional[List["_models.VMwareCbtNicDetails"]] = None, - target_nic_tags: Optional[Dict[str, str]] = None, - perform_auto_resync: Optional[str] = None, - seed_disk_tags: Optional[Dict[str, str]] = None, - target_disk_tags: Optional[Dict[str, str]] = None, - supported_os_versions: Optional[List[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword license_type: License Type of the VM to be used. - :paramtype license_type: str - :keyword sql_server_license_type: The SQL Server license type. - :paramtype sql_server_license_type: str - :keyword linux_license_type: The license type for Linux VM's. Known values are: "NotSpecified", - "NoLicenseType", and "LinuxServer". - :paramtype linux_license_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.LinuxLicenseType - :keyword target_vm_name: Target VM name. - :paramtype target_vm_name: str - :keyword target_vm_size: The target VM size. - :paramtype target_vm_size: str - :keyword target_resource_group_id: The target resource group Id. - :paramtype target_resource_group_id: str - :keyword target_availability_set_id: The target availability set Id. - :paramtype target_availability_set_id: str - :keyword target_availability_zone: The target availability zone. - :paramtype target_availability_zone: str - :keyword target_proximity_placement_group_id: The target proximity placement group Id. - :paramtype target_proximity_placement_group_id: str - :keyword confidential_vm_key_vault_id: The confidential VM key vault Id for ADE installation. - :paramtype confidential_vm_key_vault_id: str - :keyword target_vm_security_profile: The target VM security profile. - :paramtype target_vm_security_profile: - ~azure.mgmt.recoveryservicessiterecovery.models.VMwareCbtSecurityProfileProperties - :keyword target_boot_diagnostics_storage_account_id: The target boot diagnostics storage - account ARM Id. - :paramtype target_boot_diagnostics_storage_account_id: str - :keyword target_vm_tags: The target VM tags. - :paramtype target_vm_tags: dict[str, str] - :keyword protected_disks: The list of protected disks. - :paramtype protected_disks: - list[~azure.mgmt.recoveryservicessiterecovery.models.VMwareCbtProtectedDiskDetails] - :keyword target_network_id: The target network Id. - :paramtype target_network_id: str - :keyword test_network_id: The test network Id. - :paramtype test_network_id: str - :keyword vm_nics: The network details. - :paramtype vm_nics: list[~azure.mgmt.recoveryservicessiterecovery.models.VMwareCbtNicDetails] - :keyword target_nic_tags: The tags for the target NICs. - :paramtype target_nic_tags: dict[str, str] - :keyword perform_auto_resync: A value indicating whether auto resync is to be done. - :paramtype perform_auto_resync: str - :keyword seed_disk_tags: The tags for the seed disks. - :paramtype seed_disk_tags: dict[str, str] - :keyword target_disk_tags: The tags for the target disks. - :paramtype target_disk_tags: dict[str, str] - :keyword supported_os_versions: A value indicating the inplace OS Upgrade version. - :paramtype supported_os_versions: list[str] - """ - super().__init__(**kwargs) - self.instance_type: str = "VMwareCbt" - self.vmware_machine_id: Optional[str] = None - self.os_type: Optional[str] = None - self.os_name: Optional[str] = None - self.firmware_type: Optional[str] = None - self.target_generation: Optional[str] = None - self.license_type = license_type - self.sql_server_license_type = sql_server_license_type - self.linux_license_type = linux_license_type - self.data_mover_run_as_account_id: Optional[str] = None - self.snapshot_run_as_account_id: Optional[str] = None - self.storage_account_id: Optional[str] = None - self.target_vm_name = target_vm_name - self.target_vm_size = target_vm_size - self.target_location: Optional[str] = None - self.target_resource_group_id = target_resource_group_id - self.target_availability_set_id = target_availability_set_id - self.target_availability_zone = target_availability_zone - self.target_proximity_placement_group_id = target_proximity_placement_group_id - self.confidential_vm_key_vault_id = confidential_vm_key_vault_id - self.target_vm_security_profile = target_vm_security_profile - self.target_boot_diagnostics_storage_account_id = target_boot_diagnostics_storage_account_id - self.target_vm_tags = target_vm_tags - self.protected_disks = protected_disks - self.target_network_id = target_network_id - self.test_network_id = test_network_id - self.vm_nics = vm_nics - self.target_nic_tags = target_nic_tags - self.migration_recovery_point_id: Optional[str] = None - self.last_recovery_point_received: Optional[datetime.datetime] = None - self.last_recovery_point_id: Optional[str] = None - self.initial_seeding_progress_percentage: Optional[int] = None - self.migration_progress_percentage: Optional[int] = None - self.resync_progress_percentage: Optional[int] = None - self.resume_progress_percentage: Optional[int] = None - self.delta_sync_progress_percentage: Optional[int] = None - self.is_check_sum_resync_cycle: Optional[str] = None - self.initial_seeding_retry_count: Optional[int] = None - self.resync_retry_count: Optional[int] = None - self.resume_retry_count: Optional[int] = None - self.delta_sync_retry_count: Optional[int] = None - self.resync_required: Optional[str] = None - self.resync_state: Optional[Union[str, "_models.ResyncState"]] = None - self.perform_auto_resync = perform_auto_resync - self.seed_disk_tags = seed_disk_tags - self.target_disk_tags = target_disk_tags - self.supported_os_versions = supported_os_versions - self.appliance_monitoring_details: Optional["_models.ApplianceMonitoringDetails"] = None - self.gateway_operation_details: Optional["_models.GatewayOperationDetails"] = None - self.operation_name: Optional[str] = None - - -class VMwareCbtNicDetails(_serialization.Model): - """VMwareCbt NIC details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar nic_id: The NIC Id. - :vartype nic_id: str - :ivar is_primary_nic: A value indicating whether this is the primary NIC. - :vartype is_primary_nic: str - :ivar source_ip_address: The source IP address. - :vartype source_ip_address: str - :ivar source_ip_address_type: The source IP address type. Known values are: "Dynamic" and - "Static". - :vartype source_ip_address_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.EthernetAddressType - :ivar source_network_id: Source network Id. - :vartype source_network_id: str - :ivar target_ip_address: The target IP address. - :vartype target_ip_address: str - :ivar target_ip_address_type: The target IP address type. Known values are: "Dynamic" and - "Static". - :vartype target_ip_address_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.EthernetAddressType - :ivar target_subnet_name: Target subnet name. - :vartype target_subnet_name: str - :ivar test_network_id: Source network Id. - :vartype test_network_id: str - :ivar test_subnet_name: Test subnet name. - :vartype test_subnet_name: str - :ivar test_ip_address: The test IP address. - :vartype test_ip_address: str - :ivar test_ip_address_type: The test IP address type. Known values are: "Dynamic" and "Static". - :vartype test_ip_address_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.EthernetAddressType - :ivar target_nic_name: Target NIC name. - :vartype target_nic_name: str - :ivar is_selected_for_migration: A value indicating whether this NIC is selected for migration. - :vartype is_selected_for_migration: str - """ - - _validation = { - "nic_id": {"readonly": True}, - "source_ip_address": {"readonly": True}, - "source_ip_address_type": {"readonly": True}, - "source_network_id": {"readonly": True}, - } - - _attribute_map = { - "nic_id": {"key": "nicId", "type": "str"}, - "is_primary_nic": {"key": "isPrimaryNic", "type": "str"}, - "source_ip_address": {"key": "sourceIPAddress", "type": "str"}, - "source_ip_address_type": {"key": "sourceIPAddressType", "type": "str"}, - "source_network_id": {"key": "sourceNetworkId", "type": "str"}, - "target_ip_address": {"key": "targetIPAddress", "type": "str"}, - "target_ip_address_type": {"key": "targetIPAddressType", "type": "str"}, - "target_subnet_name": {"key": "targetSubnetName", "type": "str"}, - "test_network_id": {"key": "testNetworkId", "type": "str"}, - "test_subnet_name": {"key": "testSubnetName", "type": "str"}, - "test_ip_address": {"key": "testIPAddress", "type": "str"}, - "test_ip_address_type": {"key": "testIPAddressType", "type": "str"}, - "target_nic_name": {"key": "targetNicName", "type": "str"}, - "is_selected_for_migration": {"key": "isSelectedForMigration", "type": "str"}, - } - - def __init__( - self, - *, - is_primary_nic: Optional[str] = None, - target_ip_address: Optional[str] = None, - target_ip_address_type: Optional[Union[str, "_models.EthernetAddressType"]] = None, - target_subnet_name: Optional[str] = None, - test_network_id: Optional[str] = None, - test_subnet_name: Optional[str] = None, - test_ip_address: Optional[str] = None, - test_ip_address_type: Optional[Union[str, "_models.EthernetAddressType"]] = None, - target_nic_name: Optional[str] = None, - is_selected_for_migration: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword is_primary_nic: A value indicating whether this is the primary NIC. - :paramtype is_primary_nic: str - :keyword target_ip_address: The target IP address. - :paramtype target_ip_address: str - :keyword target_ip_address_type: The target IP address type. Known values are: "Dynamic" and - "Static". - :paramtype target_ip_address_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.EthernetAddressType - :keyword target_subnet_name: Target subnet name. - :paramtype target_subnet_name: str - :keyword test_network_id: Source network Id. - :paramtype test_network_id: str - :keyword test_subnet_name: Test subnet name. - :paramtype test_subnet_name: str - :keyword test_ip_address: The test IP address. - :paramtype test_ip_address: str - :keyword test_ip_address_type: The test IP address type. Known values are: "Dynamic" and - "Static". - :paramtype test_ip_address_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.EthernetAddressType - :keyword target_nic_name: Target NIC name. - :paramtype target_nic_name: str - :keyword is_selected_for_migration: A value indicating whether this NIC is selected for - migration. - :paramtype is_selected_for_migration: str - """ - super().__init__(**kwargs) - self.nic_id: Optional[str] = None - self.is_primary_nic = is_primary_nic - self.source_ip_address: Optional[str] = None - self.source_ip_address_type: Optional[Union[str, "_models.EthernetAddressType"]] = None - self.source_network_id: Optional[str] = None - self.target_ip_address = target_ip_address - self.target_ip_address_type = target_ip_address_type - self.target_subnet_name = target_subnet_name - self.test_network_id = test_network_id - self.test_subnet_name = test_subnet_name - self.test_ip_address = test_ip_address - self.test_ip_address_type = test_ip_address_type - self.target_nic_name = target_nic_name - self.is_selected_for_migration = is_selected_for_migration - - -class VMwareCbtNicInput(_serialization.Model): - """VMwareCbt NIC input. - - All required parameters must be populated in order to send to server. - - :ivar nic_id: The NIC Id. Required. - :vartype nic_id: str - :ivar is_primary_nic: A value indicating whether this is the primary NIC. Required. - :vartype is_primary_nic: str - :ivar target_subnet_name: Target subnet name. - :vartype target_subnet_name: str - :ivar target_static_ip_address: The static IP address. - :vartype target_static_ip_address: str - :ivar is_selected_for_migration: A value indicating whether this NIC is selected for migration. - :vartype is_selected_for_migration: str - :ivar target_nic_name: Target NIC name. - :vartype target_nic_name: str - :ivar test_subnet_name: The test subnet name. - :vartype test_subnet_name: str - :ivar test_static_ip_address: The test static IP address. - :vartype test_static_ip_address: str - """ - - _validation = { - "nic_id": {"required": True}, - "is_primary_nic": {"required": True}, - } - - _attribute_map = { - "nic_id": {"key": "nicId", "type": "str"}, - "is_primary_nic": {"key": "isPrimaryNic", "type": "str"}, - "target_subnet_name": {"key": "targetSubnetName", "type": "str"}, - "target_static_ip_address": {"key": "targetStaticIPAddress", "type": "str"}, - "is_selected_for_migration": {"key": "isSelectedForMigration", "type": "str"}, - "target_nic_name": {"key": "targetNicName", "type": "str"}, - "test_subnet_name": {"key": "testSubnetName", "type": "str"}, - "test_static_ip_address": {"key": "testStaticIPAddress", "type": "str"}, - } - - def __init__( - self, - *, - nic_id: str, - is_primary_nic: str, - target_subnet_name: Optional[str] = None, - target_static_ip_address: Optional[str] = None, - is_selected_for_migration: Optional[str] = None, - target_nic_name: Optional[str] = None, - test_subnet_name: Optional[str] = None, - test_static_ip_address: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword nic_id: The NIC Id. Required. - :paramtype nic_id: str - :keyword is_primary_nic: A value indicating whether this is the primary NIC. Required. - :paramtype is_primary_nic: str - :keyword target_subnet_name: Target subnet name. - :paramtype target_subnet_name: str - :keyword target_static_ip_address: The static IP address. - :paramtype target_static_ip_address: str - :keyword is_selected_for_migration: A value indicating whether this NIC is selected for - migration. - :paramtype is_selected_for_migration: str - :keyword target_nic_name: Target NIC name. - :paramtype target_nic_name: str - :keyword test_subnet_name: The test subnet name. - :paramtype test_subnet_name: str - :keyword test_static_ip_address: The test static IP address. - :paramtype test_static_ip_address: str - """ - super().__init__(**kwargs) - self.nic_id = nic_id - self.is_primary_nic = is_primary_nic - self.target_subnet_name = target_subnet_name - self.target_static_ip_address = target_static_ip_address - self.is_selected_for_migration = is_selected_for_migration - self.target_nic_name = target_nic_name - self.test_subnet_name = test_subnet_name - self.test_static_ip_address = test_static_ip_address - - -class VMwareCbtPolicyCreationInput(PolicyProviderSpecificInput): - """VMware Cbt policy creation input. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - :ivar recovery_point_history_in_minutes: The duration in minutes until which the recovery - points need to be stored. - :vartype recovery_point_history_in_minutes: int - :ivar crash_consistent_frequency_in_minutes: The crash consistent snapshot frequency (in - minutes). - :vartype crash_consistent_frequency_in_minutes: int - :ivar app_consistent_frequency_in_minutes: The app consistent snapshot frequency (in minutes). - :vartype app_consistent_frequency_in_minutes: int - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "recovery_point_history_in_minutes": {"key": "recoveryPointHistoryInMinutes", "type": "int"}, - "crash_consistent_frequency_in_minutes": {"key": "crashConsistentFrequencyInMinutes", "type": "int"}, - "app_consistent_frequency_in_minutes": {"key": "appConsistentFrequencyInMinutes", "type": "int"}, - } - - def __init__( - self, - *, - recovery_point_history_in_minutes: Optional[int] = None, - crash_consistent_frequency_in_minutes: Optional[int] = None, - app_consistent_frequency_in_minutes: Optional[int] = None, - **kwargs: Any - ) -> None: - """ - :keyword recovery_point_history_in_minutes: The duration in minutes until which the recovery - points need to be stored. - :paramtype recovery_point_history_in_minutes: int - :keyword crash_consistent_frequency_in_minutes: The crash consistent snapshot frequency (in - minutes). - :paramtype crash_consistent_frequency_in_minutes: int - :keyword app_consistent_frequency_in_minutes: The app consistent snapshot frequency (in - minutes). - :paramtype app_consistent_frequency_in_minutes: int - """ - super().__init__(**kwargs) - self.instance_type: str = "VMwareCbt" - self.recovery_point_history_in_minutes = recovery_point_history_in_minutes - self.crash_consistent_frequency_in_minutes = crash_consistent_frequency_in_minutes - self.app_consistent_frequency_in_minutes = app_consistent_frequency_in_minutes - - -class VmwareCbtPolicyDetails(PolicyProviderSpecificDetails): - """VMware Cbt specific policy details. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: Gets the class type. Overridden in derived classes. Required. - :vartype instance_type: str - :ivar recovery_point_history_in_minutes: The duration in minutes until which the recovery - points need to be stored. - :vartype recovery_point_history_in_minutes: int - :ivar app_consistent_frequency_in_minutes: The app consistent snapshot frequency in minutes. - :vartype app_consistent_frequency_in_minutes: int - :ivar crash_consistent_frequency_in_minutes: The crash consistent snapshot frequency in - minutes. - :vartype crash_consistent_frequency_in_minutes: int - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "recovery_point_history_in_minutes": {"key": "recoveryPointHistoryInMinutes", "type": "int"}, - "app_consistent_frequency_in_minutes": {"key": "appConsistentFrequencyInMinutes", "type": "int"}, - "crash_consistent_frequency_in_minutes": {"key": "crashConsistentFrequencyInMinutes", "type": "int"}, - } - - def __init__( - self, - *, - recovery_point_history_in_minutes: Optional[int] = None, - app_consistent_frequency_in_minutes: Optional[int] = None, - crash_consistent_frequency_in_minutes: Optional[int] = None, - **kwargs: Any - ) -> None: - """ - :keyword recovery_point_history_in_minutes: The duration in minutes until which the recovery - points need to be stored. - :paramtype recovery_point_history_in_minutes: int - :keyword app_consistent_frequency_in_minutes: The app consistent snapshot frequency in minutes. - :paramtype app_consistent_frequency_in_minutes: int - :keyword crash_consistent_frequency_in_minutes: The crash consistent snapshot frequency in - minutes. - :paramtype crash_consistent_frequency_in_minutes: int - """ - super().__init__(**kwargs) - self.instance_type: str = "VMwareCbt" - self.recovery_point_history_in_minutes = recovery_point_history_in_minutes - self.app_consistent_frequency_in_minutes = app_consistent_frequency_in_minutes - self.crash_consistent_frequency_in_minutes = crash_consistent_frequency_in_minutes - - -class VMwareCbtProtectedDiskDetails(_serialization.Model): - """VMwareCbt protected disk details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar disk_id: The disk id. - :vartype disk_id: str - :ivar disk_name: The disk name. - :vartype disk_name: str - :ivar disk_type: The disk type. Known values are: "Standard_LRS", "Premium_LRS", - "StandardSSD_LRS", "PremiumV2_LRS", "UltraSSD_LRS", "StandardSSD_ZRS", and "Premium_ZRS". - :vartype disk_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.DiskAccountType - :ivar disk_path: The disk path. - :vartype disk_path: str - :ivar is_os_disk: A value indicating whether the disk is the OS disk. - :vartype is_os_disk: str - :ivar capacity_in_bytes: The disk capacity in bytes. - :vartype capacity_in_bytes: int - :ivar log_storage_account_id: The log storage account ARM Id. - :vartype log_storage_account_id: str - :ivar log_storage_account_sas_secret_name: The key vault secret name of the log storage - account. - :vartype log_storage_account_sas_secret_name: str - :ivar disk_encryption_set_id: The DiskEncryptionSet ARM Id. - :vartype disk_encryption_set_id: str - :ivar seed_managed_disk_id: The ARM Id of the seed managed disk. - :vartype seed_managed_disk_id: str - :ivar seed_blob_uri: The uri of the seed blob. - :vartype seed_blob_uri: str - :ivar target_managed_disk_id: The ARM Id of the target managed disk. - :vartype target_managed_disk_id: str - :ivar target_blob_uri: The uri of the target blob. - :vartype target_blob_uri: str - :ivar target_disk_name: The name for the target managed disk. - :vartype target_disk_name: str - :ivar gateway_operation_details: A value indicating the gateway operation details. - :vartype gateway_operation_details: - ~azure.mgmt.recoveryservicessiterecovery.models.GatewayOperationDetails - :ivar sector_size_in_bytes: The logical sector size (in bytes), 512 by default. - :vartype sector_size_in_bytes: int - """ - - _validation = { - "disk_id": {"readonly": True}, - "disk_name": {"readonly": True}, - "disk_path": {"readonly": True}, - "is_os_disk": {"readonly": True}, - "capacity_in_bytes": {"readonly": True}, - "log_storage_account_id": {"readonly": True}, - "log_storage_account_sas_secret_name": {"readonly": True}, - "disk_encryption_set_id": {"readonly": True}, - "seed_managed_disk_id": {"readonly": True}, - "seed_blob_uri": {"readonly": True}, - "target_managed_disk_id": {"readonly": True}, - "target_blob_uri": {"readonly": True}, - "gateway_operation_details": {"readonly": True}, - } - - _attribute_map = { - "disk_id": {"key": "diskId", "type": "str"}, - "disk_name": {"key": "diskName", "type": "str"}, - "disk_type": {"key": "diskType", "type": "str"}, - "disk_path": {"key": "diskPath", "type": "str"}, - "is_os_disk": {"key": "isOSDisk", "type": "str"}, - "capacity_in_bytes": {"key": "capacityInBytes", "type": "int"}, - "log_storage_account_id": {"key": "logStorageAccountId", "type": "str"}, - "log_storage_account_sas_secret_name": {"key": "logStorageAccountSasSecretName", "type": "str"}, - "disk_encryption_set_id": {"key": "diskEncryptionSetId", "type": "str"}, - "seed_managed_disk_id": {"key": "seedManagedDiskId", "type": "str"}, - "seed_blob_uri": {"key": "seedBlobUri", "type": "str"}, - "target_managed_disk_id": {"key": "targetManagedDiskId", "type": "str"}, - "target_blob_uri": {"key": "targetBlobUri", "type": "str"}, - "target_disk_name": {"key": "targetDiskName", "type": "str"}, - "gateway_operation_details": {"key": "gatewayOperationDetails", "type": "GatewayOperationDetails"}, - "sector_size_in_bytes": {"key": "sectorSizeInBytes", "type": "int"}, - } - - def __init__( - self, - *, - disk_type: Optional[Union[str, "_models.DiskAccountType"]] = None, - target_disk_name: Optional[str] = None, - sector_size_in_bytes: Optional[int] = None, - **kwargs: Any - ) -> None: - """ - :keyword disk_type: The disk type. Known values are: "Standard_LRS", "Premium_LRS", - "StandardSSD_LRS", "PremiumV2_LRS", "UltraSSD_LRS", "StandardSSD_ZRS", and "Premium_ZRS". - :paramtype disk_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.DiskAccountType - :keyword target_disk_name: The name for the target managed disk. - :paramtype target_disk_name: str - :keyword sector_size_in_bytes: The logical sector size (in bytes), 512 by default. - :paramtype sector_size_in_bytes: int - """ - super().__init__(**kwargs) - self.disk_id: Optional[str] = None - self.disk_name: Optional[str] = None - self.disk_type = disk_type - self.disk_path: Optional[str] = None - self.is_os_disk: Optional[str] = None - self.capacity_in_bytes: Optional[int] = None - self.log_storage_account_id: Optional[str] = None - self.log_storage_account_sas_secret_name: Optional[str] = None - self.disk_encryption_set_id: Optional[str] = None - self.seed_managed_disk_id: Optional[str] = None - self.seed_blob_uri: Optional[str] = None - self.target_managed_disk_id: Optional[str] = None - self.target_blob_uri: Optional[str] = None - self.target_disk_name = target_disk_name - self.gateway_operation_details: Optional["_models.GatewayOperationDetails"] = None - self.sector_size_in_bytes = sector_size_in_bytes - - -class VMwareCbtProtectionContainerMappingDetails( - ProtectionContainerMappingProviderSpecificDetails -): # pylint: disable=name-too-long - """VMwareCbt provider specific container mapping details. - - 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 instance_type: Gets the class type. Overridden in derived classes. Required. - :vartype instance_type: str - :ivar key_vault_id: The target key vault ARM Id. - :vartype key_vault_id: str - :ivar key_vault_uri: The target key vault URI. - :vartype key_vault_uri: str - :ivar storage_account_id: The storage account ARM Id. - :vartype storage_account_id: str - :ivar storage_account_sas_secret_name: The secret name of the storage account. - :vartype storage_account_sas_secret_name: str - :ivar service_bus_connection_string_secret_name: The secret name of the service bus connection - string. - :vartype service_bus_connection_string_secret_name: str - :ivar target_location: The target location. - :vartype target_location: str - :ivar role_size_to_nic_count_map: The role size to NIC count map. - :vartype role_size_to_nic_count_map: dict[str, int] - :ivar excluded_skus: The SKUs to be excluded. - :vartype excluded_skus: list[str] - """ - - _validation = { - "instance_type": {"required": True}, - "key_vault_id": {"readonly": True}, - "key_vault_uri": {"readonly": True}, - "storage_account_id": {"readonly": True}, - "storage_account_sas_secret_name": {"readonly": True}, - "service_bus_connection_string_secret_name": {"readonly": True}, - "target_location": {"readonly": True}, - "role_size_to_nic_count_map": {"readonly": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "key_vault_id": {"key": "keyVaultId", "type": "str"}, - "key_vault_uri": {"key": "keyVaultUri", "type": "str"}, - "storage_account_id": {"key": "storageAccountId", "type": "str"}, - "storage_account_sas_secret_name": {"key": "storageAccountSasSecretName", "type": "str"}, - "service_bus_connection_string_secret_name": {"key": "serviceBusConnectionStringSecretName", "type": "str"}, - "target_location": {"key": "targetLocation", "type": "str"}, - "role_size_to_nic_count_map": {"key": "roleSizeToNicCountMap", "type": "{int}"}, - "excluded_skus": {"key": "excludedSkus", "type": "[str]"}, - } - - def __init__(self, *, excluded_skus: Optional[List[str]] = None, **kwargs: Any) -> None: - """ - :keyword excluded_skus: The SKUs to be excluded. - :paramtype excluded_skus: list[str] - """ - super().__init__(**kwargs) - self.instance_type: str = "VMwareCbt" - self.key_vault_id: Optional[str] = None - self.key_vault_uri: Optional[str] = None - self.storage_account_id: Optional[str] = None - self.storage_account_sas_secret_name: Optional[str] = None - self.service_bus_connection_string_secret_name: Optional[str] = None - self.target_location: Optional[str] = None - self.role_size_to_nic_count_map: Optional[Dict[str, int]] = None - self.excluded_skus = excluded_skus - - -class VMwareCbtResumeReplicationInput(ResumeReplicationProviderSpecificInput): - """VMwareCbt specific resume replication input. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - :ivar delete_migration_resources: A value indicating whether Migration resources to be deleted. - :vartype delete_migration_resources: str - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "delete_migration_resources": {"key": "deleteMigrationResources", "type": "str"}, - } - - def __init__(self, *, delete_migration_resources: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword delete_migration_resources: A value indicating whether Migration resources to be - deleted. - :paramtype delete_migration_resources: str - """ - super().__init__(**kwargs) - self.instance_type: str = "VMwareCbt" - self.delete_migration_resources = delete_migration_resources - - -class VMwareCbtResyncInput(ResyncProviderSpecificInput): - """VMwareCbt specific resync input. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - :ivar skip_cbt_reset: A value indicating whether CBT is to be reset. Required. - :vartype skip_cbt_reset: str - """ - - _validation = { - "instance_type": {"required": True}, - "skip_cbt_reset": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "skip_cbt_reset": {"key": "skipCbtReset", "type": "str"}, - } - - def __init__(self, *, skip_cbt_reset: str, **kwargs: Any) -> None: - """ - :keyword skip_cbt_reset: A value indicating whether CBT is to be reset. Required. - :paramtype skip_cbt_reset: str - """ - super().__init__(**kwargs) - self.instance_type: str = "VMwareCbt" - self.skip_cbt_reset = skip_cbt_reset - - -class VMwareCbtSecurityProfileProperties(_serialization.Model): - """VMwareCbt security profile input. - - :ivar target_vm_security_type: The target VM security type. Known values are: "None", - "TrustedLaunch", and "ConfidentialVM". - :vartype target_vm_security_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.SecurityType - :ivar is_target_vm_secure_boot_enabled: A value indicating whether secure boot to be enabled. - :vartype is_target_vm_secure_boot_enabled: str - :ivar is_target_vm_tpm_enabled: A value indicating whether trusted platform module to be - enabled. - :vartype is_target_vm_tpm_enabled: str - :ivar is_target_vm_integrity_monitoring_enabled: A value indicating whether integrity - monitoring to be enabled. - :vartype is_target_vm_integrity_monitoring_enabled: str - :ivar is_target_vm_confidential_encryption_enabled: A value indicating whether confidential - compute encryption to be enabled. - :vartype is_target_vm_confidential_encryption_enabled: str - """ - - _attribute_map = { - "target_vm_security_type": {"key": "targetVmSecurityType", "type": "str"}, - "is_target_vm_secure_boot_enabled": {"key": "isTargetVmSecureBootEnabled", "type": "str"}, - "is_target_vm_tpm_enabled": {"key": "isTargetVmTpmEnabled", "type": "str"}, - "is_target_vm_integrity_monitoring_enabled": {"key": "isTargetVmIntegrityMonitoringEnabled", "type": "str"}, - "is_target_vm_confidential_encryption_enabled": { - "key": "isTargetVmConfidentialEncryptionEnabled", - "type": "str", - }, - } - - def __init__( - self, - *, - target_vm_security_type: Optional[Union[str, "_models.SecurityType"]] = None, - is_target_vm_secure_boot_enabled: Optional[str] = None, - is_target_vm_tpm_enabled: Optional[str] = None, - is_target_vm_integrity_monitoring_enabled: Optional[str] = None, - is_target_vm_confidential_encryption_enabled: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword target_vm_security_type: The target VM security type. Known values are: "None", - "TrustedLaunch", and "ConfidentialVM". - :paramtype target_vm_security_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.SecurityType - :keyword is_target_vm_secure_boot_enabled: A value indicating whether secure boot to be - enabled. - :paramtype is_target_vm_secure_boot_enabled: str - :keyword is_target_vm_tpm_enabled: A value indicating whether trusted platform module to be - enabled. - :paramtype is_target_vm_tpm_enabled: str - :keyword is_target_vm_integrity_monitoring_enabled: A value indicating whether integrity - monitoring to be enabled. - :paramtype is_target_vm_integrity_monitoring_enabled: str - :keyword is_target_vm_confidential_encryption_enabled: A value indicating whether confidential - compute encryption to be enabled. - :paramtype is_target_vm_confidential_encryption_enabled: str - """ - super().__init__(**kwargs) - self.target_vm_security_type = target_vm_security_type - self.is_target_vm_secure_boot_enabled = is_target_vm_secure_boot_enabled - self.is_target_vm_tpm_enabled = is_target_vm_tpm_enabled - self.is_target_vm_integrity_monitoring_enabled = is_target_vm_integrity_monitoring_enabled - self.is_target_vm_confidential_encryption_enabled = is_target_vm_confidential_encryption_enabled - - -class VMwareCbtTestMigrateInput(TestMigrateProviderSpecificInput): - """VMwareCbt specific test migrate input. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - :ivar recovery_point_id: The recovery point Id. Required. - :vartype recovery_point_id: str - :ivar network_id: The test network Id. Required. - :vartype network_id: str - :ivar vm_nics: The list of NIC details. - :vartype vm_nics: list[~azure.mgmt.recoveryservicessiterecovery.models.VMwareCbtNicInput] - :ivar os_upgrade_version: A value indicating the inplace OS Upgrade version. - :vartype os_upgrade_version: str - :ivar post_migration_steps: The managed run command script input. - :vartype post_migration_steps: - list[~azure.mgmt.recoveryservicessiterecovery.models.ManagedRunCommandScriptInput] - """ - - _validation = { - "instance_type": {"required": True}, - "recovery_point_id": {"required": True}, - "network_id": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "recovery_point_id": {"key": "recoveryPointId", "type": "str"}, - "network_id": {"key": "networkId", "type": "str"}, - "vm_nics": {"key": "vmNics", "type": "[VMwareCbtNicInput]"}, - "os_upgrade_version": {"key": "osUpgradeVersion", "type": "str"}, - "post_migration_steps": {"key": "postMigrationSteps", "type": "[ManagedRunCommandScriptInput]"}, - } - - def __init__( - self, - *, - recovery_point_id: str, - network_id: str, - vm_nics: Optional[List["_models.VMwareCbtNicInput"]] = None, - os_upgrade_version: Optional[str] = None, - post_migration_steps: Optional[List["_models.ManagedRunCommandScriptInput"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword recovery_point_id: The recovery point Id. Required. - :paramtype recovery_point_id: str - :keyword network_id: The test network Id. Required. - :paramtype network_id: str - :keyword vm_nics: The list of NIC details. - :paramtype vm_nics: list[~azure.mgmt.recoveryservicessiterecovery.models.VMwareCbtNicInput] - :keyword os_upgrade_version: A value indicating the inplace OS Upgrade version. - :paramtype os_upgrade_version: str - :keyword post_migration_steps: The managed run command script input. - :paramtype post_migration_steps: - list[~azure.mgmt.recoveryservicessiterecovery.models.ManagedRunCommandScriptInput] - """ - super().__init__(**kwargs) - self.instance_type: str = "VMwareCbt" - self.recovery_point_id = recovery_point_id - self.network_id = network_id - self.vm_nics = vm_nics - self.os_upgrade_version = os_upgrade_version - self.post_migration_steps = post_migration_steps - - -class VMwareCbtUpdateDiskInput(_serialization.Model): - """VMwareCbt disk input for update. - - All required parameters must be populated in order to send to server. - - :ivar disk_id: The disk Id. Required. - :vartype disk_id: str - :ivar target_disk_name: The target disk name. - :vartype target_disk_name: str - :ivar is_os_disk: A value indicating whether the disk is the OS disk. - :vartype is_os_disk: str - """ - - _validation = { - "disk_id": {"required": True}, - } - - _attribute_map = { - "disk_id": {"key": "diskId", "type": "str"}, - "target_disk_name": {"key": "targetDiskName", "type": "str"}, - "is_os_disk": {"key": "isOSDisk", "type": "str"}, - } - - def __init__( - self, *, disk_id: str, target_disk_name: Optional[str] = None, is_os_disk: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword disk_id: The disk Id. Required. - :paramtype disk_id: str - :keyword target_disk_name: The target disk name. - :paramtype target_disk_name: str - :keyword is_os_disk: A value indicating whether the disk is the OS disk. - :paramtype is_os_disk: str - """ - super().__init__(**kwargs) - self.disk_id = disk_id - self.target_disk_name = target_disk_name - self.is_os_disk = is_os_disk - - -class VMwareCbtUpdateMigrationItemInput(UpdateMigrationItemProviderSpecificInput): - """VMwareCbt specific update migration item input. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: The class type. Required. - :vartype instance_type: str - :ivar target_vm_name: The target VM name. - :vartype target_vm_name: str - :ivar target_vm_size: The target VM size. - :vartype target_vm_size: str - :ivar target_resource_group_id: The target resource group ARM Id. - :vartype target_resource_group_id: str - :ivar target_availability_set_id: The target availability set ARM Id. - :vartype target_availability_set_id: str - :ivar target_availability_zone: The target availability zone. - :vartype target_availability_zone: str - :ivar target_proximity_placement_group_id: The target proximity placement group ARM Id. - :vartype target_proximity_placement_group_id: str - :ivar target_boot_diagnostics_storage_account_id: The target boot diagnostics storage account - ARM Id. - :vartype target_boot_diagnostics_storage_account_id: str - :ivar target_network_id: The target network ARM Id. - :vartype target_network_id: str - :ivar test_network_id: The test network ARM Id. - :vartype test_network_id: str - :ivar vm_nics: The list of NIC details. - :vartype vm_nics: list[~azure.mgmt.recoveryservicessiterecovery.models.VMwareCbtNicInput] - :ivar vm_disks: The list of disk update properties. - :vartype vm_disks: - list[~azure.mgmt.recoveryservicessiterecovery.models.VMwareCbtUpdateDiskInput] - :ivar license_type: The license type. Known values are: "NotSpecified", "NoLicenseType", and - "WindowsServer". - :vartype license_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.LicenseType - :ivar sql_server_license_type: The SQL Server license type. Known values are: "NotSpecified", - "NoLicenseType", "PAYG", and "AHUB". - :vartype sql_server_license_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.SqlServerLicenseType - :ivar linux_license_type: The license type for Linux VM's. Known values are: "NotSpecified", - "NoLicenseType", and "LinuxServer". - :vartype linux_license_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.LinuxLicenseType - :ivar user_selected_os_name: The OS name selected by user. - :vartype user_selected_os_name: str - :ivar perform_auto_resync: A value indicating whether auto resync is to be done. - :vartype perform_auto_resync: str - :ivar target_vm_tags: The target VM tags. - :vartype target_vm_tags: dict[str, str] - :ivar target_disk_tags: The tags for the target disks. - :vartype target_disk_tags: dict[str, str] - :ivar target_nic_tags: The tags for the target NICs. - :vartype target_nic_tags: dict[str, str] - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "target_vm_name": {"key": "targetVmName", "type": "str"}, - "target_vm_size": {"key": "targetVmSize", "type": "str"}, - "target_resource_group_id": {"key": "targetResourceGroupId", "type": "str"}, - "target_availability_set_id": {"key": "targetAvailabilitySetId", "type": "str"}, - "target_availability_zone": {"key": "targetAvailabilityZone", "type": "str"}, - "target_proximity_placement_group_id": {"key": "targetProximityPlacementGroupId", "type": "str"}, - "target_boot_diagnostics_storage_account_id": {"key": "targetBootDiagnosticsStorageAccountId", "type": "str"}, - "target_network_id": {"key": "targetNetworkId", "type": "str"}, - "test_network_id": {"key": "testNetworkId", "type": "str"}, - "vm_nics": {"key": "vmNics", "type": "[VMwareCbtNicInput]"}, - "vm_disks": {"key": "vmDisks", "type": "[VMwareCbtUpdateDiskInput]"}, - "license_type": {"key": "licenseType", "type": "str"}, - "sql_server_license_type": {"key": "sqlServerLicenseType", "type": "str"}, - "linux_license_type": {"key": "linuxLicenseType", "type": "str"}, - "user_selected_os_name": {"key": "userSelectedOSName", "type": "str"}, - "perform_auto_resync": {"key": "performAutoResync", "type": "str"}, - "target_vm_tags": {"key": "targetVmTags", "type": "{str}"}, - "target_disk_tags": {"key": "targetDiskTags", "type": "{str}"}, - "target_nic_tags": {"key": "targetNicTags", "type": "{str}"}, - } - - def __init__( - self, - *, - target_vm_name: Optional[str] = None, - target_vm_size: Optional[str] = None, - target_resource_group_id: Optional[str] = None, - target_availability_set_id: Optional[str] = None, - target_availability_zone: Optional[str] = None, - target_proximity_placement_group_id: Optional[str] = None, - target_boot_diagnostics_storage_account_id: Optional[str] = None, - target_network_id: Optional[str] = None, - test_network_id: Optional[str] = None, - vm_nics: Optional[List["_models.VMwareCbtNicInput"]] = None, - vm_disks: Optional[List["_models.VMwareCbtUpdateDiskInput"]] = None, - license_type: Optional[Union[str, "_models.LicenseType"]] = None, - sql_server_license_type: Optional[Union[str, "_models.SqlServerLicenseType"]] = None, - linux_license_type: Optional[Union[str, "_models.LinuxLicenseType"]] = None, - user_selected_os_name: Optional[str] = None, - perform_auto_resync: Optional[str] = None, - target_vm_tags: Optional[Dict[str, str]] = None, - target_disk_tags: Optional[Dict[str, str]] = None, - target_nic_tags: Optional[Dict[str, str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword target_vm_name: The target VM name. - :paramtype target_vm_name: str - :keyword target_vm_size: The target VM size. - :paramtype target_vm_size: str - :keyword target_resource_group_id: The target resource group ARM Id. - :paramtype target_resource_group_id: str - :keyword target_availability_set_id: The target availability set ARM Id. - :paramtype target_availability_set_id: str - :keyword target_availability_zone: The target availability zone. - :paramtype target_availability_zone: str - :keyword target_proximity_placement_group_id: The target proximity placement group ARM Id. - :paramtype target_proximity_placement_group_id: str - :keyword target_boot_diagnostics_storage_account_id: The target boot diagnostics storage - account ARM Id. - :paramtype target_boot_diagnostics_storage_account_id: str - :keyword target_network_id: The target network ARM Id. - :paramtype target_network_id: str - :keyword test_network_id: The test network ARM Id. - :paramtype test_network_id: str - :keyword vm_nics: The list of NIC details. - :paramtype vm_nics: list[~azure.mgmt.recoveryservicessiterecovery.models.VMwareCbtNicInput] - :keyword vm_disks: The list of disk update properties. - :paramtype vm_disks: - list[~azure.mgmt.recoveryservicessiterecovery.models.VMwareCbtUpdateDiskInput] - :keyword license_type: The license type. Known values are: "NotSpecified", "NoLicenseType", and - "WindowsServer". - :paramtype license_type: str or ~azure.mgmt.recoveryservicessiterecovery.models.LicenseType - :keyword sql_server_license_type: The SQL Server license type. Known values are: - "NotSpecified", "NoLicenseType", "PAYG", and "AHUB". - :paramtype sql_server_license_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.SqlServerLicenseType - :keyword linux_license_type: The license type for Linux VM's. Known values are: "NotSpecified", - "NoLicenseType", and "LinuxServer". - :paramtype linux_license_type: str or - ~azure.mgmt.recoveryservicessiterecovery.models.LinuxLicenseType - :keyword user_selected_os_name: The OS name selected by user. - :paramtype user_selected_os_name: str - :keyword perform_auto_resync: A value indicating whether auto resync is to be done. - :paramtype perform_auto_resync: str - :keyword target_vm_tags: The target VM tags. - :paramtype target_vm_tags: dict[str, str] - :keyword target_disk_tags: The tags for the target disks. - :paramtype target_disk_tags: dict[str, str] - :keyword target_nic_tags: The tags for the target NICs. - :paramtype target_nic_tags: dict[str, str] - """ - super().__init__(**kwargs) - self.instance_type: str = "VMwareCbt" - self.target_vm_name = target_vm_name - self.target_vm_size = target_vm_size - self.target_resource_group_id = target_resource_group_id - self.target_availability_set_id = target_availability_set_id - self.target_availability_zone = target_availability_zone - self.target_proximity_placement_group_id = target_proximity_placement_group_id - self.target_boot_diagnostics_storage_account_id = target_boot_diagnostics_storage_account_id - self.target_network_id = target_network_id - self.test_network_id = test_network_id - self.vm_nics = vm_nics - self.vm_disks = vm_disks - self.license_type = license_type - self.sql_server_license_type = sql_server_license_type - self.linux_license_type = linux_license_type - self.user_selected_os_name = user_selected_os_name - self.perform_auto_resync = perform_auto_resync - self.target_vm_tags = target_vm_tags - self.target_disk_tags = target_disk_tags - self.target_nic_tags = target_nic_tags - - -class VMwareDetails(FabricSpecificDetails): - """Store the fabric details specific to the VMware fabric. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: Gets the class type. Overridden in derived classes. Required. - :vartype instance_type: str - :ivar process_servers: The list of Process Servers associated with the fabric. - :vartype process_servers: list[~azure.mgmt.recoveryservicessiterecovery.models.ProcessServer] - :ivar master_target_servers: The list of Master Target servers associated with the fabric. - :vartype master_target_servers: - list[~azure.mgmt.recoveryservicessiterecovery.models.MasterTargetServer] - :ivar run_as_accounts: The list of run as accounts created on the server. - :vartype run_as_accounts: list[~azure.mgmt.recoveryservicessiterecovery.models.RunAsAccount] - :ivar replication_pair_count: The number of replication pairs configured in this CS. - :vartype replication_pair_count: str - :ivar process_server_count: The number of process servers. - :vartype process_server_count: str - :ivar agent_count: The number of source and target servers configured to talk to this CS. - :vartype agent_count: str - :ivar protected_servers: The number of protected servers. - :vartype protected_servers: str - :ivar system_load: The percentage of the system load. - :vartype system_load: str - :ivar system_load_status: The system load status. - :vartype system_load_status: str - :ivar cpu_load: The percentage of the CPU load. - :vartype cpu_load: str - :ivar cpu_load_status: The CPU load status. - :vartype cpu_load_status: str - :ivar total_memory_in_bytes: The total memory. - :vartype total_memory_in_bytes: int - :ivar available_memory_in_bytes: The available memory. - :vartype available_memory_in_bytes: int - :ivar memory_usage_status: The memory usage status. - :vartype memory_usage_status: str - :ivar total_space_in_bytes: The total space. - :vartype total_space_in_bytes: int - :ivar available_space_in_bytes: The available space. - :vartype available_space_in_bytes: int - :ivar space_usage_status: The space usage status. - :vartype space_usage_status: str - :ivar web_load: The web load. - :vartype web_load: str - :ivar web_load_status: The web load status. - :vartype web_load_status: str - :ivar database_server_load: The database server load. - :vartype database_server_load: str - :ivar database_server_load_status: The database server load status. - :vartype database_server_load_status: str - :ivar cs_service_status: The CS service status. - :vartype cs_service_status: str - :ivar ip_address: The IP address. - :vartype ip_address: str - :ivar agent_version: The agent Version. - :vartype agent_version: str - :ivar host_name: The host name. - :vartype host_name: str - :ivar last_heartbeat: The last heartbeat received from CS server. - :vartype last_heartbeat: ~datetime.datetime - :ivar version_status: Version status. - :vartype version_status: str - :ivar ssl_cert_expiry_date: CS SSL cert expiry date. - :vartype ssl_cert_expiry_date: ~datetime.datetime - :ivar ssl_cert_expiry_remaining_days: CS SSL cert expiry date. - :vartype ssl_cert_expiry_remaining_days: int - :ivar ps_template_version: PS template version. - :vartype ps_template_version: str - :ivar agent_expiry_date: Agent expiry date. - :vartype agent_expiry_date: ~datetime.datetime - :ivar agent_version_details: The agent version details. - :vartype agent_version_details: ~azure.mgmt.recoveryservicessiterecovery.models.VersionDetails - :ivar switch_provider_blocking_error_details: The switch provider blocking error information. - :vartype switch_provider_blocking_error_details: - list[~azure.mgmt.recoveryservicessiterecovery.models.InMageFabricSwitchProviderBlockingErrorDetails] - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "process_servers": {"key": "processServers", "type": "[ProcessServer]"}, - "master_target_servers": {"key": "masterTargetServers", "type": "[MasterTargetServer]"}, - "run_as_accounts": {"key": "runAsAccounts", "type": "[RunAsAccount]"}, - "replication_pair_count": {"key": "replicationPairCount", "type": "str"}, - "process_server_count": {"key": "processServerCount", "type": "str"}, - "agent_count": {"key": "agentCount", "type": "str"}, - "protected_servers": {"key": "protectedServers", "type": "str"}, - "system_load": {"key": "systemLoad", "type": "str"}, - "system_load_status": {"key": "systemLoadStatus", "type": "str"}, - "cpu_load": {"key": "cpuLoad", "type": "str"}, - "cpu_load_status": {"key": "cpuLoadStatus", "type": "str"}, - "total_memory_in_bytes": {"key": "totalMemoryInBytes", "type": "int"}, - "available_memory_in_bytes": {"key": "availableMemoryInBytes", "type": "int"}, - "memory_usage_status": {"key": "memoryUsageStatus", "type": "str"}, - "total_space_in_bytes": {"key": "totalSpaceInBytes", "type": "int"}, - "available_space_in_bytes": {"key": "availableSpaceInBytes", "type": "int"}, - "space_usage_status": {"key": "spaceUsageStatus", "type": "str"}, - "web_load": {"key": "webLoad", "type": "str"}, - "web_load_status": {"key": "webLoadStatus", "type": "str"}, - "database_server_load": {"key": "databaseServerLoad", "type": "str"}, - "database_server_load_status": {"key": "databaseServerLoadStatus", "type": "str"}, - "cs_service_status": {"key": "csServiceStatus", "type": "str"}, - "ip_address": {"key": "ipAddress", "type": "str"}, - "agent_version": {"key": "agentVersion", "type": "str"}, - "host_name": {"key": "hostName", "type": "str"}, - "last_heartbeat": {"key": "lastHeartbeat", "type": "iso-8601"}, - "version_status": {"key": "versionStatus", "type": "str"}, - "ssl_cert_expiry_date": {"key": "sslCertExpiryDate", "type": "iso-8601"}, - "ssl_cert_expiry_remaining_days": {"key": "sslCertExpiryRemainingDays", "type": "int"}, - "ps_template_version": {"key": "psTemplateVersion", "type": "str"}, - "agent_expiry_date": {"key": "agentExpiryDate", "type": "iso-8601"}, - "agent_version_details": {"key": "agentVersionDetails", "type": "VersionDetails"}, - "switch_provider_blocking_error_details": { - "key": "switchProviderBlockingErrorDetails", - "type": "[InMageFabricSwitchProviderBlockingErrorDetails]", - }, - } - - def __init__( # pylint: disable=too-many-locals - self, - *, - process_servers: Optional[List["_models.ProcessServer"]] = None, - master_target_servers: Optional[List["_models.MasterTargetServer"]] = None, - run_as_accounts: Optional[List["_models.RunAsAccount"]] = None, - replication_pair_count: Optional[str] = None, - process_server_count: Optional[str] = None, - agent_count: Optional[str] = None, - protected_servers: Optional[str] = None, - system_load: Optional[str] = None, - system_load_status: Optional[str] = None, - cpu_load: Optional[str] = None, - cpu_load_status: Optional[str] = None, - total_memory_in_bytes: Optional[int] = None, - available_memory_in_bytes: Optional[int] = None, - memory_usage_status: Optional[str] = None, - total_space_in_bytes: Optional[int] = None, - available_space_in_bytes: Optional[int] = None, - space_usage_status: Optional[str] = None, - web_load: Optional[str] = None, - web_load_status: Optional[str] = None, - database_server_load: Optional[str] = None, - database_server_load_status: Optional[str] = None, - cs_service_status: Optional[str] = None, - ip_address: Optional[str] = None, - agent_version: Optional[str] = None, - host_name: Optional[str] = None, - last_heartbeat: Optional[datetime.datetime] = None, - version_status: Optional[str] = None, - ssl_cert_expiry_date: Optional[datetime.datetime] = None, - ssl_cert_expiry_remaining_days: Optional[int] = None, - ps_template_version: Optional[str] = None, - agent_expiry_date: Optional[datetime.datetime] = None, - agent_version_details: Optional["_models.VersionDetails"] = None, - switch_provider_blocking_error_details: Optional[ - List["_models.InMageFabricSwitchProviderBlockingErrorDetails"] - ] = None, - **kwargs: Any - ) -> None: - """ - :keyword process_servers: The list of Process Servers associated with the fabric. - :paramtype process_servers: list[~azure.mgmt.recoveryservicessiterecovery.models.ProcessServer] - :keyword master_target_servers: The list of Master Target servers associated with the fabric. - :paramtype master_target_servers: - list[~azure.mgmt.recoveryservicessiterecovery.models.MasterTargetServer] - :keyword run_as_accounts: The list of run as accounts created on the server. - :paramtype run_as_accounts: list[~azure.mgmt.recoveryservicessiterecovery.models.RunAsAccount] - :keyword replication_pair_count: The number of replication pairs configured in this CS. - :paramtype replication_pair_count: str - :keyword process_server_count: The number of process servers. - :paramtype process_server_count: str - :keyword agent_count: The number of source and target servers configured to talk to this CS. - :paramtype agent_count: str - :keyword protected_servers: The number of protected servers. - :paramtype protected_servers: str - :keyword system_load: The percentage of the system load. - :paramtype system_load: str - :keyword system_load_status: The system load status. - :paramtype system_load_status: str - :keyword cpu_load: The percentage of the CPU load. - :paramtype cpu_load: str - :keyword cpu_load_status: The CPU load status. - :paramtype cpu_load_status: str - :keyword total_memory_in_bytes: The total memory. - :paramtype total_memory_in_bytes: int - :keyword available_memory_in_bytes: The available memory. - :paramtype available_memory_in_bytes: int - :keyword memory_usage_status: The memory usage status. - :paramtype memory_usage_status: str - :keyword total_space_in_bytes: The total space. - :paramtype total_space_in_bytes: int - :keyword available_space_in_bytes: The available space. - :paramtype available_space_in_bytes: int - :keyword space_usage_status: The space usage status. - :paramtype space_usage_status: str - :keyword web_load: The web load. - :paramtype web_load: str - :keyword web_load_status: The web load status. - :paramtype web_load_status: str - :keyword database_server_load: The database server load. - :paramtype database_server_load: str - :keyword database_server_load_status: The database server load status. - :paramtype database_server_load_status: str - :keyword cs_service_status: The CS service status. - :paramtype cs_service_status: str - :keyword ip_address: The IP address. - :paramtype ip_address: str - :keyword agent_version: The agent Version. - :paramtype agent_version: str - :keyword host_name: The host name. - :paramtype host_name: str - :keyword last_heartbeat: The last heartbeat received from CS server. - :paramtype last_heartbeat: ~datetime.datetime - :keyword version_status: Version status. - :paramtype version_status: str - :keyword ssl_cert_expiry_date: CS SSL cert expiry date. - :paramtype ssl_cert_expiry_date: ~datetime.datetime - :keyword ssl_cert_expiry_remaining_days: CS SSL cert expiry date. - :paramtype ssl_cert_expiry_remaining_days: int - :keyword ps_template_version: PS template version. - :paramtype ps_template_version: str - :keyword agent_expiry_date: Agent expiry date. - :paramtype agent_expiry_date: ~datetime.datetime - :keyword agent_version_details: The agent version details. - :paramtype agent_version_details: - ~azure.mgmt.recoveryservicessiterecovery.models.VersionDetails - :keyword switch_provider_blocking_error_details: The switch provider blocking error - information. - :paramtype switch_provider_blocking_error_details: - list[~azure.mgmt.recoveryservicessiterecovery.models.InMageFabricSwitchProviderBlockingErrorDetails] - """ - super().__init__(**kwargs) - self.instance_type: str = "VMware" - self.process_servers = process_servers - self.master_target_servers = master_target_servers - self.run_as_accounts = run_as_accounts - self.replication_pair_count = replication_pair_count - self.process_server_count = process_server_count - self.agent_count = agent_count - self.protected_servers = protected_servers - self.system_load = system_load - self.system_load_status = system_load_status - self.cpu_load = cpu_load - self.cpu_load_status = cpu_load_status - self.total_memory_in_bytes = total_memory_in_bytes - self.available_memory_in_bytes = available_memory_in_bytes - self.memory_usage_status = memory_usage_status - self.total_space_in_bytes = total_space_in_bytes - self.available_space_in_bytes = available_space_in_bytes - self.space_usage_status = space_usage_status - self.web_load = web_load - self.web_load_status = web_load_status - self.database_server_load = database_server_load - self.database_server_load_status = database_server_load_status - self.cs_service_status = cs_service_status - self.ip_address = ip_address - self.agent_version = agent_version - self.host_name = host_name - self.last_heartbeat = last_heartbeat - self.version_status = version_status - self.ssl_cert_expiry_date = ssl_cert_expiry_date - self.ssl_cert_expiry_remaining_days = ssl_cert_expiry_remaining_days - self.ps_template_version = ps_template_version - self.agent_expiry_date = agent_expiry_date - self.agent_version_details = agent_version_details - self.switch_provider_blocking_error_details = switch_provider_blocking_error_details - - -class VMwareV2FabricCreationInput(FabricSpecificCreationInput): - """VMwareV2 fabric provider specific settings. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: Gets the class type. Required. - :vartype instance_type: str - :ivar vmware_site_id: The ARM Id of the VMware site. - :vartype vmware_site_id: str - :ivar physical_site_id: The ARM Id of the physical site. - :vartype physical_site_id: str - :ivar migration_solution_id: The ARM Id of the migration solution. Required. - :vartype migration_solution_id: str - """ - - _validation = { - "instance_type": {"required": True}, - "migration_solution_id": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "vmware_site_id": {"key": "vmwareSiteId", "type": "str"}, - "physical_site_id": {"key": "physicalSiteId", "type": "str"}, - "migration_solution_id": {"key": "migrationSolutionId", "type": "str"}, - } - - def __init__( - self, - *, - migration_solution_id: str, - vmware_site_id: Optional[str] = None, - physical_site_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword vmware_site_id: The ARM Id of the VMware site. - :paramtype vmware_site_id: str - :keyword physical_site_id: The ARM Id of the physical site. - :paramtype physical_site_id: str - :keyword migration_solution_id: The ARM Id of the migration solution. Required. - :paramtype migration_solution_id: str - """ - super().__init__(**kwargs) - self.instance_type: str = "VMwareV2" - self.vmware_site_id = vmware_site_id - self.physical_site_id = physical_site_id - self.migration_solution_id = migration_solution_id - - -class VMwareV2FabricSpecificDetails(FabricSpecificDetails): - """VMwareV2 fabric specific details. - - 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 instance_type: Gets the class type. Overridden in derived classes. Required. - :vartype instance_type: str - :ivar vmware_site_id: The ARM Id of the VMware site. - :vartype vmware_site_id: str - :ivar physical_site_id: The ARM Id of the physical site. - :vartype physical_site_id: str - :ivar migration_solution_id: The Migration solution ARM Id. - :vartype migration_solution_id: str - :ivar service_endpoint: The service endpoint. - :vartype service_endpoint: str - :ivar service_resource_id: The service resource Id. - :vartype service_resource_id: str - :ivar service_container_id: The service container Id. - :vartype service_container_id: str - :ivar process_servers: The list of process servers. - :vartype process_servers: - list[~azure.mgmt.recoveryservicessiterecovery.models.ProcessServerDetails] - """ - - _validation = { - "instance_type": {"required": True}, - "vmware_site_id": {"readonly": True}, - "physical_site_id": {"readonly": True}, - "migration_solution_id": {"readonly": True}, - "service_endpoint": {"readonly": True}, - "service_resource_id": {"readonly": True}, - "service_container_id": {"readonly": True}, - "process_servers": {"readonly": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "vmware_site_id": {"key": "vmwareSiteId", "type": "str"}, - "physical_site_id": {"key": "physicalSiteId", "type": "str"}, - "migration_solution_id": {"key": "migrationSolutionId", "type": "str"}, - "service_endpoint": {"key": "serviceEndpoint", "type": "str"}, - "service_resource_id": {"key": "serviceResourceId", "type": "str"}, - "service_container_id": {"key": "serviceContainerId", "type": "str"}, - "process_servers": {"key": "processServers", "type": "[ProcessServerDetails]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.instance_type: str = "VMwareV2" - self.vmware_site_id: Optional[str] = None - self.physical_site_id: Optional[str] = None - self.migration_solution_id: Optional[str] = None - self.service_endpoint: Optional[str] = None - self.service_resource_id: Optional[str] = None - self.service_container_id: Optional[str] = None - self.process_servers: Optional[List["_models.ProcessServerDetails"]] = None - - -class VMwareVirtualMachineDetails(ConfigurationSettings): - """VMware provider specific settings. - - All required parameters must be populated in order to send to server. - - :ivar instance_type: Gets the class type. Overridden in derived classes. Required. - :vartype instance_type: str - :ivar agent_generated_id: The ID generated by the InMage agent after it gets installed on - guest. This is the ID to be used during InMage CreateProtection. - :vartype agent_generated_id: str - :ivar agent_installed: The value indicating if InMage scout agent is installed on guest. - :vartype agent_installed: str - :ivar os_type: The OsType installed on VM. - :vartype os_type: str - :ivar agent_version: The agent version. - :vartype agent_version: str - :ivar ip_address: The IP address. - :vartype ip_address: str - :ivar powered_on: The value indicating whether VM is powered on. - :vartype powered_on: str - :ivar v_center_infrastructure_id: The VCenter infrastructure Id. - :vartype v_center_infrastructure_id: str - :ivar discovery_type: A value indicating the discovery type of the machine. Value can be - vCenter or physical. - :vartype discovery_type: str - :ivar disk_details: The disk details. - :vartype disk_details: list[~azure.mgmt.recoveryservicessiterecovery.models.InMageDiskDetails] - :ivar validation_errors: The validation errors. - :vartype validation_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] - """ - - _validation = { - "instance_type": {"required": True}, - } - - _attribute_map = { - "instance_type": {"key": "instanceType", "type": "str"}, - "agent_generated_id": {"key": "agentGeneratedId", "type": "str"}, - "agent_installed": {"key": "agentInstalled", "type": "str"}, - "os_type": {"key": "osType", "type": "str"}, - "agent_version": {"key": "agentVersion", "type": "str"}, - "ip_address": {"key": "ipAddress", "type": "str"}, - "powered_on": {"key": "poweredOn", "type": "str"}, - "v_center_infrastructure_id": {"key": "vCenterInfrastructureId", "type": "str"}, - "discovery_type": {"key": "discoveryType", "type": "str"}, - "disk_details": {"key": "diskDetails", "type": "[InMageDiskDetails]"}, - "validation_errors": {"key": "validationErrors", "type": "[HealthError]"}, - } - - def __init__( - self, - *, - agent_generated_id: Optional[str] = None, - agent_installed: Optional[str] = None, - os_type: Optional[str] = None, - agent_version: Optional[str] = None, - ip_address: Optional[str] = None, - powered_on: Optional[str] = None, - v_center_infrastructure_id: Optional[str] = None, - discovery_type: Optional[str] = None, - disk_details: Optional[List["_models.InMageDiskDetails"]] = None, - validation_errors: Optional[List["_models.HealthError"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword agent_generated_id: The ID generated by the InMage agent after it gets installed on - guest. This is the ID to be used during InMage CreateProtection. - :paramtype agent_generated_id: str - :keyword agent_installed: The value indicating if InMage scout agent is installed on guest. - :paramtype agent_installed: str - :keyword os_type: The OsType installed on VM. - :paramtype os_type: str - :keyword agent_version: The agent version. - :paramtype agent_version: str - :keyword ip_address: The IP address. - :paramtype ip_address: str - :keyword powered_on: The value indicating whether VM is powered on. - :paramtype powered_on: str - :keyword v_center_infrastructure_id: The VCenter infrastructure Id. - :paramtype v_center_infrastructure_id: str - :keyword discovery_type: A value indicating the discovery type of the machine. Value can be - vCenter or physical. - :paramtype discovery_type: str - :keyword disk_details: The disk details. - :paramtype disk_details: - list[~azure.mgmt.recoveryservicessiterecovery.models.InMageDiskDetails] - :keyword validation_errors: The validation errors. - :paramtype validation_errors: list[~azure.mgmt.recoveryservicessiterecovery.models.HealthError] - """ - super().__init__(**kwargs) - self.instance_type: str = "VMwareVirtualMachine" - self.agent_generated_id = agent_generated_id - self.agent_installed = agent_installed - self.os_type = os_type - self.agent_version = agent_version - self.ip_address = ip_address - self.powered_on = powered_on - self.v_center_infrastructure_id = v_center_infrastructure_id - self.discovery_type = discovery_type - self.disk_details = disk_details - self.validation_errors = validation_errors diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/models/_patch.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/models/_patch.py index f7dd32510333..87676c65a8f0 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/models/_patch.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/models/_patch.py @@ -1,14 +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/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/__init__.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/__init__.py index f9d1125f15d2..3e6f6221aa66 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/__init__.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/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 @@ -13,46 +12,51 @@ if TYPE_CHECKING: from ._patch import * # pylint: disable=unused-wildcard-import +from ._operations import MigrationRecoveryPointsOperations # type: ignore +from ._operations import ReplicationProtectedItemsOperations # type: ignore +from ._operations import TargetComputeSizesOperations # type: ignore +from ._operations import RecoveryPointsOperations # type: ignore +from ._operations import ReplicationProtectionClustersOperations # type: ignore +from ._operations import ClusterRecoveryPointsOperations # type: ignore +from ._operations import ReplicationProtectionIntentsOperations # type: ignore +from ._operations import ReplicationAlertSettingsOperations # type: ignore +from ._operations import ReplicationEligibilityResultsOperations # type: ignore +from ._operations import ReplicationEventsOperations # type: ignore +from ._operations import ReplicationFabricsOperations # type: ignore +from ._operations import ReplicationLogicalNetworksOperations # type: ignore +from ._operations import ReplicationNetworksOperations # type: ignore +from ._operations import ReplicationNetworkMappingsOperations # type: ignore +from ._operations import ReplicationProtectionContainersOperations # type: ignore +from ._operations import ReplicationMigrationItemsOperations # type: ignore +from ._operations import ReplicationProtectableItemsOperations # type: ignore +from ._operations import ClusterRecoveryPointOperations # type: ignore +from ._operations import ReplicationProtectionContainerMappingsOperations # type: ignore +from ._operations import ReplicationRecoveryServicesProvidersOperations # type: ignore +from ._operations import ReplicationStorageClassificationsOperations # type: ignore +from ._operations import ReplicationStorageClassificationMappingsOperations # type: ignore +from ._operations import ReplicationvCentersOperations # type: ignore +from ._operations import ReplicationJobsOperations # type: ignore +from ._operations import ReplicationPoliciesOperations # type: ignore +from ._operations import ReplicationRecoveryPlansOperations # type: ignore +from ._operations import ReplicationVaultSettingOperations # type: ignore from ._operations import Operations # type: ignore -from ._replication_alert_settings_operations import ReplicationAlertSettingsOperations # type: ignore -from ._replication_appliances_operations import ReplicationAppliancesOperations # type: ignore -from ._replication_eligibility_results_operations import ReplicationEligibilityResultsOperations # type: ignore -from ._replication_events_operations import ReplicationEventsOperations # type: ignore -from ._replication_fabrics_operations import ReplicationFabricsOperations # type: ignore -from ._replication_logical_networks_operations import ReplicationLogicalNetworksOperations # type: ignore -from ._replication_networks_operations import ReplicationNetworksOperations # type: ignore -from ._replication_network_mappings_operations import ReplicationNetworkMappingsOperations # type: ignore -from ._replication_protection_containers_operations import ReplicationProtectionContainersOperations # type: ignore -from ._replication_migration_items_operations import ReplicationMigrationItemsOperations # type: ignore -from ._migration_recovery_points_operations import MigrationRecoveryPointsOperations # type: ignore -from ._replication_protectable_items_operations import ReplicationProtectableItemsOperations # type: ignore -from ._replication_protected_items_operations import ReplicationProtectedItemsOperations # type: ignore -from ._recovery_points_operations import RecoveryPointsOperations # type: ignore -from ._target_compute_sizes_operations import TargetComputeSizesOperations # type: ignore -from ._replication_protection_clusters_operations import ReplicationProtectionClustersOperations # type: ignore -from ._cluster_recovery_points_operations import ClusterRecoveryPointsOperations # type: ignore -from ._cluster_recovery_point_operations import ClusterRecoveryPointOperations # type: ignore -from ._replication_protection_container_mappings_operations import ReplicationProtectionContainerMappingsOperations # type: ignore -from ._replication_recovery_services_providers_operations import ReplicationRecoveryServicesProvidersOperations # type: ignore -from ._replication_storage_classifications_operations import ReplicationStorageClassificationsOperations # type: ignore -from ._replication_storage_classification_mappings_operations import ReplicationStorageClassificationMappingsOperations # type: ignore -from ._replicationv_centers_operations import ReplicationvCentersOperations # type: ignore -from ._replication_jobs_operations import ReplicationJobsOperations # type: ignore -from ._replication_policies_operations import ReplicationPoliciesOperations # type: ignore -from ._replication_protection_intents_operations import ReplicationProtectionIntentsOperations # type: ignore -from ._replication_recovery_plans_operations import ReplicationRecoveryPlansOperations # type: ignore -from ._supported_operating_systems_operations import SupportedOperatingSystemsOperations # type: ignore -from ._replication_vault_health_operations import ReplicationVaultHealthOperations # type: ignore -from ._replication_vault_setting_operations import ReplicationVaultSettingOperations # type: ignore +from ._operations import ReplicationAppliancesOperations # type: ignore +from ._operations import SupportedOperatingSystemsOperations # type: ignore +from ._operations import ReplicationVaultHealthOperations # type: ignore from ._patch import __all__ as _patch_all from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ - "Operations", + "MigrationRecoveryPointsOperations", + "ReplicationProtectedItemsOperations", + "TargetComputeSizesOperations", + "RecoveryPointsOperations", + "ReplicationProtectionClustersOperations", + "ClusterRecoveryPointsOperations", + "ReplicationProtectionIntentsOperations", "ReplicationAlertSettingsOperations", - "ReplicationAppliancesOperations", "ReplicationEligibilityResultsOperations", "ReplicationEventsOperations", "ReplicationFabricsOperations", @@ -61,13 +65,7 @@ "ReplicationNetworkMappingsOperations", "ReplicationProtectionContainersOperations", "ReplicationMigrationItemsOperations", - "MigrationRecoveryPointsOperations", "ReplicationProtectableItemsOperations", - "ReplicationProtectedItemsOperations", - "RecoveryPointsOperations", - "TargetComputeSizesOperations", - "ReplicationProtectionClustersOperations", - "ClusterRecoveryPointsOperations", "ClusterRecoveryPointOperations", "ReplicationProtectionContainerMappingsOperations", "ReplicationRecoveryServicesProvidersOperations", @@ -76,11 +74,12 @@ "ReplicationvCentersOperations", "ReplicationJobsOperations", "ReplicationPoliciesOperations", - "ReplicationProtectionIntentsOperations", "ReplicationRecoveryPlansOperations", + "ReplicationVaultSettingOperations", + "Operations", + "ReplicationAppliancesOperations", "SupportedOperatingSystemsOperations", "ReplicationVaultHealthOperations", - "ReplicationVaultSettingOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_cluster_recovery_point_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_cluster_recovery_point_operations.py deleted file mode 100644 index d9a03756c219..000000000000 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_cluster_recovery_point_operations.py +++ /dev/null @@ -1,190 +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, Dict, 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 SiteRecoveryManagementClientConfiguration -from .._serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_request( - resource_name: str, - fabric_name: str, - protection_container_name: str, - replication_protection_cluster_name: str, - recovery_point_name: str, - 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", "2025-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionClusters/{replicationProtectionClusterName}/recoveryPoints/{recoveryPointName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url( - "resource_name", resource_name, "str", pattern=r"^[A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9]$" - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url( - "fabric_name", fabric_name, "str", pattern=r"^[A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9]$" - ), - "protectionContainerName": _SERIALIZER.url( - "protection_container_name", - protection_container_name, - "str", - pattern=r"^[A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9]$", - ), - "replicationProtectionClusterName": _SERIALIZER.url( - "replication_protection_cluster_name", - replication_protection_cluster_name, - "str", - pattern=r"^[A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9]$", - ), - "recoveryPointName": _SERIALIZER.url( - "recovery_point_name", recovery_point_name, "str", pattern=r"^[A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9]$" - ), - } - - _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 ClusterRecoveryPointOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicessiterecovery.SiteRecoveryManagementClient`'s - :attr:`cluster_recovery_point` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: SiteRecoveryManagementClientConfiguration = ( - 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_name: str, - fabric_name: str, - protection_container_name: str, - replication_protection_cluster_name: str, - recovery_point_name: str, - **kwargs: Any - ) -> _models.ClusterRecoveryPoint: - """Gets a recovery point. - - Get the details of specified recovery point. - - :param resource_name: The name of the recovery services vault. Required. - :type resource_name: str - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replication_protection_cluster_name: Replication protection cluster name. Required. - :type replication_protection_cluster_name: str - :param recovery_point_name: The recovery point name. Required. - :type recovery_point_name: str - :return: ClusterRecoveryPoint or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.ClusterRecoveryPoint - :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.ClusterRecoveryPoint] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_name=resource_name, - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replication_protection_cluster_name=replication_protection_cluster_name, - recovery_point_name=recovery_point_name, - resource_group_name=self._config.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) - - _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.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ClusterRecoveryPoint", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_cluster_recovery_points_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_cluster_recovery_points_operations.py deleted file mode 100644 index fcf5c6d88276..000000000000 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_cluster_recovery_points_operations.py +++ /dev/null @@ -1,212 +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, Dict, Iterable, 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 SiteRecoveryManagementClientConfiguration -from .._serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_replication_protection_cluster_request( # pylint: disable=name-too-long - resource_name: str, - fabric_name: str, - protection_container_name: str, - replication_protection_cluster_name: str, - 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", "2025-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionClusters/{replicationProtectionClusterName}/recoveryPoints", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url( - "resource_name", resource_name, "str", pattern=r"^[A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9]$" - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url( - "fabric_name", fabric_name, "str", pattern=r"^[A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9]$" - ), - "protectionContainerName": _SERIALIZER.url( - "protection_container_name", - protection_container_name, - "str", - pattern=r"^[A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9]$", - ), - "replicationProtectionClusterName": _SERIALIZER.url( - "replication_protection_cluster_name", - replication_protection_cluster_name, - "str", - pattern=r"^[A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9]$", - ), - } - - _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 ClusterRecoveryPointsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicessiterecovery.SiteRecoveryManagementClient`'s - :attr:`cluster_recovery_points` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: SiteRecoveryManagementClientConfiguration = ( - 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_replication_protection_cluster( - self, - resource_name: str, - fabric_name: str, - protection_container_name: str, - replication_protection_cluster_name: str, - **kwargs: Any - ) -> Iterable["_models.ClusterRecoveryPoint"]: - """Gets the list of cluster recovery points. - - The list of cluster recovery points. - - :param resource_name: The name of the recovery services vault. Required. - :type resource_name: str - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replication_protection_cluster_name: Replication protection cluster name. Required. - :type replication_protection_cluster_name: str - :return: An iterator like instance of either ClusterRecoveryPoint or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.ClusterRecoveryPoint] - :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.ClusterRecoveryPointCollection] = 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_replication_protection_cluster_request( - resource_name=resource_name, - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replication_protection_cluster_name=replication_protection_cluster_name, - resource_group_name=self._config.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("ClusterRecoveryPointCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link 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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_migration_recovery_points_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_migration_recovery_points_operations.py deleted file mode 100644 index 7f56a3dbfb65..000000000000 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_migration_recovery_points_operations.py +++ /dev/null @@ -1,305 +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, Dict, Iterable, 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 SiteRecoveryManagementClientConfiguration -from .._serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_replication_migration_items_request( # pylint: disable=name-too-long - fabric_name: str, - protection_container_name: str, - migration_item_name: str, - resource_group_name: str, - resource_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", "2025-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/migrationRecoveryPoints", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), - "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), - "migrationItemName": _SERIALIZER.url("migration_item_name", migration_item_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( - fabric_name: str, - protection_container_name: str, - migration_item_name: str, - migration_recovery_point_name: str, - resource_group_name: str, - resource_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", "2025-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/migrationRecoveryPoints/{migrationRecoveryPointName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), - "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), - "migrationItemName": _SERIALIZER.url("migration_item_name", migration_item_name, "str"), - "migrationRecoveryPointName": _SERIALIZER.url( - "migration_recovery_point_name", migration_recovery_point_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 MigrationRecoveryPointsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicessiterecovery.SiteRecoveryManagementClient`'s - :attr:`migration_recovery_points` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: SiteRecoveryManagementClientConfiguration = ( - 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_replication_migration_items( - self, fabric_name: str, protection_container_name: str, migration_item_name: str, **kwargs: Any - ) -> Iterable["_models.MigrationRecoveryPoint"]: - """Gets the recovery points for a migration item. - - Gets the recovery points for a migration item. - - :param fabric_name: Fabric unique name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param migration_item_name: Migration item name. Required. - :type migration_item_name: str - :return: An iterator like instance of either MigrationRecoveryPoint or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.MigrationRecoveryPoint] - :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.MigrationRecoveryPointCollection] = 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_replication_migration_items_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - migration_item_name=migration_item_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("MigrationRecoveryPointCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get( - self, - fabric_name: str, - protection_container_name: str, - migration_item_name: str, - migration_recovery_point_name: str, - **kwargs: Any - ) -> _models.MigrationRecoveryPoint: - """Gets a recovery point for a migration item. - - Gets a recovery point for a migration item. - - :param fabric_name: Fabric unique name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param migration_item_name: Migration item name. Required. - :type migration_item_name: str - :param migration_recovery_point_name: The migration recovery point name. Required. - :type migration_recovery_point_name: str - :return: MigrationRecoveryPoint or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.MigrationRecoveryPoint - :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.MigrationRecoveryPoint] = kwargs.pop("cls", None) - - _request = build_get_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - migration_item_name=migration_item_name, - migration_recovery_point_name=migration_recovery_point_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("MigrationRecoveryPoint", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_operations.py index 4154fcd41216..f3d7fc4c5e20 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_operations.py @@ -1,13 +1,15 @@ -# pylint: disable=line-too-long,useless-suppression +# 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, Dict, Iterable, 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 @@ -17,52 +19,31676 @@ 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 SiteRecoveryManagementClientConfiguration -from .._serialization import Deserializer, Serializer +from .._utils.model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize +from .._utils.serialization import Deserializer, Serializer T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +JSON = MutableMapping[str, Any] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_migration_recovery_points_get_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + migration_recovery_point_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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/operations", - ) + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/migrationRecoveryPoints/{migrationRecoveryPointName}" path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "migrationItemName": _SERIALIZER.url("migration_item_name", migration_item_name, "str"), + "migrationRecoveryPointName": _SERIALIZER.url( + "migration_recovery_point_name", migration_recovery_point_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_migration_recovery_points_list_by_replication_migration_items_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/migrationRecoveryPoints" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "migrationItemName": _SERIALIZER.url("migration_item_name", migration_item_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_replication_protected_items_get_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "replicatedProtectedItemName": _SERIALIZER.url( + "replicated_protected_item_name", replicated_protected_item_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_replication_protected_items_create_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "replicatedProtectedItemName": _SERIALIZER.url( + "replicated_protected_item_name", replicated_protected_item_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_replication_protected_items_update_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "replicatedProtectedItemName": _SERIALIZER.url( + "replicated_protected_item_name", replicated_protected_item_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_replication_protected_items_purge_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_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", "2025-08-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "replicatedProtectedItemName": _SERIALIZER.url( + "replicated_protected_item_name", replicated_protected_item_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_replication_protected_items_list_by_replication_protection_containers_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_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_replication_protected_items_add_disks_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/addDisks" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "replicatedProtectedItemName": _SERIALIZER.url( + "replicated_protected_item_name", replicated_protected_item_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_replication_protected_items_apply_recovery_point_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/applyRecoveryPoint" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "replicatedProtectedItemName": _SERIALIZER.url( + "replicated_protected_item_name", replicated_protected_item_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_replication_protected_items_failover_cancel_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/failoverCancel" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "replicatedProtectedItemName": _SERIALIZER.url( + "replicated_protected_item_name", replicated_protected_item_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_replication_protected_items_failover_commit_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/failoverCommit" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "replicatedProtectedItemName": _SERIALIZER.url( + "replicated_protected_item_name", replicated_protected_item_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_replication_protected_items_planned_failover_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/plannedFailover" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "replicatedProtectedItemName": _SERIALIZER.url( + "replicated_protected_item_name", replicated_protected_item_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_replication_protected_items_delete_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_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", "2025-08-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/remove" + path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "replicatedProtectedItemName": _SERIALIZER.url( + "replicated_protected_item_name", replicated_protected_item_name, "str" + ), } - _url: str = _url.format(**path_format_arguments) # type: ignore + _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_replication_protected_items_remove_disks_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/removeDisks" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "replicatedProtectedItemName": _SERIALIZER.url( + "replicated_protected_item_name", replicated_protected_item_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_replication_protected_items_repair_replication_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/repairReplication" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "replicatedProtectedItemName": _SERIALIZER.url( + "replicated_protected_item_name", replicated_protected_item_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_replication_protected_items_reprotect_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/reProtect" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "replicatedProtectedItemName": _SERIALIZER.url( + "replicated_protected_item_name", replicated_protected_item_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_replication_protected_items_resolve_health_errors_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/resolveHealthErrors" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "replicatedProtectedItemName": _SERIALIZER.url( + "replicated_protected_item_name", replicated_protected_item_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_replication_protected_items_switch_provider_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/switchProvider" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "replicatedProtectedItemName": _SERIALIZER.url( + "replicated_protected_item_name", replicated_protected_item_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_replication_protected_items_test_failover_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/testFailover" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "replicatedProtectedItemName": _SERIALIZER.url( + "replicated_protected_item_name", replicated_protected_item_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_replication_protected_items_test_failover_cleanup_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/testFailoverCleanup" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "replicatedProtectedItemName": _SERIALIZER.url( + "replicated_protected_item_name", replicated_protected_item_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_replication_protected_items_unplanned_failover_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/unplannedFailover" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "replicatedProtectedItemName": _SERIALIZER.url( + "replicated_protected_item_name", replicated_protected_item_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_replication_protected_items_update_appliance_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/updateAppliance" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "replicatedProtectedItemName": _SERIALIZER.url( + "replicated_protected_item_name", replicated_protected_item_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_replication_protected_items_update_mobility_service_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/updateMobilityService" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "replicatedProtectedItemName": _SERIALIZER.url( + "replicated_protected_item_name", replicated_protected_item_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_replication_protected_items_reinstall_mobility_service_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/reinstallMobilityService" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "replicatedProtectedItemName": _SERIALIZER.url( + "replicated_protected_item_name", replicated_protected_item_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_replication_protected_items_list_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + subscription_id: str, + *, + skip_token: Optional[str] = None, + filter: Optional[str] = None, + **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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationProtectedItems" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if skip_token is not None: + _params["skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_target_compute_sizes_list_by_replication_protected_items_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/targetComputeSizes" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "replicatedProtectedItemName": _SERIALIZER.url( + "replicated_protected_item_name", replicated_protected_item_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_recovery_points_get_request( + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + recovery_point_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/recoveryPoints/{recoveryPointName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "replicatedProtectedItemName": _SERIALIZER.url( + "replicated_protected_item_name", replicated_protected_item_name, "str" + ), + "recoveryPointName": _SERIALIZER.url("recovery_point_name", recovery_point_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_recovery_points_list_by_replication_protected_items_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/recoveryPoints" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "replicatedProtectedItemName": _SERIALIZER.url( + "replicated_protected_item_name", replicated_protected_item_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_replication_protection_clusters_get_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replication_protection_cluster_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionClusters/{replicationProtectionClusterName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "replicationProtectionClusterName": _SERIALIZER.url( + "replication_protection_cluster_name", replication_protection_cluster_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_replication_protection_clusters_create_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replication_protection_cluster_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionClusters/{replicationProtectionClusterName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "replicationProtectionClusterName": _SERIALIZER.url( + "replication_protection_cluster_name", replication_protection_cluster_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_replication_protection_clusters_purge_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replication_protection_cluster_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", "2025-08-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionClusters/{replicationProtectionClusterName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "replicationProtectionClusterName": _SERIALIZER.url( + "replication_protection_cluster_name", replication_protection_cluster_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_replication_protection_clusters_apply_recovery_point_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replication_protection_cluster_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionClusters/{replicationProtectionClusterName}/applyRecoveryPoint" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "replicationProtectionClusterName": _SERIALIZER.url( + "replication_protection_cluster_name", replication_protection_cluster_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_replication_protection_clusters_failover_commit_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replication_protection_cluster_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionClusters/{replicationProtectionClusterName}/failoverCommit" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "replicationProtectionClusterName": _SERIALIZER.url( + "replication_protection_cluster_name", replication_protection_cluster_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_replication_protection_clusters_repair_replication_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replication_protection_cluster_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionClusters/{replicationProtectionClusterName}/repairReplication" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "replicationProtectionClusterName": _SERIALIZER.url( + "replication_protection_cluster_name", replication_protection_cluster_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_replication_protection_clusters_test_failover_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replication_protection_cluster_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionClusters/{replicationProtectionClusterName}/testFailover" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "replicationProtectionClusterName": _SERIALIZER.url( + "replication_protection_cluster_name", replication_protection_cluster_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_replication_protection_clusters_test_failover_cleanup_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replication_protection_cluster_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionClusters/{replicationProtectionClusterName}/testFailoverCleanup" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "replicationProtectionClusterName": _SERIALIZER.url( + "replication_protection_cluster_name", replication_protection_cluster_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_replication_protection_clusters_unplanned_failover_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replication_protection_cluster_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionClusters/{replicationProtectionClusterName}/unplannedFailover" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "replicationProtectionClusterName": _SERIALIZER.url( + "replication_protection_cluster_name", replication_protection_cluster_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_replication_protection_clusters_get_operation_results_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replication_protection_cluster_name: str, + job_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionClusters/{replicationProtectionClusterName}/operationResults/{jobId}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "replicationProtectionClusterName": _SERIALIZER.url( + "replication_protection_cluster_name", replication_protection_cluster_name, "str" + ), + "jobId": _SERIALIZER.url("job_id", job_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_replication_protection_clusters_list_by_replication_protection_containers_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionClusters" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_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_replication_protection_clusters_list_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + subscription_id: str, + *, + skip_token: Optional[str] = None, + filter: Optional[str] = None, + **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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationProtectionClusters" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if skip_token is not None: + _params["skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_cluster_recovery_points_list_by_replication_protection_cluster_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replication_protection_cluster_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionClusters/{replicationProtectionClusterName}/recoveryPoints" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "replicationProtectionClusterName": _SERIALIZER.url( + "replication_protection_cluster_name", replication_protection_cluster_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_replication_protection_intents_get_request( # pylint: disable=name-too-long + resource_group_name: str, resource_name: str, intent_object_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationProtectionIntents/{intentObjectName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "intentObjectName": _SERIALIZER.url("intent_object_name", intent_object_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_replication_protection_intents_create_request( # pylint: disable=name-too-long + resource_group_name: str, resource_name: str, intent_object_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationProtectionIntents/{intentObjectName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "intentObjectName": _SERIALIZER.url("intent_object_name", intent_object_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_replication_protection_intents_list_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + subscription_id: str, + *, + skip_token: Optional[str] = None, + take_token: Optional[str] = None, + **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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationProtectionIntents" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if skip_token is not None: + _params["skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") + if take_token is not None: + _params["takeToken"] = _SERIALIZER.query("take_token", take_token, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_replication_alert_settings_get_request( # pylint: disable=name-too-long + resource_group_name: str, resource_name: str, alert_setting_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationAlertSettings/{alertSettingName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "alertSettingName": _SERIALIZER.url("alert_setting_name", alert_setting_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_replication_alert_settings_create_request( # pylint: disable=name-too-long + resource_group_name: str, resource_name: str, alert_setting_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationAlertSettings/{alertSettingName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "alertSettingName": _SERIALIZER.url("alert_setting_name", alert_setting_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_replication_alert_settings_list_request( # pylint: disable=name-too-long + resource_group_name: str, resource_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationAlertSettings" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_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_replication_eligibility_results_get_request( # pylint: disable=name-too-long + resource_group_name: str, virtual_machine_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.Compute/virtualMachines/{virtualMachineName}/providers/Microsoft.RecoveryServices/replicationEligibilityResults/default" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_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_replication_eligibility_results_list_request( # pylint: disable=name-too-long + resource_group_name: str, virtual_machine_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.Compute/virtualMachines/{virtualMachineName}/providers/Microsoft.RecoveryServices/replicationEligibilityResults" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_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_replication_events_get_request( + resource_group_name: str, resource_name: str, event_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationEvents/{eventName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "eventName": _SERIALIZER.url("event_name", event_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_replication_events_list_request( + resource_group_name: str, resource_name: str, subscription_id: str, *, filter: Optional[str] = None, **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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationEvents" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_replication_fabrics_get_request( + resource_group_name: str, + resource_name: str, + fabric_name: str, + subscription_id: str, + *, + filter: Optional[str] = None, + **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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_replication_fabrics_create_request( + resource_group_name: str, resource_name: str, fabric_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_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_replication_fabrics_purge_request( + resource_group_name: str, resource_name: str, fabric_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", "2025-08-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_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_replication_fabrics_list_request( + resource_group_name: str, resource_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_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_replication_fabrics_check_consistency_request( # pylint: disable=name-too-long + resource_group_name: str, resource_name: str, fabric_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/checkConsistency" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_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_replication_fabrics_migrate_to_aad_request( # pylint: disable=name-too-long + resource_group_name: str, resource_name: str, fabric_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", "2025-08-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/migratetoaad" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_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_replication_fabrics_reassociate_gateway_request( # pylint: disable=name-too-long + resource_group_name: str, resource_name: str, fabric_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/reassociateGateway" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_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_replication_fabrics_delete_request( + resource_group_name: str, resource_name: str, fabric_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", "2025-08-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/remove" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_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_replication_fabrics_renew_certificate_request( # pylint: disable=name-too-long + resource_group_name: str, resource_name: str, fabric_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/renewCertificate" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_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_replication_fabrics_remove_infra_request( # pylint: disable=name-too-long + resource_group_name: str, resource_name: str, fabric_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", "2025-08-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/removeInfra" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_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_replication_logical_networks_get_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + fabric_name: str, + logical_network_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationLogicalNetworks/{logicalNetworkName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "logicalNetworkName": _SERIALIZER.url("logical_network_name", logical_network_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_replication_logical_networks_list_by_replication_fabrics_request( # pylint: disable=name-too-long + resource_group_name: str, resource_name: str, fabric_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationLogicalNetworks" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_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_replication_networks_get_request( + resource_group_name: str, + resource_name: str, + fabric_name: str, + network_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "networkName": _SERIALIZER.url("network_name", network_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_replication_networks_list_by_replication_fabrics_request( # pylint: disable=name-too-long + resource_group_name: str, resource_name: str, fabric_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_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_replication_networks_list_request( + resource_group_name: str, resource_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationNetworks" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_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_replication_network_mappings_get_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + fabric_name: str, + network_name: str, + network_mapping_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}/replicationNetworkMappings/{networkMappingName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "networkName": _SERIALIZER.url("network_name", network_name, "str"), + "networkMappingName": _SERIALIZER.url("network_mapping_name", network_mapping_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_replication_network_mappings_create_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + fabric_name: str, + network_name: str, + network_mapping_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}/replicationNetworkMappings/{networkMappingName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "networkName": _SERIALIZER.url("network_name", network_name, "str"), + "networkMappingName": _SERIALIZER.url("network_mapping_name", network_mapping_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_replication_network_mappings_update_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + fabric_name: str, + network_name: str, + network_mapping_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}/replicationNetworkMappings/{networkMappingName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "networkName": _SERIALIZER.url("network_name", network_name, "str"), + "networkMappingName": _SERIALIZER.url("network_mapping_name", network_mapping_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_replication_network_mappings_delete_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + fabric_name: str, + network_name: str, + network_mapping_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", "2025-08-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}/replicationNetworkMappings/{networkMappingName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "networkName": _SERIALIZER.url("network_name", network_name, "str"), + "networkMappingName": _SERIALIZER.url("network_mapping_name", network_mapping_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_replication_network_mappings_list_by_replication_networks_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + fabric_name: str, + network_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}/replicationNetworkMappings" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "networkName": _SERIALIZER.url("network_name", network_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_replication_network_mappings_list_request( # pylint: disable=name-too-long + resource_group_name: str, resource_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationNetworkMappings" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_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_replication_protection_containers_get_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_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_replication_protection_containers_create_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_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_replication_protection_containers_list_by_replication_fabrics_request( # pylint: disable=name-too-long + resource_group_name: str, resource_name: str, fabric_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_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_replication_protection_containers_discover_protectable_item_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/discoverProtectableItem" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_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_replication_protection_containers_delete_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_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", "2025-08-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/remove" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_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_replication_protection_containers_switch_cluster_protection_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/switchClusterProtection" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_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_replication_protection_containers_switch_protection_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/switchprotection" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_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_replication_protection_containers_list_request( # pylint: disable=name-too-long + resource_group_name: str, resource_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationProtectionContainers" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_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_replication_migration_items_get_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "migrationItemName": _SERIALIZER.url("migration_item_name", migration_item_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_replication_migration_items_create_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "migrationItemName": _SERIALIZER.url("migration_item_name", migration_item_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_replication_migration_items_update_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "migrationItemName": _SERIALIZER.url("migration_item_name", migration_item_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_replication_migration_items_delete_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + subscription_id: str, + *, + delete_option: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-08-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "migrationItemName": _SERIALIZER.url("migration_item_name", migration_item_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if delete_option is not None: + _params["deleteOption"] = _SERIALIZER.query("delete_option", delete_option, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_replication_migration_items_list_by_replication_protection_containers_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + subscription_id: str, + *, + skip_token: Optional[str] = None, + take_token: Optional[str] = None, + filter: Optional[str] = None, + **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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if skip_token is not None: + _params["skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") + if take_token is not None: + _params["takeToken"] = _SERIALIZER.query("take_token", take_token, "str") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_replication_migration_items_migrate_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/migrate" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "migrationItemName": _SERIALIZER.url("migration_item_name", migration_item_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_replication_migration_items_pause_replication_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/pauseReplication" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "migrationItemName": _SERIALIZER.url("migration_item_name", migration_item_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_replication_migration_items_resume_replication_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/resumeReplication" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "migrationItemName": _SERIALIZER.url("migration_item_name", migration_item_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_replication_migration_items_resync_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/resync" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "migrationItemName": _SERIALIZER.url("migration_item_name", migration_item_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_replication_migration_items_test_migrate_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/testMigrate" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "migrationItemName": _SERIALIZER.url("migration_item_name", migration_item_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_replication_migration_items_test_migrate_cleanup_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/testMigrateCleanup" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "migrationItemName": _SERIALIZER.url("migration_item_name", migration_item_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_replication_migration_items_list_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + subscription_id: str, + *, + skip_token: Optional[str] = None, + take_token: Optional[str] = None, + filter: Optional[str] = None, + **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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationMigrationItems" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if skip_token is not None: + _params["skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") + if take_token is not None: + _params["takeToken"] = _SERIALIZER.query("take_token", take_token, "str") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_replication_protectable_items_get_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + protectable_item_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectableItems/{protectableItemName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "protectableItemName": _SERIALIZER.url("protectable_item_name", protectable_item_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_replication_protectable_items_list_by_replication_protection_containers_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + subscription_id: str, + *, + filter: Optional[str] = None, + take: Optional[str] = None, + skip_token: Optional[str] = None, + **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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectableItems" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + if take is not None: + _params["$take"] = _SERIALIZER.query("take", take, "str") + if skip_token is not None: + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_cluster_recovery_point_get_request( + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replication_protection_cluster_name: str, + recovery_point_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionClusters/{replicationProtectionClusterName}/recoveryPoints/{recoveryPointName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "replicationProtectionClusterName": _SERIALIZER.url( + "replication_protection_cluster_name", replication_protection_cluster_name, "str" + ), + "recoveryPointName": _SERIALIZER.url("recovery_point_name", recovery_point_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_replication_protection_container_mappings_get_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + mapping_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "mappingName": _SERIALIZER.url("mapping_name", mapping_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_replication_protection_container_mappings_create_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + mapping_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "mappingName": _SERIALIZER.url("mapping_name", mapping_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_replication_protection_container_mappings_update_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + mapping_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "mappingName": _SERIALIZER.url("mapping_name", mapping_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_replication_protection_container_mappings_purge_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + mapping_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", "2025-08-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "mappingName": _SERIALIZER.url("mapping_name", mapping_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_replication_protection_container_mappings_list_by_replication_protection_containers_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_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_replication_protection_container_mappings_delete_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + mapping_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", "2025-08-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}/remove" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), + "mappingName": _SERIALIZER.url("mapping_name", mapping_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_replication_protection_container_mappings_list_request( # pylint: disable=name-too-long + resource_group_name: str, resource_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationProtectionContainerMappings" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_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_replication_recovery_services_providers_get_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + fabric_name: str, + provider_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders/{providerName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "providerName": _SERIALIZER.url("provider_name", provider_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_replication_recovery_services_providers_create_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + fabric_name: str, + provider_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders/{providerName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "providerName": _SERIALIZER.url("provider_name", provider_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_replication_recovery_services_providers_purge_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + fabric_name: str, + provider_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", "2025-08-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders/{providerName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "providerName": _SERIALIZER.url("provider_name", provider_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_replication_recovery_services_providers_list_by_replication_fabrics_request( # pylint: disable=name-too-long + resource_group_name: str, resource_name: str, fabric_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_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_replication_recovery_services_providers_refresh_provider_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + fabric_name: str, + provider_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders/{providerName}/refreshProvider" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "providerName": _SERIALIZER.url("provider_name", provider_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_replication_recovery_services_providers_delete_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + fabric_name: str, + provider_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", "2025-08-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders/{providerName}/remove" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "providerName": _SERIALIZER.url("provider_name", provider_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_replication_recovery_services_providers_list_request( # pylint: disable=name-too-long + resource_group_name: str, resource_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryServicesProviders" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_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_replication_storage_classifications_get_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + fabric_name: str, + storage_classification_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications/{storageClassificationName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "storageClassificationName": _SERIALIZER.url("storage_classification_name", storage_classification_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_replication_storage_classifications_list_by_replication_fabrics_request( # pylint: disable=name-too-long + resource_group_name: str, resource_name: str, fabric_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_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_replication_storage_classifications_list_request( # pylint: disable=name-too-long + resource_group_name: str, resource_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationStorageClassifications" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_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_replication_storage_classification_mappings_get_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + fabric_name: str, + storage_classification_name: str, + storage_classification_mapping_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications/{storageClassificationName}/replicationStorageClassificationMappings/{storageClassificationMappingName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "storageClassificationName": _SERIALIZER.url("storage_classification_name", storage_classification_name, "str"), + "storageClassificationMappingName": _SERIALIZER.url( + "storage_classification_mapping_name", storage_classification_mapping_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_replication_storage_classification_mappings_create_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + fabric_name: str, + storage_classification_name: str, + storage_classification_mapping_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications/{storageClassificationName}/replicationStorageClassificationMappings/{storageClassificationMappingName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "storageClassificationName": _SERIALIZER.url("storage_classification_name", storage_classification_name, "str"), + "storageClassificationMappingName": _SERIALIZER.url( + "storage_classification_mapping_name", storage_classification_mapping_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_replication_storage_classification_mappings_delete_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + fabric_name: str, + storage_classification_name: str, + storage_classification_mapping_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", "2025-08-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications/{storageClassificationName}/replicationStorageClassificationMappings/{storageClassificationMappingName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "storageClassificationName": _SERIALIZER.url("storage_classification_name", storage_classification_name, "str"), + "storageClassificationMappingName": _SERIALIZER.url( + "storage_classification_mapping_name", storage_classification_mapping_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_replication_storage_classification_mappings_list_by_replication_storage_classifications_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + fabric_name: str, + storage_classification_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications/{storageClassificationName}/replicationStorageClassificationMappings" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "storageClassificationName": _SERIALIZER.url("storage_classification_name", storage_classification_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_replication_storage_classification_mappings_list_request( # pylint: disable=name-too-long + resource_group_name: str, resource_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationStorageClassificationMappings" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_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_replicationv_centers_get_request( + resource_group_name: str, + resource_name: str, + fabric_name: str, + vcenter_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationvCenters/{vcenterName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "vcenterName": _SERIALIZER.url("vcenter_name", vcenter_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_replicationv_centers_create_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + fabric_name: str, + vcenter_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationvCenters/{vcenterName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "vcenterName": _SERIALIZER.url("vcenter_name", vcenter_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_replicationv_centers_update_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + fabric_name: str, + vcenter_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationvCenters/{vcenterName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "vcenterName": _SERIALIZER.url("vcenter_name", vcenter_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_replicationv_centers_delete_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + fabric_name: str, + vcenter_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", "2025-08-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationvCenters/{vcenterName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "vcenterName": _SERIALIZER.url("vcenter_name", vcenter_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_replicationv_centers_list_by_replication_fabrics_request( # pylint: disable=name-too-long + resource_group_name: str, resource_name: str, fabric_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationvCenters" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_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_replicationv_centers_list_request( + resource_group_name: str, resource_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationvCenters" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_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_replication_jobs_get_request( + resource_group_name: str, resource_name: str, job_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs/{jobName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "jobName": _SERIALIZER.url("job_name", job_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_replication_jobs_list_request( + resource_group_name: str, resource_name: str, subscription_id: str, *, filter: Optional[str] = None, **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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_replication_jobs_cancel_request( + resource_group_name: str, resource_name: str, job_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs/{jobName}/cancel" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "jobName": _SERIALIZER.url("job_name", job_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_replication_jobs_restart_request( + resource_group_name: str, resource_name: str, job_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs/{jobName}/restart" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "jobName": _SERIALIZER.url("job_name", job_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_replication_jobs_resume_request( + resource_group_name: str, resource_name: str, job_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs/{jobName}/resume" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "jobName": _SERIALIZER.url("job_name", job_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_replication_jobs_export_request( + resource_group_name: str, resource_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs/export" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_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_replication_policies_get_request( + resource_group_name: str, resource_name: str, policy_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationPolicies/{policyName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "policyName": _SERIALIZER.url("policy_name", policy_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_replication_policies_create_request( # pylint: disable=name-too-long + resource_group_name: str, resource_name: str, policy_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationPolicies/{policyName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "policyName": _SERIALIZER.url("policy_name", policy_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_replication_policies_update_request( # pylint: disable=name-too-long + resource_group_name: str, resource_name: str, policy_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationPolicies/{policyName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "policyName": _SERIALIZER.url("policy_name", policy_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_replication_policies_delete_request( # pylint: disable=name-too-long + resource_group_name: str, resource_name: str, policy_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", "2025-08-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationPolicies/{policyName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "policyName": _SERIALIZER.url("policy_name", policy_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_replication_policies_list_request( + resource_group_name: str, resource_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationPolicies" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_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_replication_recovery_plans_get_request( # pylint: disable=name-too-long + resource_group_name: str, resource_name: str, recovery_plan_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "recoveryPlanName": _SERIALIZER.url("recovery_plan_name", recovery_plan_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_replication_recovery_plans_create_request( # pylint: disable=name-too-long + resource_group_name: str, resource_name: str, recovery_plan_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "recoveryPlanName": _SERIALIZER.url("recovery_plan_name", recovery_plan_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_replication_recovery_plans_update_request( # pylint: disable=name-too-long + resource_group_name: str, resource_name: str, recovery_plan_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "recoveryPlanName": _SERIALIZER.url("recovery_plan_name", recovery_plan_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_replication_recovery_plans_delete_request( # pylint: disable=name-too-long + resource_group_name: str, resource_name: str, recovery_plan_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", "2025-08-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "recoveryPlanName": _SERIALIZER.url("recovery_plan_name", recovery_plan_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_replication_recovery_plans_list_request( # pylint: disable=name-too-long + resource_group_name: str, resource_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_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_replication_recovery_plans_failover_cancel_request( # pylint: disable=name-too-long + resource_group_name: str, resource_name: str, recovery_plan_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/failoverCancel" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "recoveryPlanName": _SERIALIZER.url("recovery_plan_name", recovery_plan_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_replication_recovery_plans_failover_commit_request( # pylint: disable=name-too-long + resource_group_name: str, resource_name: str, recovery_plan_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/failoverCommit" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "recoveryPlanName": _SERIALIZER.url("recovery_plan_name", recovery_plan_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_replication_recovery_plans_planned_failover_request( # pylint: disable=name-too-long + resource_group_name: str, resource_name: str, recovery_plan_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/plannedFailover" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "recoveryPlanName": _SERIALIZER.url("recovery_plan_name", recovery_plan_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_replication_recovery_plans_reprotect_request( # pylint: disable=name-too-long + resource_group_name: str, resource_name: str, recovery_plan_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/reProtect" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "recoveryPlanName": _SERIALIZER.url("recovery_plan_name", recovery_plan_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_replication_recovery_plans_test_failover_request( # pylint: disable=name-too-long + resource_group_name: str, resource_name: str, recovery_plan_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/testFailover" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "recoveryPlanName": _SERIALIZER.url("recovery_plan_name", recovery_plan_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_replication_recovery_plans_test_failover_cleanup_request( # pylint: disable=name-too-long + resource_group_name: str, resource_name: str, recovery_plan_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/testFailoverCleanup" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "recoveryPlanName": _SERIALIZER.url("recovery_plan_name", recovery_plan_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_replication_recovery_plans_unplanned_failover_request( # pylint: disable=name-too-long + resource_group_name: str, resource_name: str, recovery_plan_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/unplannedFailover" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "recoveryPlanName": _SERIALIZER.url("recovery_plan_name", recovery_plan_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_replication_vault_setting_get_request( # pylint: disable=name-too-long + resource_group_name: str, resource_name: str, vault_setting_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationVaultSettings/{vaultSettingName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "vaultSettingName": _SERIALIZER.url("vault_setting_name", vault_setting_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_replication_vault_setting_create_request( # pylint: disable=name-too-long + resource_group_name: str, resource_name: str, vault_setting_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationVaultSettings/{vaultSettingName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "vaultSettingName": _SERIALIZER.url("vault_setting_name", vault_setting_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_replication_vault_setting_list_request( # pylint: disable=name-too-long + resource_group_name: str, resource_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationVaultSettings" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_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_operations_list_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/operations" + 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_replication_appliances_list_request( # pylint: disable=name-too-long + resource_group_name: str, resource_name: str, subscription_id: str, *, filter: Optional[str] = None, **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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationAppliances" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_supported_operating_systems_get_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + subscription_id: str, + *, + instance_type: Optional[str] = None, + **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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationSupportedOperatingSystems" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if instance_type is not None: + _params["instanceType"] = _SERIALIZER.query("instance_type", instance_type, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_replication_vault_health_get_request( # pylint: disable=name-too-long + resource_group_name: str, resource_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationVaultHealth" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_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_replication_vault_health_refresh_request( # pylint: disable=name-too-long + resource_group_name: str, resource_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", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationVaultHealth/default/refresh" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_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) + + +class MigrationRecoveryPointsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.SiteRecoveryManagementClient`'s + :attr:`migration_recovery_points` 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: SiteRecoveryManagementClientConfiguration = ( + 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, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + migration_recovery_point_name: str, + **kwargs: Any + ) -> _models.MigrationRecoveryPoint: + """Gets a recovery point for a migration item. + + Gets a recovery point for a migration item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param migration_recovery_point_name: The migration recovery point name. Required. + :type migration_recovery_point_name: str + :return: MigrationRecoveryPoint. The MigrationRecoveryPoint is compatible with MutableMapping + :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.MigrationRecoveryPoint + :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.MigrationRecoveryPoint] = kwargs.pop("cls", None) + + _request = build_migration_recovery_points_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + migration_item_name=migration_item_name, + migration_recovery_point_name=migration_recovery_point_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.MigrationRecoveryPoint, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_replication_migration_items( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + **kwargs: Any + ) -> ItemPaged["_models.MigrationRecoveryPoint"]: + """Gets the recovery points for a migration item. + + Gets the recovery points for a migration item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :return: An iterator like instance of MigrationRecoveryPoint + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.MigrationRecoveryPoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.MigrationRecoveryPoint]] = 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_migration_recovery_points_list_by_replication_migration_items_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + migration_item_name=migration_item_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), 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.MigrationRecoveryPoint], + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class ReplicationProtectedItemsOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.SiteRecoveryManagementClient`'s + :attr:`replication_protected_items` 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: SiteRecoveryManagementClientConfiguration = ( + 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, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + **kwargs: Any + ) -> _models.ReplicationProtectedItem: + """Gets the details of a Replication protected item. + + Gets the details of an ASR replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :return: ReplicationProtectedItem. The ReplicationProtectedItem is compatible with + MutableMapping + :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem + :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.ReplicationProtectedItem] = kwargs.pop("cls", None) + + _request = build_replication_protected_items_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ReplicationProtectedItem, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + input: Union[_models.EnableProtectionInput, JSON, 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(input, (IOBase, bytes)): + _content = input + else: + _content = json.dumps(input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_protected_items_create_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_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) + raise HttpResponseError(response=response, 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")) + + 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, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + input: _models.EnableProtectionInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Enables protection. + + The operation to create an ASR replication protected item (Enable replication). + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param input: Enable Protection Input. Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.EnableProtectionInput + :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 ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Enables protection. + + The operation to create an ASR replication protected item (Enable replication). + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param input: Enable Protection Input. Required. + :type input: JSON + :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 ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Enables protection. + + The operation to create an ASR replication protected item (Enable replication). + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param input: Enable Protection Input. Required. + :type input: 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 ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + input: Union[_models.EnableProtectionInput, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Enables protection. + + The operation to create an ASR replication protected item (Enable replication). + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param input: Enable Protection Input. Is one of the following types: EnableProtectionInput, + JSON, IO[bytes] Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.EnableProtectionInput or JSON or + IO[bytes] + :return: An instance of LROPoller that returns ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :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.ReplicationProtectedItem] = 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, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_name, + input=input, + 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.ReplicationProtectedItem, 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.ReplicationProtectedItem].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ReplicationProtectedItem]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + update_protection_input: Union[_models.UpdateReplicationProtectedItemInput, JSON, 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(update_protection_input, (IOBase, bytes)): + _content = update_protection_input + else: + _content = json.dumps(update_protection_input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_protected_items_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_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) + raise HttpResponseError(response=response, 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")) + + 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, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + update_protection_input: _models.UpdateReplicationProtectedItemInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Updates the replication protected item settings. + + The operation to update the recovery settings of an ASR replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param update_protection_input: Update protection input. Required. + :type update_protection_input: + ~azure.mgmt.recoveryservicessiterecovery.models.UpdateReplicationProtectedItemInput + :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 ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + update_protection_input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Updates the replication protected item settings. + + The operation to update the recovery settings of an ASR replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param update_protection_input: Update protection input. Required. + :type update_protection_input: JSON + :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 ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + update_protection_input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Updates the replication protected item settings. + + The operation to update the recovery settings of an ASR replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param update_protection_input: Update protection input. Required. + :type update_protection_input: 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 ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + update_protection_input: Union[_models.UpdateReplicationProtectedItemInput, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Updates the replication protected item settings. + + The operation to update the recovery settings of an ASR replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param update_protection_input: Update protection input. Is one of the following types: + UpdateReplicationProtectedItemInput, JSON, IO[bytes] Required. + :type update_protection_input: + ~azure.mgmt.recoveryservicessiterecovery.models.UpdateReplicationProtectedItemInput or JSON or + IO[bytes] + :return: An instance of LROPoller that returns ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :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.ReplicationProtectedItem] = 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, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_name, + update_protection_input=update_protection_input, + 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.ReplicationProtectedItem, 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.ReplicationProtectedItem].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ReplicationProtectedItem]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _purge_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_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_replication_protected_items_purge_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_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 [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) + raise HttpResponseError(response=response, 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")) + + 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_purge( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Purges protection. + + The operation to delete or purge a replication protected item. This operation will force delete + the replication protected item. Use the remove operation on replication protected item to + perform a clean disable replication for the item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_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._purge_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_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_replication_protection_containers( # pylint: disable=name-too-long + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + **kwargs: Any + ) -> ItemPaged["_models.ReplicationProtectedItem"]: + """Gets the list of Replication protected items. + + Gets the list of ASR replication protected items in the protection container. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :return: An iterator like instance of ReplicationProtectedItem + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ReplicationProtectedItem]] = 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_replication_protected_items_list_by_replication_protection_containers_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_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), 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.ReplicationProtectedItem], + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + def _add_disks_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + add_disks_input: Union[_models.AddDisksInput, JSON, 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(add_disks_input, (IOBase, bytes)): + _content = add_disks_input + else: + _content = json.dumps(add_disks_input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_protected_items_add_disks_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_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) + raise HttpResponseError(response=response, 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")) + + 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_add_disks( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + add_disks_input: _models.AddDisksInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Add disk(s) for protection. + + Operation to add disks(s) to the replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param add_disks_input: Add disks input. Required. + :type add_disks_input: ~azure.mgmt.recoveryservicessiterecovery.models.AddDisksInput + :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 ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_add_disks( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + add_disks_input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Add disk(s) for protection. + + Operation to add disks(s) to the replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param add_disks_input: Add disks input. Required. + :type add_disks_input: JSON + :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 ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_add_disks( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + add_disks_input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Add disk(s) for protection. + + Operation to add disks(s) to the replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param add_disks_input: Add disks input. Required. + :type add_disks_input: 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 ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_add_disks( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + add_disks_input: Union[_models.AddDisksInput, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Add disk(s) for protection. + + Operation to add disks(s) to the replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param add_disks_input: Add disks input. Is one of the following types: AddDisksInput, JSON, + IO[bytes] Required. + :type add_disks_input: ~azure.mgmt.recoveryservicessiterecovery.models.AddDisksInput or JSON or + IO[bytes] + :return: An instance of LROPoller that returns ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :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.ReplicationProtectedItem] = 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._add_disks_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_name, + add_disks_input=add_disks_input, + 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.ReplicationProtectedItem, 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.ReplicationProtectedItem].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ReplicationProtectedItem]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _apply_recovery_point_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + apply_recovery_point_input: Union[_models.ApplyRecoveryPointInput, JSON, 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(apply_recovery_point_input, (IOBase, bytes)): + _content = apply_recovery_point_input + else: + _content = json.dumps(apply_recovery_point_input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_protected_items_apply_recovery_point_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_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) + raise HttpResponseError(response=response, 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")) + + 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_apply_recovery_point( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + apply_recovery_point_input: _models.ApplyRecoveryPointInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Change or apply recovery point. + + The operation to change the recovery point of a failed over replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param apply_recovery_point_input: The ApplyRecoveryPointInput. Required. + :type apply_recovery_point_input: + ~azure.mgmt.recoveryservicessiterecovery.models.ApplyRecoveryPointInput + :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 ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_apply_recovery_point( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + apply_recovery_point_input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Change or apply recovery point. + + The operation to change the recovery point of a failed over replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param apply_recovery_point_input: The ApplyRecoveryPointInput. Required. + :type apply_recovery_point_input: JSON + :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 ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_apply_recovery_point( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + apply_recovery_point_input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Change or apply recovery point. + + The operation to change the recovery point of a failed over replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param apply_recovery_point_input: The ApplyRecoveryPointInput. Required. + :type apply_recovery_point_input: 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 ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_apply_recovery_point( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + apply_recovery_point_input: Union[_models.ApplyRecoveryPointInput, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Change or apply recovery point. + + The operation to change the recovery point of a failed over replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param apply_recovery_point_input: The ApplyRecoveryPointInput. Is one of the following types: + ApplyRecoveryPointInput, JSON, IO[bytes] Required. + :type apply_recovery_point_input: + ~azure.mgmt.recoveryservicessiterecovery.models.ApplyRecoveryPointInput or JSON or IO[bytes] + :return: An instance of LROPoller that returns ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :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.ReplicationProtectedItem] = 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._apply_recovery_point_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_name, + apply_recovery_point_input=apply_recovery_point_input, + 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.ReplicationProtectedItem, 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.ReplicationProtectedItem].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ReplicationProtectedItem]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _failover_cancel_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_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_replication_protected_items_failover_cancel_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_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) + raise HttpResponseError(response=response, 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")) + + 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_failover_cancel( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Execute cancel failover. + + Operation to cancel the failover of the replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :return: An instance of LROPoller that returns ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ReplicationProtectedItem] = 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._failover_cancel_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.ReplicationProtectedItem, 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.ReplicationProtectedItem].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ReplicationProtectedItem]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _failover_commit_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_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_replication_protected_items_failover_commit_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_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) + raise HttpResponseError(response=response, 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")) + + 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_failover_commit( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Execute commit failover. + + Operation to commit the failover of the replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :return: An instance of LROPoller that returns ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ReplicationProtectedItem] = 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._failover_commit_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.ReplicationProtectedItem, 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.ReplicationProtectedItem].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ReplicationProtectedItem]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _planned_failover_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + failover_input: Union[_models.PlannedFailoverInput, JSON, 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(failover_input, (IOBase, bytes)): + _content = failover_input + else: + _content = json.dumps(failover_input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_protected_items_planned_failover_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_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) + raise HttpResponseError(response=response, 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")) + + 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_planned_failover( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + failover_input: _models.PlannedFailoverInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Execute planned failover. + + Operation to initiate a planned failover of the replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param failover_input: Planned failover input. Required. + :type failover_input: ~azure.mgmt.recoveryservicessiterecovery.models.PlannedFailoverInput + :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 ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_planned_failover( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + failover_input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Execute planned failover. + + Operation to initiate a planned failover of the replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param failover_input: Planned failover input. Required. + :type failover_input: JSON + :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 ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_planned_failover( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + failover_input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Execute planned failover. + + Operation to initiate a planned failover of the replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param failover_input: Planned failover input. Required. + :type failover_input: 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 ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_planned_failover( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + failover_input: Union[_models.PlannedFailoverInput, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Execute planned failover. + + Operation to initiate a planned failover of the replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param failover_input: Planned failover input. Is one of the following types: + PlannedFailoverInput, JSON, IO[bytes] Required. + :type failover_input: ~azure.mgmt.recoveryservicessiterecovery.models.PlannedFailoverInput or + JSON or IO[bytes] + :return: An instance of LROPoller that returns ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :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.ReplicationProtectedItem] = 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._planned_failover_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_name, + failover_input=failover_input, + 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.ReplicationProtectedItem, 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.ReplicationProtectedItem].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ReplicationProtectedItem]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + disable_protection_input: Union[_models.DisableProtectionInput, JSON, 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(disable_protection_input, (IOBase, bytes)): + _content = disable_protection_input + else: + _content = json.dumps(disable_protection_input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_protected_items_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_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 [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) + raise HttpResponseError(response=response, 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")) + + 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_delete( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + disable_protection_input: _models.DisableProtectionInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Disables protection. + + The operation to disable replication on a replication protected item. This will also remove the + item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param disable_protection_input: Disable protection input. Required. + :type disable_protection_input: + ~azure.mgmt.recoveryservicessiterecovery.models.DisableProtectionInput + :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_delete( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + disable_protection_input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Disables protection. + + The operation to disable replication on a replication protected item. This will also remove the + item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param disable_protection_input: Disable protection input. Required. + :type disable_protection_input: JSON + :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_delete( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + disable_protection_input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Disables protection. + + The operation to disable replication on a replication protected item. This will also remove the + item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param disable_protection_input: Disable protection input. Required. + :type disable_protection_input: 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_delete( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + disable_protection_input: Union[_models.DisableProtectionInput, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[None]: + """Disables protection. + + The operation to disable replication on a replication protected item. This will also remove the + item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param disable_protection_input: Disable protection input. Is one of the following types: + DisableProtectionInput, JSON, IO[bytes] Required. + :type disable_protection_input: + ~azure.mgmt.recoveryservicessiterecovery.models.DisableProtectionInput or JSON 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._delete_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_name, + disable_protection_input=disable_protection_input, + 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 _remove_disks_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + remove_disks_input: Union[_models.RemoveDisksInput, JSON, 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(remove_disks_input, (IOBase, bytes)): + _content = remove_disks_input + else: + _content = json.dumps(remove_disks_input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_protected_items_remove_disks_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_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) + raise HttpResponseError(response=response, 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")) + + 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_remove_disks( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + remove_disks_input: _models.RemoveDisksInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Removes disk(s). + + Operation to remove disk(s) from the replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param remove_disks_input: Remove disks input. Required. + :type remove_disks_input: ~azure.mgmt.recoveryservicessiterecovery.models.RemoveDisksInput + :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 ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_remove_disks( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + remove_disks_input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Removes disk(s). + + Operation to remove disk(s) from the replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param remove_disks_input: Remove disks input. Required. + :type remove_disks_input: JSON + :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 ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_remove_disks( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + remove_disks_input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Removes disk(s). + + Operation to remove disk(s) from the replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param remove_disks_input: Remove disks input. Required. + :type remove_disks_input: 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 ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_remove_disks( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + remove_disks_input: Union[_models.RemoveDisksInput, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Removes disk(s). + + Operation to remove disk(s) from the replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param remove_disks_input: Remove disks input. Is one of the following types: RemoveDisksInput, + JSON, IO[bytes] Required. + :type remove_disks_input: ~azure.mgmt.recoveryservicessiterecovery.models.RemoveDisksInput or + JSON or IO[bytes] + :return: An instance of LROPoller that returns ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :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.ReplicationProtectedItem] = 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._remove_disks_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_name, + remove_disks_input=remove_disks_input, + 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.ReplicationProtectedItem, 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.ReplicationProtectedItem].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ReplicationProtectedItem]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _repair_replication_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_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_replication_protected_items_repair_replication_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_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) + raise HttpResponseError(response=response, 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")) + + 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_repair_replication( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Resynchronize or repair replication. + + The operation to start resynchronize/repair replication for a replication protected item + requiring resynchronization. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :return: An instance of LROPoller that returns ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ReplicationProtectedItem] = 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._repair_replication_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.ReplicationProtectedItem, 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.ReplicationProtectedItem].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ReplicationProtectedItem]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _reprotect_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + reprotect_input: Union[_models.ReverseReplicationInput, JSON, 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(reprotect_input, (IOBase, bytes)): + _content = reprotect_input + else: + _content = json.dumps(reprotect_input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_protected_items_reprotect_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_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) + raise HttpResponseError(response=response, 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")) + + 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_reprotect( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + reprotect_input: _models.ReverseReplicationInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Execute Reverse Replication\\Reprotect. + + Operation to reprotect or reverse replicate a failed over replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param reprotect_input: Reverse replication input. Required. + :type reprotect_input: ~azure.mgmt.recoveryservicessiterecovery.models.ReverseReplicationInput + :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 ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reprotect( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + reprotect_input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Execute Reverse Replication\\Reprotect. + + Operation to reprotect or reverse replicate a failed over replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param reprotect_input: Reverse replication input. Required. + :type reprotect_input: JSON + :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 ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reprotect( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + reprotect_input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Execute Reverse Replication\\Reprotect. + + Operation to reprotect or reverse replicate a failed over replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param reprotect_input: Reverse replication input. Required. + :type reprotect_input: 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 ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_reprotect( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + reprotect_input: Union[_models.ReverseReplicationInput, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Execute Reverse Replication\\Reprotect. + + Operation to reprotect or reverse replicate a failed over replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param reprotect_input: Reverse replication input. Is one of the following types: + ReverseReplicationInput, JSON, IO[bytes] Required. + :type reprotect_input: ~azure.mgmt.recoveryservicessiterecovery.models.ReverseReplicationInput + or JSON or IO[bytes] + :return: An instance of LROPoller that returns ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :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.ReplicationProtectedItem] = 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._reprotect_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_name, + reprotect_input=reprotect_input, + 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.ReplicationProtectedItem, 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.ReplicationProtectedItem].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ReplicationProtectedItem]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _resolve_health_errors_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + resolve_health_input: Union[_models.ResolveHealthInput, JSON, 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(resolve_health_input, (IOBase, bytes)): + _content = resolve_health_input + else: + _content = json.dumps(resolve_health_input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_protected_items_resolve_health_errors_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_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) + raise HttpResponseError(response=response, 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")) + + 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_resolve_health_errors( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + resolve_health_input: _models.ResolveHealthInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Resolve health errors. + + Operation to resolve health issues of the replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param resolve_health_input: Health issue input object. Required. + :type resolve_health_input: ~azure.mgmt.recoveryservicessiterecovery.models.ResolveHealthInput + :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 ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_resolve_health_errors( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + resolve_health_input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Resolve health errors. + + Operation to resolve health issues of the replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param resolve_health_input: Health issue input object. Required. + :type resolve_health_input: JSON + :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 ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_resolve_health_errors( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + resolve_health_input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Resolve health errors. + + Operation to resolve health issues of the replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param resolve_health_input: Health issue input object. Required. + :type resolve_health_input: 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 ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_resolve_health_errors( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + resolve_health_input: Union[_models.ResolveHealthInput, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Resolve health errors. + + Operation to resolve health issues of the replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param resolve_health_input: Health issue input object. Is one of the following types: + ResolveHealthInput, JSON, IO[bytes] Required. + :type resolve_health_input: ~azure.mgmt.recoveryservicessiterecovery.models.ResolveHealthInput + or JSON or IO[bytes] + :return: An instance of LROPoller that returns ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :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.ReplicationProtectedItem] = 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._resolve_health_errors_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_name, + resolve_health_input=resolve_health_input, + 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.ReplicationProtectedItem, 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.ReplicationProtectedItem].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ReplicationProtectedItem]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _switch_provider_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + switch_provider_input: Union[_models.SwitchProviderInput, JSON, 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(switch_provider_input, (IOBase, bytes)): + _content = switch_provider_input + else: + _content = json.dumps(switch_provider_input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_protected_items_switch_provider_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + 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_switch_provider( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + switch_provider_input: _models.SwitchProviderInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Execute switch provider. + + Operation to initiate a switch provider of the replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param switch_provider_input: Switch provider input. Required. + :type switch_provider_input: + ~azure.mgmt.recoveryservicessiterecovery.models.SwitchProviderInput + :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 ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_switch_provider( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + switch_provider_input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Execute switch provider. + + Operation to initiate a switch provider of the replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param switch_provider_input: Switch provider input. Required. + :type switch_provider_input: JSON + :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 ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_switch_provider( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + switch_provider_input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Execute switch provider. + + Operation to initiate a switch provider of the replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param switch_provider_input: Switch provider input. Required. + :type switch_provider_input: 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 ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_switch_provider( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + switch_provider_input: Union[_models.SwitchProviderInput, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Execute switch provider. + + Operation to initiate a switch provider of the replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param switch_provider_input: Switch provider input. Is one of the following types: + SwitchProviderInput, JSON, IO[bytes] Required. + :type switch_provider_input: + ~azure.mgmt.recoveryservicessiterecovery.models.SwitchProviderInput or JSON or IO[bytes] + :return: An instance of LROPoller that returns ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :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.ReplicationProtectedItem] = 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._switch_provider_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_name, + switch_provider_input=switch_provider_input, + 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.ReplicationProtectedItem, 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.ReplicationProtectedItem].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ReplicationProtectedItem]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _test_failover_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + testfailover_input: Union[_models.TestFailoverInput, JSON, 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(testfailover_input, (IOBase, bytes)): + _content = testfailover_input + else: + _content = json.dumps(testfailover_input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_protected_items_test_failover_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_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) + raise HttpResponseError(response=response, 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")) + + 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_test_failover( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + testfailover_input: _models.TestFailoverInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Execute test failover. + + Operation to perform a test failover of the replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param testfailover_input: Test failover input. Required. + :type testfailover_input: ~azure.mgmt.recoveryservicessiterecovery.models.TestFailoverInput + :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 ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_test_failover( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + testfailover_input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Execute test failover. + + Operation to perform a test failover of the replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param testfailover_input: Test failover input. Required. + :type testfailover_input: JSON + :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 ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_test_failover( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + testfailover_input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Execute test failover. + + Operation to perform a test failover of the replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param testfailover_input: Test failover input. Required. + :type testfailover_input: 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 ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_test_failover( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + testfailover_input: Union[_models.TestFailoverInput, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Execute test failover. + + Operation to perform a test failover of the replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param testfailover_input: Test failover input. Is one of the following types: + TestFailoverInput, JSON, IO[bytes] Required. + :type testfailover_input: ~azure.mgmt.recoveryservicessiterecovery.models.TestFailoverInput or + JSON or IO[bytes] + :return: An instance of LROPoller that returns ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :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.ReplicationProtectedItem] = 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._test_failover_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_name, + testfailover_input=testfailover_input, + 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.ReplicationProtectedItem, 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.ReplicationProtectedItem].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ReplicationProtectedItem]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _test_failover_cleanup_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + cleanup_input: Union[_models.TestFailoverCleanupInput, JSON, 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(cleanup_input, (IOBase, bytes)): + _content = cleanup_input + else: + _content = json.dumps(cleanup_input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_protected_items_test_failover_cleanup_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_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) + raise HttpResponseError(response=response, 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")) + + 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_test_failover_cleanup( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + cleanup_input: _models.TestFailoverCleanupInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Execute test failover cleanup. + + Operation to clean up the test failover of a replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param cleanup_input: Test failover cleanup input. Required. + :type cleanup_input: ~azure.mgmt.recoveryservicessiterecovery.models.TestFailoverCleanupInput + :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 ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_test_failover_cleanup( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + cleanup_input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Execute test failover cleanup. + + Operation to clean up the test failover of a replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param cleanup_input: Test failover cleanup input. Required. + :type cleanup_input: JSON + :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 ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_test_failover_cleanup( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + cleanup_input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Execute test failover cleanup. + + Operation to clean up the test failover of a replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param cleanup_input: Test failover cleanup input. Required. + :type cleanup_input: 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 ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_test_failover_cleanup( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + cleanup_input: Union[_models.TestFailoverCleanupInput, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Execute test failover cleanup. + + Operation to clean up the test failover of a replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param cleanup_input: Test failover cleanup input. Is one of the following types: + TestFailoverCleanupInput, JSON, IO[bytes] Required. + :type cleanup_input: ~azure.mgmt.recoveryservicessiterecovery.models.TestFailoverCleanupInput + or JSON or IO[bytes] + :return: An instance of LROPoller that returns ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :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.ReplicationProtectedItem] = 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._test_failover_cleanup_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_name, + cleanup_input=cleanup_input, + 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.ReplicationProtectedItem, 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.ReplicationProtectedItem].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ReplicationProtectedItem]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _unplanned_failover_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + failover_input: Union[_models.UnplannedFailoverInput, JSON, 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(failover_input, (IOBase, bytes)): + _content = failover_input + else: + _content = json.dumps(failover_input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_protected_items_unplanned_failover_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_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) + raise HttpResponseError(response=response, 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")) + + 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_unplanned_failover( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + failover_input: _models.UnplannedFailoverInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Execute unplanned failover. + + Operation to initiate a failover of the replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param failover_input: Failover input. Required. + :type failover_input: ~azure.mgmt.recoveryservicessiterecovery.models.UnplannedFailoverInput + :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 ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_unplanned_failover( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + failover_input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Execute unplanned failover. + + Operation to initiate a failover of the replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param failover_input: Failover input. Required. + :type failover_input: JSON + :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 ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_unplanned_failover( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + failover_input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Execute unplanned failover. + + Operation to initiate a failover of the replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param failover_input: Failover input. Required. + :type failover_input: 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 ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_unplanned_failover( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + failover_input: Union[_models.UnplannedFailoverInput, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Execute unplanned failover. + + Operation to initiate a failover of the replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param failover_input: Failover input. Is one of the following types: UnplannedFailoverInput, + JSON, IO[bytes] Required. + :type failover_input: ~azure.mgmt.recoveryservicessiterecovery.models.UnplannedFailoverInput or + JSON or IO[bytes] + :return: An instance of LROPoller that returns ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :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.ReplicationProtectedItem] = 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._unplanned_failover_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_name, + failover_input=failover_input, + 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.ReplicationProtectedItem, 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.ReplicationProtectedItem].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ReplicationProtectedItem]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_appliance_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + appliance_update_input: Union[_models.UpdateApplianceForReplicationProtectedItemInput, JSON, 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(appliance_update_input, (IOBase, bytes)): + _content = appliance_update_input + else: + _content = json.dumps(appliance_update_input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_protected_items_update_appliance_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_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) + raise HttpResponseError(response=response, 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")) + + 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_appliance( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + appliance_update_input: _models.UpdateApplianceForReplicationProtectedItemInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Updates appliance for replication protected Item. + + The operation to update appliance of an ASR replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param appliance_update_input: Appliance update protection input. Required. + :type appliance_update_input: + ~azure.mgmt.recoveryservicessiterecovery.models.UpdateApplianceForReplicationProtectedItemInput + :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 ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_appliance( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + appliance_update_input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Updates appliance for replication protected Item. + + The operation to update appliance of an ASR replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param appliance_update_input: Appliance update protection input. Required. + :type appliance_update_input: JSON + :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 ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_appliance( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + appliance_update_input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Updates appliance for replication protected Item. + + The operation to update appliance of an ASR replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param appliance_update_input: Appliance update protection input. Required. + :type appliance_update_input: 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 ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_appliance( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + appliance_update_input: Union[_models.UpdateApplianceForReplicationProtectedItemInput, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Updates appliance for replication protected Item. + + The operation to update appliance of an ASR replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param appliance_update_input: Appliance update protection input. Is one of the following + types: UpdateApplianceForReplicationProtectedItemInput, JSON, IO[bytes] Required. + :type appliance_update_input: + ~azure.mgmt.recoveryservicessiterecovery.models.UpdateApplianceForReplicationProtectedItemInput + or JSON or IO[bytes] + :return: An instance of LROPoller that returns ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :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.ReplicationProtectedItem] = 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_appliance_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_name, + appliance_update_input=appliance_update_input, + 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.ReplicationProtectedItem, 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.ReplicationProtectedItem].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ReplicationProtectedItem]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_mobility_service_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + update_mobility_service_request: Union[_models.UpdateMobilityServiceRequest, JSON, 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(update_mobility_service_request, (IOBase, bytes)): + _content = update_mobility_service_request + else: + _content = json.dumps(update_mobility_service_request, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_protected_items_update_mobility_service_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_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) + raise HttpResponseError(response=response, 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")) + + 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_mobility_service( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + update_mobility_service_request: _models.UpdateMobilityServiceRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Update the mobility service on a protected item. + + The operation to update(push update) the installed mobility service software on a replication + protected item to the latest available version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param update_mobility_service_request: Request to update the mobility service on the protected + item. Required. + :type update_mobility_service_request: + ~azure.mgmt.recoveryservicessiterecovery.models.UpdateMobilityServiceRequest + :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 ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_mobility_service( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + update_mobility_service_request: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Update the mobility service on a protected item. + + The operation to update(push update) the installed mobility service software on a replication + protected item to the latest available version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param update_mobility_service_request: Request to update the mobility service on the protected + item. Required. + :type update_mobility_service_request: JSON + :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 ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_mobility_service( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + update_mobility_service_request: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Update the mobility service on a protected item. + + The operation to update(push update) the installed mobility service software on a replication + protected item to the latest available version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param update_mobility_service_request: Request to update the mobility service on the protected + item. Required. + :type update_mobility_service_request: 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 ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_mobility_service( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + update_mobility_service_request: Union[_models.UpdateMobilityServiceRequest, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Update the mobility service on a protected item. + + The operation to update(push update) the installed mobility service software on a replication + protected item to the latest available version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param update_mobility_service_request: Request to update the mobility service on the protected + item. Is one of the following types: UpdateMobilityServiceRequest, JSON, IO[bytes] Required. + :type update_mobility_service_request: + ~azure.mgmt.recoveryservicessiterecovery.models.UpdateMobilityServiceRequest or JSON or + IO[bytes] + :return: An instance of LROPoller that returns ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :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.ReplicationProtectedItem] = 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_mobility_service_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_name, + update_mobility_service_request=update_mobility_service_request, + 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.ReplicationProtectedItem, 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.ReplicationProtectedItem].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ReplicationProtectedItem]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _reinstall_mobility_service_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + update_mobility_service_request: Union[_models.ReinstallMobilityServiceRequest, JSON, 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(update_mobility_service_request, (IOBase, bytes)): + _content = update_mobility_service_request + else: + _content = json.dumps(update_mobility_service_request, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_protected_items_reinstall_mobility_service_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_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.ErrorResponse, + 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")) + + 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_reinstall_mobility_service( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + update_mobility_service_request: _models.ReinstallMobilityServiceRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Reinstall the mobility service on a protected item. + + The operation to reinstall the installed mobility service software on a replication protected + item to the latest available version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: The name of the protected item on which the agent is to + be updated. Required. + :type replicated_protected_item_name: str + :param update_mobility_service_request: Request to update the mobility service on the protected + item. Required. + :type update_mobility_service_request: + ~azure.mgmt.recoveryservicessiterecovery.models.ReinstallMobilityServiceRequest + :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 ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reinstall_mobility_service( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + update_mobility_service_request: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Reinstall the mobility service on a protected item. + + The operation to reinstall the installed mobility service software on a replication protected + item to the latest available version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: The name of the protected item on which the agent is to + be updated. Required. + :type replicated_protected_item_name: str + :param update_mobility_service_request: Request to update the mobility service on the protected + item. Required. + :type update_mobility_service_request: JSON + :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 ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reinstall_mobility_service( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + update_mobility_service_request: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Reinstall the mobility service on a protected item. + + The operation to reinstall the installed mobility service software on a replication protected + item to the latest available version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: The name of the protected item on which the agent is to + be updated. Required. + :type replicated_protected_item_name: str + :param update_mobility_service_request: Request to update the mobility service on the protected + item. Required. + :type update_mobility_service_request: 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 ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_reinstall_mobility_service( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + update_mobility_service_request: Union[_models.ReinstallMobilityServiceRequest, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectedItem]: + """Reinstall the mobility service on a protected item. + + The operation to reinstall the installed mobility service software on a replication protected + item to the latest available version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: The name of the protected item on which the agent is to + be updated. Required. + :type replicated_protected_item_name: str + :param update_mobility_service_request: Request to update the mobility service on the protected + item. Is one of the following types: ReinstallMobilityServiceRequest, JSON, IO[bytes] Required. + :type update_mobility_service_request: + ~azure.mgmt.recoveryservicessiterecovery.models.ReinstallMobilityServiceRequest or JSON or + IO[bytes] + :return: An instance of LROPoller that returns ReplicationProtectedItem. The + ReplicationProtectedItem is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :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.ReplicationProtectedItem] = 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._reinstall_mobility_service_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_name, + update_mobility_service_request=update_mobility_service_request, + 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["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.ReplicationProtectedItem, 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.ReplicationProtectedItem].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ReplicationProtectedItem]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def list( + self, + resource_group_name: str, + resource_name: str, + *, + skip_token: Optional[str] = None, + filter: Optional[str] = None, + **kwargs: Any + ) -> ItemPaged["_models.ReplicationProtectedItem"]: + """Gets the list of replication protected items. + + Gets the list of ASR replication protected items in the vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :keyword skip_token: The pagination token. Possible values: "FabricId" or "FabricId_CloudId" or + null. Default value is None. + :paramtype skip_token: str + :keyword filter: OData filter options. Default value is None. + :paramtype filter: str + :return: An iterator like instance of ReplicationProtectedItem + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ReplicationProtectedItem]] = 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_replication_protected_items_list_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + skip_token=skip_token, + filter=filter, + 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), 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.ReplicationProtectedItem], + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class TargetComputeSizesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.SiteRecoveryManagementClient`'s + :attr:`target_compute_sizes` 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: SiteRecoveryManagementClientConfiguration = ( + 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_replication_protected_items( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + **kwargs: Any + ) -> ItemPaged["_models.TargetComputeSize"]: + """Gets the list of target compute sizes for the replication protected item. + + Lists the available target compute sizes for a replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :return: An iterator like instance of TargetComputeSize + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.TargetComputeSize] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.TargetComputeSize]] = 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_target_compute_sizes_list_by_replication_protected_items_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_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), 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.TargetComputeSize], + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class RecoveryPointsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.SiteRecoveryManagementClient`'s + :attr:`recovery_points` 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: SiteRecoveryManagementClientConfiguration = ( + 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, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + recovery_point_name: str, + **kwargs: Any + ) -> _models.RecoveryPoint: + """Gets a recovery point. + + Get the details of specified recovery point. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :param recovery_point_name: The recovery point name. Required. + :type recovery_point_name: str + :return: RecoveryPoint. The RecoveryPoint is compatible with MutableMapping + :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPoint + :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.RecoveryPoint] = kwargs.pop("cls", None) + + _request = build_recovery_points_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_name, + recovery_point_name=recovery_point_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.RecoveryPoint, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_replication_protected_items( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replicated_protected_item_name: str, + **kwargs: Any + ) -> ItemPaged["_models.RecoveryPoint"]: + """Gets the list of recovery points for a replication protected item. + + Lists the available recovery points for a replication protected item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replicated_protected_item_name: Replication protected item name. Required. + :type replicated_protected_item_name: str + :return: An iterator like instance of RecoveryPoint + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.RecoveryPoint]] = 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_recovery_points_list_by_replication_protected_items_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replicated_protected_item_name=replicated_protected_item_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), 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.RecoveryPoint], + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class ReplicationProtectionClustersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.SiteRecoveryManagementClient`'s + :attr:`replication_protection_clusters` 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: SiteRecoveryManagementClientConfiguration = ( + 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, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replication_protection_cluster_name: str, + **kwargs: Any + ) -> _models.ReplicationProtectionCluster: + """Gets the details of a Replication protection cluster. + + Gets the details of an ASR replication protection cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replication_protection_cluster_name: Replication protection cluster name. Required. + :type replication_protection_cluster_name: str + :return: ReplicationProtectionCluster. The ReplicationProtectionCluster is compatible with + MutableMapping + :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster + :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.ReplicationProtectionCluster] = kwargs.pop("cls", None) + + _request = build_replication_protection_clusters_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replication_protection_cluster_name=replication_protection_cluster_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.ErrorResponse, + 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.ReplicationProtectionCluster, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replication_protection_cluster_name: str, + replication_protection_cluster: Union[_models.ReplicationProtectionCluster, JSON, 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(replication_protection_cluster, (IOBase, bytes)): + _content = replication_protection_cluster + else: + _content = json.dumps(replication_protection_cluster, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_protection_clusters_create_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replication_protection_cluster_name=replication_protection_cluster_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.ErrorResponse, + 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["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + 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, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replication_protection_cluster_name: str, + replication_protection_cluster: _models.ReplicationProtectionCluster, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectionCluster]: + """Create Replication protection Cluster. + + The operation to create an ASR replication protection cluster item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replication_protection_cluster_name: Replication protection cluster name. Required. + :type replication_protection_cluster_name: str + :param replication_protection_cluster: Create replication protection cluster Input. Required. + :type replication_protection_cluster: + ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster + :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 ReplicationProtectionCluster. The + ReplicationProtectionCluster is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replication_protection_cluster_name: str, + replication_protection_cluster: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectionCluster]: + """Create Replication protection Cluster. + + The operation to create an ASR replication protection cluster item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replication_protection_cluster_name: Replication protection cluster name. Required. + :type replication_protection_cluster_name: str + :param replication_protection_cluster: Create replication protection cluster Input. Required. + :type replication_protection_cluster: JSON + :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 ReplicationProtectionCluster. The + ReplicationProtectionCluster is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replication_protection_cluster_name: str, + replication_protection_cluster: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectionCluster]: + """Create Replication protection Cluster. + + The operation to create an ASR replication protection cluster item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replication_protection_cluster_name: Replication protection cluster name. Required. + :type replication_protection_cluster_name: str + :param replication_protection_cluster: Create replication protection cluster Input. Required. + :type replication_protection_cluster: 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 ReplicationProtectionCluster. The + ReplicationProtectionCluster is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replication_protection_cluster_name: str, + replication_protection_cluster: Union[_models.ReplicationProtectionCluster, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectionCluster]: + """Create Replication protection Cluster. + + The operation to create an ASR replication protection cluster item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replication_protection_cluster_name: Replication protection cluster name. Required. + :type replication_protection_cluster_name: str + :param replication_protection_cluster: Create replication protection cluster Input. Is one of + the following types: ReplicationProtectionCluster, JSON, IO[bytes] Required. + :type replication_protection_cluster: + ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster or JSON or + IO[bytes] + :return: An instance of LROPoller that returns ReplicationProtectionCluster. The + ReplicationProtectionCluster is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster] + :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.ReplicationProtectionCluster] = 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, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replication_protection_cluster_name=replication_protection_cluster_name, + replication_protection_cluster=replication_protection_cluster, + 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.ReplicationProtectionCluster, 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.ReplicationProtectionCluster].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ReplicationProtectionCluster]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _purge_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replication_protection_cluster_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_replication_protection_clusters_purge_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replication_protection_cluster_name=replication_protection_cluster_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 [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.ErrorResponse, + 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["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + 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_purge( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replication_protection_cluster_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Purge the replication protection cluster. + + The operation to purge the replication protection cluster. This operation will force delete the + replication protection cluster. Use the remove operation on replication protection cluster to + perform a clean disable replication protection cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replication_protection_cluster_name: Replication protection cluster name. Required. + :type replication_protection_cluster_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._purge_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replication_protection_cluster_name=replication_protection_cluster_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 + + def _apply_recovery_point_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replication_protection_cluster_name: str, + apply_cluster_recovery_point_input: Union[_models.ApplyClusterRecoveryPointInput, JSON, 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(apply_cluster_recovery_point_input, (IOBase, bytes)): + _content = apply_cluster_recovery_point_input + else: + _content = json.dumps(apply_cluster_recovery_point_input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_protection_clusters_apply_recovery_point_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replication_protection_cluster_name=replication_protection_cluster_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.ErrorResponse, + 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["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + 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_apply_recovery_point( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replication_protection_cluster_name: str, + apply_cluster_recovery_point_input: _models.ApplyClusterRecoveryPointInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectionCluster]: + """Execute the change recovery point operation for cluster. + + Operation to apply a new cluster recovery point on the Protection cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replication_protection_cluster_name: Replication protection cluster name. Required. + :type replication_protection_cluster_name: str + :param apply_cluster_recovery_point_input: Apply recovery point input. Required. + :type apply_cluster_recovery_point_input: + ~azure.mgmt.recoveryservicessiterecovery.models.ApplyClusterRecoveryPointInput + :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 ReplicationProtectionCluster. The + ReplicationProtectionCluster is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_apply_recovery_point( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replication_protection_cluster_name: str, + apply_cluster_recovery_point_input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectionCluster]: + """Execute the change recovery point operation for cluster. + + Operation to apply a new cluster recovery point on the Protection cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replication_protection_cluster_name: Replication protection cluster name. Required. + :type replication_protection_cluster_name: str + :param apply_cluster_recovery_point_input: Apply recovery point input. Required. + :type apply_cluster_recovery_point_input: JSON + :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 ReplicationProtectionCluster. The + ReplicationProtectionCluster is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_apply_recovery_point( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replication_protection_cluster_name: str, + apply_cluster_recovery_point_input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectionCluster]: + """Execute the change recovery point operation for cluster. + + Operation to apply a new cluster recovery point on the Protection cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replication_protection_cluster_name: Replication protection cluster name. Required. + :type replication_protection_cluster_name: str + :param apply_cluster_recovery_point_input: Apply recovery point input. Required. + :type apply_cluster_recovery_point_input: 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 ReplicationProtectionCluster. The + ReplicationProtectionCluster is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_apply_recovery_point( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replication_protection_cluster_name: str, + apply_cluster_recovery_point_input: Union[_models.ApplyClusterRecoveryPointInput, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectionCluster]: + """Execute the change recovery point operation for cluster. + + Operation to apply a new cluster recovery point on the Protection cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replication_protection_cluster_name: Replication protection cluster name. Required. + :type replication_protection_cluster_name: str + :param apply_cluster_recovery_point_input: Apply recovery point input. Is one of the following + types: ApplyClusterRecoveryPointInput, JSON, IO[bytes] Required. + :type apply_cluster_recovery_point_input: + ~azure.mgmt.recoveryservicessiterecovery.models.ApplyClusterRecoveryPointInput or JSON or + IO[bytes] + :return: An instance of LROPoller that returns ReplicationProtectionCluster. The + ReplicationProtectionCluster is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster] + :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.ReplicationProtectionCluster] = 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._apply_recovery_point_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replication_protection_cluster_name=replication_protection_cluster_name, + apply_cluster_recovery_point_input=apply_cluster_recovery_point_input, + 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["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.ReplicationProtectionCluster, 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.ReplicationProtectionCluster].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ReplicationProtectionCluster]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _failover_commit_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replication_protection_cluster_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_replication_protection_clusters_failover_commit_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replication_protection_cluster_name=replication_protection_cluster_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.ErrorResponse, + 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["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + 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_failover_commit( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replication_protection_cluster_name: str, + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectionCluster]: + """Execute commit failover for cluster. + + Operation to initiate commit failover of the replication protection cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replication_protection_cluster_name: Replication protection cluster name. Required. + :type replication_protection_cluster_name: str + :return: An instance of LROPoller that returns ReplicationProtectionCluster. The + ReplicationProtectionCluster is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ReplicationProtectionCluster] = 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._failover_commit_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replication_protection_cluster_name=replication_protection_cluster_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): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.ReplicationProtectionCluster, 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.ReplicationProtectionCluster].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ReplicationProtectionCluster]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _repair_replication_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replication_protection_cluster_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_replication_protection_clusters_repair_replication_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replication_protection_cluster_name=replication_protection_cluster_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.ErrorResponse, + 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["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + 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_repair_replication( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replication_protection_cluster_name: str, + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectionCluster]: + """Resynchronize or repair replication of protection cluster. + + The operation to repair replication protection cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replication_protection_cluster_name: Replication protection cluster name. Required. + :type replication_protection_cluster_name: str + :return: An instance of LROPoller that returns ReplicationProtectionCluster. The + ReplicationProtectionCluster is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ReplicationProtectionCluster] = 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._repair_replication_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replication_protection_cluster_name=replication_protection_cluster_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): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.ReplicationProtectionCluster, 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.ReplicationProtectionCluster].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ReplicationProtectionCluster]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _test_failover_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replication_protection_cluster_name: str, + failover_input: Union[_models.ClusterTestFailoverInput, JSON, 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(failover_input, (IOBase, bytes)): + _content = failover_input + else: + _content = json.dumps(failover_input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_protection_clusters_test_failover_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replication_protection_cluster_name=replication_protection_cluster_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.ErrorResponse, + 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["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + 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_test_failover( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replication_protection_cluster_name: str, + failover_input: _models.ClusterTestFailoverInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectionCluster]: + """Execute test failover for cluster. + + Operation to initiate a failover of the replication protection cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replication_protection_cluster_name: Replication protection cluster name. Required. + :type replication_protection_cluster_name: str + :param failover_input: Cluster test failover input body. Required. + :type failover_input: ~azure.mgmt.recoveryservicessiterecovery.models.ClusterTestFailoverInput + :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 ReplicationProtectionCluster. The + ReplicationProtectionCluster is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_test_failover( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replication_protection_cluster_name: str, + failover_input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectionCluster]: + """Execute test failover for cluster. + + Operation to initiate a failover of the replication protection cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replication_protection_cluster_name: Replication protection cluster name. Required. + :type replication_protection_cluster_name: str + :param failover_input: Cluster test failover input body. Required. + :type failover_input: JSON + :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 ReplicationProtectionCluster. The + ReplicationProtectionCluster is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_test_failover( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replication_protection_cluster_name: str, + failover_input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectionCluster]: + """Execute test failover for cluster. + + Operation to initiate a failover of the replication protection cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replication_protection_cluster_name: Replication protection cluster name. Required. + :type replication_protection_cluster_name: str + :param failover_input: Cluster test failover input body. Required. + :type failover_input: 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 ReplicationProtectionCluster. The + ReplicationProtectionCluster is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_test_failover( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replication_protection_cluster_name: str, + failover_input: Union[_models.ClusterTestFailoverInput, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectionCluster]: + """Execute test failover for cluster. + + Operation to initiate a failover of the replication protection cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replication_protection_cluster_name: Replication protection cluster name. Required. + :type replication_protection_cluster_name: str + :param failover_input: Cluster test failover input body. Is one of the following types: + ClusterTestFailoverInput, JSON, IO[bytes] Required. + :type failover_input: ~azure.mgmt.recoveryservicessiterecovery.models.ClusterTestFailoverInput + or JSON or IO[bytes] + :return: An instance of LROPoller that returns ReplicationProtectionCluster. The + ReplicationProtectionCluster is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster] + :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.ReplicationProtectionCluster] = 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._test_failover_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replication_protection_cluster_name=replication_protection_cluster_name, + failover_input=failover_input, + 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["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.ReplicationProtectionCluster, 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.ReplicationProtectionCluster].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ReplicationProtectionCluster]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _test_failover_cleanup_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replication_protection_cluster_name: str, + cleanup_input: Union[_models.ClusterTestFailoverCleanupInput, JSON, 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(cleanup_input, (IOBase, bytes)): + _content = cleanup_input + else: + _content = json.dumps(cleanup_input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_protection_clusters_test_failover_cleanup_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replication_protection_cluster_name=replication_protection_cluster_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.ErrorResponse, + 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["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + 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_test_failover_cleanup( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replication_protection_cluster_name: str, + cleanup_input: _models.ClusterTestFailoverCleanupInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectionCluster]: + """Execute test failover cleanup for cluster. + + Operation to clean up the test failover of a replication protected cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replication_protection_cluster_name: Replication protection cluster name. Required. + :type replication_protection_cluster_name: str + :param cleanup_input: Test failover cleanup input. Required. + :type cleanup_input: + ~azure.mgmt.recoveryservicessiterecovery.models.ClusterTestFailoverCleanupInput + :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 ReplicationProtectionCluster. The + ReplicationProtectionCluster is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_test_failover_cleanup( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replication_protection_cluster_name: str, + cleanup_input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectionCluster]: + """Execute test failover cleanup for cluster. + + Operation to clean up the test failover of a replication protected cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replication_protection_cluster_name: Replication protection cluster name. Required. + :type replication_protection_cluster_name: str + :param cleanup_input: Test failover cleanup input. Required. + :type cleanup_input: JSON + :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 ReplicationProtectionCluster. The + ReplicationProtectionCluster is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_test_failover_cleanup( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replication_protection_cluster_name: str, + cleanup_input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectionCluster]: + """Execute test failover cleanup for cluster. + + Operation to clean up the test failover of a replication protected cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replication_protection_cluster_name: Replication protection cluster name. Required. + :type replication_protection_cluster_name: str + :param cleanup_input: Test failover cleanup input. Required. + :type cleanup_input: 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 ReplicationProtectionCluster. The + ReplicationProtectionCluster is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_test_failover_cleanup( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replication_protection_cluster_name: str, + cleanup_input: Union[_models.ClusterTestFailoverCleanupInput, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectionCluster]: + """Execute test failover cleanup for cluster. + + Operation to clean up the test failover of a replication protected cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replication_protection_cluster_name: Replication protection cluster name. Required. + :type replication_protection_cluster_name: str + :param cleanup_input: Test failover cleanup input. Is one of the following types: + ClusterTestFailoverCleanupInput, JSON, IO[bytes] Required. + :type cleanup_input: + ~azure.mgmt.recoveryservicessiterecovery.models.ClusterTestFailoverCleanupInput or JSON or + IO[bytes] + :return: An instance of LROPoller that returns ReplicationProtectionCluster. The + ReplicationProtectionCluster is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster] + :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.ReplicationProtectionCluster] = 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._test_failover_cleanup_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replication_protection_cluster_name=replication_protection_cluster_name, + cleanup_input=cleanup_input, + 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["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.ReplicationProtectionCluster, 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.ReplicationProtectionCluster].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ReplicationProtectionCluster]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _unplanned_failover_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replication_protection_cluster_name: str, + failover_input: Union[_models.ClusterUnplannedFailoverInput, JSON, 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(failover_input, (IOBase, bytes)): + _content = failover_input + else: + _content = json.dumps(failover_input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_protection_clusters_unplanned_failover_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replication_protection_cluster_name=replication_protection_cluster_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.ErrorResponse, + 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["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + 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_unplanned_failover( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replication_protection_cluster_name: str, + failover_input: _models.ClusterUnplannedFailoverInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectionCluster]: + """Execute unplanned cluster failover. + + Operation to initiate a failover of the replication protection cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replication_protection_cluster_name: Replication protection cluster name. Required. + :type replication_protection_cluster_name: str + :param failover_input: Failover input. Required. + :type failover_input: + ~azure.mgmt.recoveryservicessiterecovery.models.ClusterUnplannedFailoverInput + :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 ReplicationProtectionCluster. The + ReplicationProtectionCluster is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_unplanned_failover( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replication_protection_cluster_name: str, + failover_input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectionCluster]: + """Execute unplanned cluster failover. + + Operation to initiate a failover of the replication protection cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replication_protection_cluster_name: Replication protection cluster name. Required. + :type replication_protection_cluster_name: str + :param failover_input: Failover input. Required. + :type failover_input: JSON + :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 ReplicationProtectionCluster. The + ReplicationProtectionCluster is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_unplanned_failover( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replication_protection_cluster_name: str, + failover_input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectionCluster]: + """Execute unplanned cluster failover. + + Operation to initiate a failover of the replication protection cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replication_protection_cluster_name: Replication protection cluster name. Required. + :type replication_protection_cluster_name: str + :param failover_input: Failover input. Required. + :type failover_input: 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 ReplicationProtectionCluster. The + ReplicationProtectionCluster is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_unplanned_failover( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replication_protection_cluster_name: str, + failover_input: Union[_models.ClusterUnplannedFailoverInput, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.ReplicationProtectionCluster]: + """Execute unplanned cluster failover. + + Operation to initiate a failover of the replication protection cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replication_protection_cluster_name: Replication protection cluster name. Required. + :type replication_protection_cluster_name: str + :param failover_input: Failover input. Is one of the following types: + ClusterUnplannedFailoverInput, JSON, IO[bytes] Required. + :type failover_input: + ~azure.mgmt.recoveryservicessiterecovery.models.ClusterUnplannedFailoverInput or JSON or + IO[bytes] + :return: An instance of LROPoller that returns ReplicationProtectionCluster. The + ReplicationProtectionCluster is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster] + :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.ReplicationProtectionCluster] = 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._unplanned_failover_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replication_protection_cluster_name=replication_protection_cluster_name, + failover_input=failover_input, + 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["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.ReplicationProtectionCluster, 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.ReplicationProtectionCluster].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ReplicationProtectionCluster]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def get_operation_results( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replication_protection_cluster_name: str, + job_id: str, + **kwargs: Any + ) -> _models.ReplicationProtectionCluster: + """Tracks the Replication protection cluster async operation. + + Track the results of an asynchronous operation on the replication protection cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replication_protection_cluster_name: Replication protection cluster name. Required. + :type replication_protection_cluster_name: str + :param job_id: job id to track. Required. + :type job_id: str + :return: ReplicationProtectionCluster. The ReplicationProtectionCluster is compatible with + MutableMapping + :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster + :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.ReplicationProtectionCluster] = kwargs.pop("cls", None) + + _request = build_replication_protection_clusters_get_operation_results_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replication_protection_cluster_name=replication_protection_cluster_name, + job_id=job_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.ErrorResponse, + 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.ReplicationProtectionCluster, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_replication_protection_containers( # pylint: disable=name-too-long + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + **kwargs: Any + ) -> ItemPaged["_models.ReplicationProtectionCluster"]: + """Gets the list of Replication protection clusters in fabric, container. + + Gets the list of ASR replication protected clusters in the protection container. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :return: An iterator like instance of ReplicationProtectionCluster + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ReplicationProtectionCluster]] = 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_replication_protection_clusters_list_by_replication_protection_containers_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_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), 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.ReplicationProtectionCluster], + 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.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list( + self, + resource_group_name: str, + resource_name: str, + *, + skip_token: Optional[str] = None, + filter: Optional[str] = None, + **kwargs: Any + ) -> ItemPaged["_models.ReplicationProtectionCluster"]: + """Gets the list of Replication protection clusters in vault. + + Gets the list of ASR replication protected clusters in the vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :keyword skip_token: The pagination token. Possible values: "FabricId" or "FabricId_CloudId" or + null. Default value is None. + :paramtype skip_token: str + :keyword filter: OData filter options. Default value is None. + :paramtype filter: str + :return: An iterator like instance of ReplicationProtectionCluster + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ReplicationProtectionCluster]] = 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_replication_protection_clusters_list_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + skip_token=skip_token, + filter=filter, + 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), 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.ReplicationProtectionCluster], + 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.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class ClusterRecoveryPointsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.SiteRecoveryManagementClient`'s + :attr:`cluster_recovery_points` 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: SiteRecoveryManagementClientConfiguration = ( + 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_replication_protection_cluster( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replication_protection_cluster_name: str, + **kwargs: Any + ) -> ItemPaged["_models.ClusterRecoveryPoint"]: + """Gets the list of cluster recovery points. + + The list of cluster recovery points. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replication_protection_cluster_name: Replication protection cluster name. Required. + :type replication_protection_cluster_name: str + :return: An iterator like instance of ClusterRecoveryPoint + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.ClusterRecoveryPoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ClusterRecoveryPoint]] = 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_cluster_recovery_points_list_by_replication_protection_cluster_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replication_protection_cluster_name=replication_protection_cluster_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), 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.ClusterRecoveryPoint], + 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.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class ReplicationProtectionIntentsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.SiteRecoveryManagementClient`'s + :attr:`replication_protection_intents` 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: SiteRecoveryManagementClientConfiguration = ( + 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, resource_name: str, intent_object_name: str, **kwargs: Any + ) -> _models.ReplicationProtectionIntent: + """Gets the details of a Replication protection intent item. + + Gets the details of an ASR replication protection intent. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param intent_object_name: Replication protection intent name. Required. + :type intent_object_name: str + :return: ReplicationProtectionIntent. The ReplicationProtectionIntent is compatible with + MutableMapping + :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionIntent + :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.ReplicationProtectionIntent] = kwargs.pop("cls", None) + + _request = build_replication_protection_intents_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + intent_object_name=intent_object_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ReplicationProtectionIntent, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def create( + self, + resource_group_name: str, + resource_name: str, + intent_object_name: str, + input: _models.CreateProtectionIntentInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ReplicationProtectionIntent: + """Create protection intent Resource. + + The operation to create an ASR replication protection intent item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param intent_object_name: Replication protection intent name. Required. + :type intent_object_name: str + :param input: Create Protection Intent Input. Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.CreateProtectionIntentInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ReplicationProtectionIntent. The ReplicationProtectionIntent is compatible with + MutableMapping + :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionIntent + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create( + self, + resource_group_name: str, + resource_name: str, + intent_object_name: str, + input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ReplicationProtectionIntent: + """Create protection intent Resource. + + The operation to create an ASR replication protection intent item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param intent_object_name: Replication protection intent name. Required. + :type intent_object_name: str + :param input: Create Protection Intent Input. Required. + :type input: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ReplicationProtectionIntent. The ReplicationProtectionIntent is compatible with + MutableMapping + :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionIntent + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create( + self, + resource_group_name: str, + resource_name: str, + intent_object_name: str, + input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ReplicationProtectionIntent: + """Create protection intent Resource. + + The operation to create an ASR replication protection intent item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param intent_object_name: Replication protection intent name. Required. + :type intent_object_name: str + :param input: Create Protection Intent Input. Required. + :type input: 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: ReplicationProtectionIntent. The ReplicationProtectionIntent is compatible with + MutableMapping + :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionIntent + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create( + self, + resource_group_name: str, + resource_name: str, + intent_object_name: str, + input: Union[_models.CreateProtectionIntentInput, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.ReplicationProtectionIntent: + """Create protection intent Resource. + + The operation to create an ASR replication protection intent item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param intent_object_name: Replication protection intent name. Required. + :type intent_object_name: str + :param input: Create Protection Intent Input. Is one of the following types: + CreateProtectionIntentInput, JSON, IO[bytes] Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.CreateProtectionIntentInput or + JSON or IO[bytes] + :return: ReplicationProtectionIntent. The ReplicationProtectionIntent is compatible with + MutableMapping + :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionIntent + :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.ReplicationProtectionIntent] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(input, (IOBase, bytes)): + _content = input + else: + _content = json.dumps(input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_protection_intents_create_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + intent_object_name=intent_object_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ReplicationProtectionIntent, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + resource_name: str, + *, + skip_token: Optional[str] = None, + take_token: Optional[str] = None, + **kwargs: Any + ) -> ItemPaged["_models.ReplicationProtectionIntent"]: + """Gets the list of replication protection intent objects. + + Gets the list of ASR replication protection intent objects in the vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :keyword skip_token: The pagination token. Default value is None. + :paramtype skip_token: str + :keyword take_token: The page size. Default value is None. + :paramtype take_token: str + :return: An iterator like instance of ReplicationProtectionIntent + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionIntent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ReplicationProtectionIntent]] = 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_replication_protection_intents_list_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + skip_token=skip_token, + take_token=take_token, + 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), 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.ReplicationProtectionIntent], + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class ReplicationAlertSettingsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.SiteRecoveryManagementClient`'s + :attr:`replication_alert_settings` 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: SiteRecoveryManagementClientConfiguration = ( + 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, resource_name: str, alert_setting_name: str, **kwargs: Any + ) -> _models.Alert: + """Gets an email notification(alert) configuration. + + Gets the details of the specified email notification(alert) configuration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param alert_setting_name: The name of the email notification configuration. Required. + :type alert_setting_name: str + :return: Alert. The Alert is compatible with MutableMapping + :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.Alert + :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.Alert] = kwargs.pop("cls", None) + + _request = build_replication_alert_settings_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + alert_setting_name=alert_setting_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Alert, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def create( + self, + resource_group_name: str, + resource_name: str, + alert_setting_name: str, + request: _models.ConfigureAlertRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Alert: + """Configures email notifications for this vault. + + Create or update an email notification(alert) configuration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param alert_setting_name: The name of the email notification configuration. Required. + :type alert_setting_name: str + :param request: The input to configure the email notification(alert). Required. + :type request: ~azure.mgmt.recoveryservicessiterecovery.models.ConfigureAlertRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Alert. The Alert is compatible with MutableMapping + :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.Alert + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create( + self, + resource_group_name: str, + resource_name: str, + alert_setting_name: str, + request: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Alert: + """Configures email notifications for this vault. + + Create or update an email notification(alert) configuration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param alert_setting_name: The name of the email notification configuration. Required. + :type alert_setting_name: str + :param request: The input to configure the email notification(alert). Required. + :type request: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Alert. The Alert is compatible with MutableMapping + :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.Alert + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create( + self, + resource_group_name: str, + resource_name: str, + alert_setting_name: str, + request: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Alert: + """Configures email notifications for this vault. + + Create or update an email notification(alert) configuration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param alert_setting_name: The name of the email notification configuration. Required. + :type alert_setting_name: str + :param request: The input to configure the email notification(alert). Required. + :type request: 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: Alert. The Alert is compatible with MutableMapping + :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.Alert + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create( + self, + resource_group_name: str, + resource_name: str, + alert_setting_name: str, + request: Union[_models.ConfigureAlertRequest, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.Alert: + """Configures email notifications for this vault. + + Create or update an email notification(alert) configuration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param alert_setting_name: The name of the email notification configuration. Required. + :type alert_setting_name: str + :param request: The input to configure the email notification(alert). Is one of the following + types: ConfigureAlertRequest, JSON, IO[bytes] Required. + :type request: ~azure.mgmt.recoveryservicessiterecovery.models.ConfigureAlertRequest or JSON or + IO[bytes] + :return: Alert. The Alert is compatible with MutableMapping + :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.Alert + :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.Alert] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(request, (IOBase, bytes)): + _content = request + else: + _content = json.dumps(request, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_alert_settings_create_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + alert_setting_name=alert_setting_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Alert, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> ItemPaged["_models.Alert"]: + """Gets the list of configured email notification(alert) configurations. + + Gets the list of email notification(alert) configurations for the vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :return: An iterator like instance of Alert + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.Alert] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Alert]] = 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_replication_alert_settings_list_request( + resource_group_name=resource_group_name, + resource_name=resource_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), 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.Alert], + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class ReplicationEligibilityResultsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.SiteRecoveryManagementClient`'s + :attr:`replication_eligibility_results` 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: SiteRecoveryManagementClientConfiguration = ( + 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, virtual_machine_name: str, **kwargs: Any + ) -> _models.ReplicationEligibilityResults: + """Gets the validation errors in case the VM is unsuitable for protection. + + Validates whether a given VM can be protected or not in which case returns list of errors. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param virtual_machine_name: Virtual Machine name. Required. + :type virtual_machine_name: str + :return: ReplicationEligibilityResults. The ReplicationEligibilityResults is compatible with + MutableMapping + :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationEligibilityResults + :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.ReplicationEligibilityResults] = kwargs.pop("cls", None) + + _request = build_replication_eligibility_results_get_request( + resource_group_name=resource_group_name, + virtual_machine_name=virtual_machine_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ReplicationEligibilityResults, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list( + self, resource_group_name: str, virtual_machine_name: str, **kwargs: Any + ) -> _models.ReplicationEligibilityResultsCollection: + """Gets the validation errors in case the VM is unsuitable for protection. + + Validates whether a given VM can be protected or not in which case returns list of errors. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param virtual_machine_name: Virtual Machine name. Required. + :type virtual_machine_name: str + :return: ReplicationEligibilityResultsCollection. The ReplicationEligibilityResultsCollection + is compatible with MutableMapping + :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationEligibilityResultsCollection + :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.ReplicationEligibilityResultsCollection] = kwargs.pop("cls", None) + + _request = build_replication_eligibility_results_list_request( + resource_group_name=resource_group_name, + virtual_machine_name=virtual_machine_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ReplicationEligibilityResultsCollection, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class ReplicationEventsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.SiteRecoveryManagementClient`'s + :attr:`replication_events` 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: SiteRecoveryManagementClientConfiguration = ( + 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, resource_name: str, event_name: str, **kwargs: Any) -> _models.Event: + """Get the details of an Azure Site recovery event. + + The operation to get the details of an Azure Site recovery event. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param event_name: The name of the Azure Site Recovery event. Required. + :type event_name: str + :return: Event. The Event is compatible with MutableMapping + :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.Event + :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.Event] = kwargs.pop("cls", None) + + _request = build_replication_events_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + event_name=event_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Event, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list( + self, resource_group_name: str, resource_name: str, *, filter: Optional[str] = None, **kwargs: Any + ) -> ItemPaged["_models.Event"]: + """Gets the list of Azure Site Recovery events. + + Gets the list of Azure Site Recovery events for the vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :keyword filter: OData filter options. Default value is None. + :paramtype filter: str + :return: An iterator like instance of Event + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.Event] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Event]] = 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_replication_events_list_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + filter=filter, + 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), 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.Event], + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class ReplicationFabricsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.SiteRecoveryManagementClient`'s + :attr:`replication_fabrics` 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: SiteRecoveryManagementClientConfiguration = ( + 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, + resource_name: str, + fabric_name: str, + *, + filter: Optional[str] = None, + **kwargs: Any + ) -> _models.Fabric: + """Gets the details of an ASR fabric. + + Gets the details of an Azure Site Recovery fabric. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :keyword filter: OData filter options. Default value is None. + :paramtype filter: str + :return: Fabric. The Fabric is compatible with MutableMapping + :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.Fabric + :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.Fabric] = kwargs.pop("cls", None) + + _request = build_replication_fabrics_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + subscription_id=self._config.subscription_id, + filter=filter, + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Fabric, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + input: Union[_models.FabricCreationInput, JSON, 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(input, (IOBase, bytes)): + _content = input + else: + _content = json.dumps(input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_fabrics_create_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_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) + raise HttpResponseError(response=response, 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")) + + 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, + resource_name: str, + fabric_name: str, + input: _models.FabricCreationInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Fabric]: + """Creates an Azure Site Recovery fabric. + + The operation to create an Azure Site Recovery fabric (for e.g. Hyper-V site). + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param input: Fabric creation input. Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.FabricCreationInput + :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 Fabric. The Fabric is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Fabric] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Fabric]: + """Creates an Azure Site Recovery fabric. + + The operation to create an Azure Site Recovery fabric (for e.g. Hyper-V site). + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param input: Fabric creation input. Required. + :type input: JSON + :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 Fabric. The Fabric is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Fabric] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Fabric]: + """Creates an Azure Site Recovery fabric. + + The operation to create an Azure Site Recovery fabric (for e.g. Hyper-V site). + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param input: Fabric creation input. Required. + :type input: 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 Fabric. The Fabric is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Fabric] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + input: Union[_models.FabricCreationInput, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.Fabric]: + """Creates an Azure Site Recovery fabric. + + The operation to create an Azure Site Recovery fabric (for e.g. Hyper-V site). + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param input: Fabric creation input. Is one of the following types: FabricCreationInput, JSON, + IO[bytes] Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.FabricCreationInput or JSON or + IO[bytes] + :return: An instance of LROPoller that returns Fabric. The Fabric is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Fabric] + :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.Fabric] = 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, + resource_name=resource_name, + fabric_name=fabric_name, + input=input, + 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.Fabric, 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.Fabric].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.Fabric]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _purge_initial( + self, resource_group_name: str, resource_name: str, fabric_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_replication_fabrics_purge_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_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 [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) + raise HttpResponseError(response=response, 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")) + + 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_purge( + self, resource_group_name: str, resource_name: str, fabric_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Purges the site. + + The operation to purge(force delete) an Azure Site Recovery fabric. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_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._purge_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_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(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> ItemPaged["_models.Fabric"]: + """Gets the list of ASR fabrics. + + Gets a list of the Azure Site Recovery fabrics in the vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :return: An iterator like instance of Fabric + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.Fabric] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Fabric]] = 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_replication_fabrics_list_request( + resource_group_name=resource_group_name, + resource_name=resource_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), 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.Fabric], + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + def _check_consistency_initial( + self, resource_group_name: str, resource_name: str, fabric_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_replication_fabrics_check_consistency_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_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) + raise HttpResponseError(response=response, 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")) + + 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_check_consistency( + self, resource_group_name: str, resource_name: str, fabric_name: str, **kwargs: Any + ) -> LROPoller[_models.Fabric]: + """Checks the consistency of the ASR fabric. + + The operation to perform a consistency check on the fabric. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :return: An instance of LROPoller that returns Fabric. The Fabric is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Fabric] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Fabric] = 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._check_consistency_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.Fabric, 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.Fabric].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.Fabric]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _migrate_to_aad_initial( + self, resource_group_name: str, resource_name: str, fabric_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_replication_fabrics_migrate_to_aad_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_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 [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) + raise HttpResponseError(response=response, 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")) + + 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_migrate_to_aad( + self, resource_group_name: str, resource_name: str, fabric_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Migrates the site to AAD. + + The operation to migrate an Azure Site Recovery fabric to AAD. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_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._migrate_to_aad_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_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 + + def _reassociate_gateway_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + failover_process_server_request: Union[_models.FailoverProcessServerRequest, JSON, 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(failover_process_server_request, (IOBase, bytes)): + _content = failover_process_server_request + else: + _content = json.dumps(failover_process_server_request, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_fabrics_reassociate_gateway_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_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) + raise HttpResponseError(response=response, 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")) + + 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_reassociate_gateway( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + failover_process_server_request: _models.FailoverProcessServerRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Fabric]: + """Perform failover of the process server. + + The operation to move replications from a process server to another process server. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param failover_process_server_request: The input to the failover process server operation. + Required. + :type failover_process_server_request: + ~azure.mgmt.recoveryservicessiterecovery.models.FailoverProcessServerRequest + :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 Fabric. The Fabric is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Fabric] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reassociate_gateway( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + failover_process_server_request: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Fabric]: + """Perform failover of the process server. + + The operation to move replications from a process server to another process server. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param failover_process_server_request: The input to the failover process server operation. + Required. + :type failover_process_server_request: JSON + :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 Fabric. The Fabric is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Fabric] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reassociate_gateway( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + failover_process_server_request: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Fabric]: + """Perform failover of the process server. + + The operation to move replications from a process server to another process server. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param failover_process_server_request: The input to the failover process server operation. + Required. + :type failover_process_server_request: 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 Fabric. The Fabric is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Fabric] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_reassociate_gateway( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + failover_process_server_request: Union[_models.FailoverProcessServerRequest, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.Fabric]: + """Perform failover of the process server. + + The operation to move replications from a process server to another process server. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param failover_process_server_request: The input to the failover process server operation. Is + one of the following types: FailoverProcessServerRequest, JSON, IO[bytes] Required. + :type failover_process_server_request: + ~azure.mgmt.recoveryservicessiterecovery.models.FailoverProcessServerRequest or JSON or + IO[bytes] + :return: An instance of LROPoller that returns Fabric. The Fabric is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Fabric] + :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.Fabric] = 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._reassociate_gateway_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + failover_process_server_request=failover_process_server_request, + 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.Fabric, 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.Fabric].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.Fabric]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, resource_group_name: str, resource_name: str, fabric_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_replication_fabrics_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_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 [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) + raise HttpResponseError(response=response, 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")) + + 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, resource_name: str, fabric_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes the site. + + The operation to delete or remove an Azure Site Recovery fabric. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_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, + resource_name=resource_name, + fabric_name=fabric_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 + + def _renew_certificate_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + renew_certificate: Union[_models.RenewCertificateInput, JSON, 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(renew_certificate, (IOBase, bytes)): + _content = renew_certificate + else: + _content = json.dumps(renew_certificate, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_fabrics_renew_certificate_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_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) + raise HttpResponseError(response=response, 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")) + + 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_renew_certificate( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + renew_certificate: _models.RenewCertificateInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Fabric]: + """Renews certificate for the fabric. + + Renews the connection certificate for the ASR replication fabric. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param renew_certificate: Renew certificate input. Required. + :type renew_certificate: ~azure.mgmt.recoveryservicessiterecovery.models.RenewCertificateInput + :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 Fabric. The Fabric is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Fabric] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_renew_certificate( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + renew_certificate: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Fabric]: + """Renews certificate for the fabric. + + Renews the connection certificate for the ASR replication fabric. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param renew_certificate: Renew certificate input. Required. + :type renew_certificate: JSON + :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 Fabric. The Fabric is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Fabric] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_renew_certificate( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + renew_certificate: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Fabric]: + """Renews certificate for the fabric. + + Renews the connection certificate for the ASR replication fabric. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param renew_certificate: Renew certificate input. Required. + :type renew_certificate: 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 Fabric. The Fabric is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Fabric] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_renew_certificate( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + renew_certificate: Union[_models.RenewCertificateInput, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.Fabric]: + """Renews certificate for the fabric. + + Renews the connection certificate for the ASR replication fabric. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param renew_certificate: Renew certificate input. Is one of the following types: + RenewCertificateInput, JSON, IO[bytes] Required. + :type renew_certificate: ~azure.mgmt.recoveryservicessiterecovery.models.RenewCertificateInput + or JSON or IO[bytes] + :return: An instance of LROPoller that returns Fabric. The Fabric is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Fabric] + :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.Fabric] = 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._renew_certificate_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + renew_certificate=renew_certificate, + 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.Fabric, 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.Fabric].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.Fabric]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _remove_infra_initial( + self, resource_group_name: str, resource_name: str, fabric_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_replication_fabrics_remove_infra_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_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 [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 = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + 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_remove_infra( + self, resource_group_name: str, resource_name: str, fabric_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Removes the appliance's infrastructure under the fabric. + + Removes the appliance's infrastructure under the fabric. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_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._remove_infra_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_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 + + +class ReplicationLogicalNetworksOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.SiteRecoveryManagementClient`'s + :attr:`replication_logical_networks` 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: SiteRecoveryManagementClientConfiguration = ( + 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, resource_name: str, fabric_name: str, logical_network_name: str, **kwargs: Any + ) -> _models.LogicalNetwork: + """Gets a logical network with specified server id and logical network name. + + Gets the details of a logical network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param logical_network_name: Logical network name. Required. + :type logical_network_name: str + :return: LogicalNetwork. The LogicalNetwork is compatible with MutableMapping + :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.LogicalNetwork + :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.LogicalNetwork] = kwargs.pop("cls", None) + + _request = build_replication_logical_networks_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + logical_network_name=logical_network_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.LogicalNetwork, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_replication_fabrics( + self, resource_group_name: str, resource_name: str, fabric_name: str, **kwargs: Any + ) -> ItemPaged["_models.LogicalNetwork"]: + """Gets the list of logical networks under a fabric. + + Lists all the logical networks of the Azure Site Recovery fabric. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :return: An iterator like instance of LogicalNetwork + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.LogicalNetwork] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.LogicalNetwork]] = 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_replication_logical_networks_list_by_replication_fabrics_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_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), 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.LogicalNetwork], + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class ReplicationNetworksOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.SiteRecoveryManagementClient`'s + :attr:`replication_networks` 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: SiteRecoveryManagementClientConfiguration = ( + 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, resource_name: str, fabric_name: str, network_name: str, **kwargs: Any + ) -> _models.Network: + """Gets a network with specified server id and network name. + + Gets the details of a network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param network_name: Primary network name. Required. + :type network_name: str + :return: Network. The Network is compatible with MutableMapping + :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.Network + :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.Network] = kwargs.pop("cls", None) + + _request = build_replication_networks_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + network_name=network_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Network, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_replication_fabrics( + self, resource_group_name: str, resource_name: str, fabric_name: str, **kwargs: Any + ) -> ItemPaged["_models.Network"]: + """Gets the list of networks under a fabric. + + Lists the networks available for a fabric. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :return: An iterator like instance of Network + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.Network] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Network]] = 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_replication_networks_list_by_replication_fabrics_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_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), 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.Network], + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> ItemPaged["_models.Network"]: + """Gets the list of networks. View-only API. + + Lists the networks available in a vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :return: An iterator like instance of Network + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.Network] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Network]] = 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_replication_networks_list_request( + resource_group_name=resource_group_name, + resource_name=resource_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), 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.Network], + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class ReplicationNetworkMappingsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.SiteRecoveryManagementClient`'s + :attr:`replication_network_mappings` 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: SiteRecoveryManagementClientConfiguration = ( + 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, + resource_name: str, + fabric_name: str, + network_name: str, + network_mapping_name: str, + **kwargs: Any + ) -> _models.NetworkMapping: + """Gets network mapping by name. + + Gets the details of an ASR network mapping. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param network_name: Primary network name. Required. + :type network_name: str + :param network_mapping_name: Network mapping name. Required. + :type network_mapping_name: str + :return: NetworkMapping. The NetworkMapping is compatible with MutableMapping + :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.NetworkMapping + :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.NetworkMapping] = kwargs.pop("cls", None) + + _request = build_replication_network_mappings_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + network_name=network_name, + network_mapping_name=network_mapping_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.NetworkMapping, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + network_name: str, + network_mapping_name: str, + input: Union[_models.CreateNetworkMappingInput, JSON, 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(input, (IOBase, bytes)): + _content = input + else: + _content = json.dumps(input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_network_mappings_create_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + network_name=network_name, + network_mapping_name=network_mapping_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) + raise HttpResponseError(response=response, 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")) + + 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, + resource_name: str, + fabric_name: str, + network_name: str, + network_mapping_name: str, + input: _models.CreateNetworkMappingInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NetworkMapping]: + """Creates network mapping. + + The operation to create an ASR network mapping. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param network_name: Primary network name. Required. + :type network_name: str + :param network_mapping_name: Network mapping name. Required. + :type network_mapping_name: str + :param input: Create network mapping input. Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.CreateNetworkMappingInput + :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 NetworkMapping. The NetworkMapping is compatible + with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.NetworkMapping] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + network_name: str, + network_mapping_name: str, + input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NetworkMapping]: + """Creates network mapping. + + The operation to create an ASR network mapping. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param network_name: Primary network name. Required. + :type network_name: str + :param network_mapping_name: Network mapping name. Required. + :type network_mapping_name: str + :param input: Create network mapping input. Required. + :type input: JSON + :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 NetworkMapping. The NetworkMapping is compatible + with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.NetworkMapping] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + network_name: str, + network_mapping_name: str, + input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NetworkMapping]: + """Creates network mapping. + + The operation to create an ASR network mapping. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param network_name: Primary network name. Required. + :type network_name: str + :param network_mapping_name: Network mapping name. Required. + :type network_mapping_name: str + :param input: Create network mapping input. Required. + :type input: 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 NetworkMapping. The NetworkMapping is compatible + with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.NetworkMapping] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + network_name: str, + network_mapping_name: str, + input: Union[_models.CreateNetworkMappingInput, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.NetworkMapping]: + """Creates network mapping. + + The operation to create an ASR network mapping. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param network_name: Primary network name. Required. + :type network_name: str + :param network_mapping_name: Network mapping name. Required. + :type network_mapping_name: str + :param input: Create network mapping input. Is one of the following types: + CreateNetworkMappingInput, JSON, IO[bytes] Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.CreateNetworkMappingInput or JSON + or IO[bytes] + :return: An instance of LROPoller that returns NetworkMapping. The NetworkMapping is compatible + with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.NetworkMapping] + :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.NetworkMapping] = 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, + resource_name=resource_name, + fabric_name=fabric_name, + network_name=network_name, + network_mapping_name=network_mapping_name, + input=input, + 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.NetworkMapping, 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.NetworkMapping].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.NetworkMapping]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + network_name: str, + network_mapping_name: str, + input: Union[_models.UpdateNetworkMappingInput, JSON, 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(input, (IOBase, bytes)): + _content = input + else: + _content = json.dumps(input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_network_mappings_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + network_name=network_name, + network_mapping_name=network_mapping_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) + raise HttpResponseError(response=response, 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")) + + 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, + resource_name: str, + fabric_name: str, + network_name: str, + network_mapping_name: str, + input: _models.UpdateNetworkMappingInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NetworkMapping]: + """Updates network mapping. + + The operation to update an ASR network mapping. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param network_name: Primary network name. Required. + :type network_name: str + :param network_mapping_name: Network mapping name. Required. + :type network_mapping_name: str + :param input: Update network mapping input. Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.UpdateNetworkMappingInput + :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 NetworkMapping. The NetworkMapping is compatible + with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.NetworkMapping] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + network_name: str, + network_mapping_name: str, + input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NetworkMapping]: + """Updates network mapping. + + The operation to update an ASR network mapping. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param network_name: Primary network name. Required. + :type network_name: str + :param network_mapping_name: Network mapping name. Required. + :type network_mapping_name: str + :param input: Update network mapping input. Required. + :type input: JSON + :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 NetworkMapping. The NetworkMapping is compatible + with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.NetworkMapping] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + network_name: str, + network_mapping_name: str, + input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NetworkMapping]: + """Updates network mapping. + + The operation to update an ASR network mapping. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param network_name: Primary network name. Required. + :type network_name: str + :param network_mapping_name: Network mapping name. Required. + :type network_mapping_name: str + :param input: Update network mapping input. Required. + :type input: 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 NetworkMapping. The NetworkMapping is compatible + with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.NetworkMapping] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + network_name: str, + network_mapping_name: str, + input: Union[_models.UpdateNetworkMappingInput, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.NetworkMapping]: + """Updates network mapping. + + The operation to update an ASR network mapping. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param network_name: Primary network name. Required. + :type network_name: str + :param network_mapping_name: Network mapping name. Required. + :type network_mapping_name: str + :param input: Update network mapping input. Is one of the following types: + UpdateNetworkMappingInput, JSON, IO[bytes] Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.UpdateNetworkMappingInput or JSON + or IO[bytes] + :return: An instance of LROPoller that returns NetworkMapping. The NetworkMapping is compatible + with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.NetworkMapping] + :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.NetworkMapping] = 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, + resource_name=resource_name, + fabric_name=fabric_name, + network_name=network_name, + network_mapping_name=network_mapping_name, + input=input, + 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.NetworkMapping, 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.NetworkMapping].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.NetworkMapping]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + network_name: str, + network_mapping_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_replication_network_mappings_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + network_name=network_name, + network_mapping_name=network_mapping_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 [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) + raise HttpResponseError(response=response, 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")) + + 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, + resource_name: str, + fabric_name: str, + network_name: str, + network_mapping_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Delete network mapping. + + The operation to delete a network mapping. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param network_name: Primary network name. Required. + :type network_name: str + :param network_mapping_name: Network mapping name. Required. + :type network_mapping_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, + resource_name=resource_name, + fabric_name=fabric_name, + network_name=network_name, + network_mapping_name=network_mapping_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_replication_networks( + self, resource_group_name: str, resource_name: str, fabric_name: str, network_name: str, **kwargs: Any + ) -> ItemPaged["_models.NetworkMapping"]: + """Gets all the network mappings under a network. + + Lists all ASR network mappings for the specified network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param network_name: Primary network name. Required. + :type network_name: str + :return: An iterator like instance of NetworkMapping + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.NetworkMapping] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.NetworkMapping]] = 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_replication_network_mappings_list_by_replication_networks_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + network_name=network_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), 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.NetworkMapping], + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> ItemPaged["_models.NetworkMapping"]: + """Gets all the network mappings under a vault. + + Lists all ASR network mappings in the vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :return: An iterator like instance of NetworkMapping + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.NetworkMapping] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.NetworkMapping]] = 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_replication_network_mappings_list_request( + resource_group_name=resource_group_name, + resource_name=resource_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), 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.NetworkMapping], + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class ReplicationProtectionContainersOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.SiteRecoveryManagementClient`'s + :attr:`replication_protection_containers` 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: SiteRecoveryManagementClientConfiguration = ( + 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, + resource_name: str, + fabric_name: str, + protection_container_name: str, + **kwargs: Any + ) -> _models.ProtectionContainer: + """Gets the protection container details. + + Gets the details of a protection container. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :return: ProtectionContainer. The ProtectionContainer is compatible with MutableMapping + :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer + :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.ProtectionContainer] = kwargs.pop("cls", None) + + _request = build_replication_protection_containers_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ProtectionContainer, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + creation_input: Union[_models.CreateProtectionContainerInput, JSON, 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(creation_input, (IOBase, bytes)): + _content = creation_input + else: + _content = json.dumps(creation_input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_protection_containers_create_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_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) + raise HttpResponseError(response=response, 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")) + + 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, + resource_name: str, + fabric_name: str, + protection_container_name: str, + creation_input: _models.CreateProtectionContainerInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ProtectionContainer]: + """Create a protection container. + + Operation to create a protection container. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param creation_input: Creation input. Required. + :type creation_input: + ~azure.mgmt.recoveryservicessiterecovery.models.CreateProtectionContainerInput + :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 ProtectionContainer. The ProtectionContainer is + compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + creation_input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ProtectionContainer]: + """Create a protection container. + + Operation to create a protection container. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param creation_input: Creation input. Required. + :type creation_input: JSON + :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 ProtectionContainer. The ProtectionContainer is + compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + creation_input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ProtectionContainer]: + """Create a protection container. + + Operation to create a protection container. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param creation_input: Creation input. Required. + :type creation_input: 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 ProtectionContainer. The ProtectionContainer is + compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + creation_input: Union[_models.CreateProtectionContainerInput, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.ProtectionContainer]: + """Create a protection container. + + Operation to create a protection container. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param creation_input: Creation input. Is one of the following types: + CreateProtectionContainerInput, JSON, IO[bytes] Required. + :type creation_input: + ~azure.mgmt.recoveryservicessiterecovery.models.CreateProtectionContainerInput or JSON or + IO[bytes] + :return: An instance of LROPoller that returns ProtectionContainer. The ProtectionContainer is + compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] + :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.ProtectionContainer] = 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, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + creation_input=creation_input, + 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.ProtectionContainer, 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.ProtectionContainer].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ProtectionContainer]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def list_by_replication_fabrics( + self, resource_group_name: str, resource_name: str, fabric_name: str, **kwargs: Any + ) -> ItemPaged["_models.ProtectionContainer"]: + """Gets the list of protection container for a fabric. + + Lists the protection containers in the specified fabric. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :return: An iterator like instance of ProtectionContainer + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ProtectionContainer]] = 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_replication_protection_containers_list_by_replication_fabrics_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_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), 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.ProtectionContainer], + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + def _discover_protectable_item_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + discover_protectable_item_request: Union[_models.DiscoverProtectableItemRequest, JSON, 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(discover_protectable_item_request, (IOBase, bytes)): + _content = discover_protectable_item_request + else: + _content = json.dumps(discover_protectable_item_request, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_protection_containers_discover_protectable_item_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_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) + raise HttpResponseError(response=response, 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")) + + 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_discover_protectable_item( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + discover_protectable_item_request: _models.DiscoverProtectableItemRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ProtectionContainer]: + """Adds a protectable item to the replication protection container. + + The operation to a add a protectable item to a protection container(Add physical server). + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param discover_protectable_item_request: The request object to add a protectable item. + Required. + :type discover_protectable_item_request: + ~azure.mgmt.recoveryservicessiterecovery.models.DiscoverProtectableItemRequest + :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 ProtectionContainer. The ProtectionContainer is + compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_discover_protectable_item( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + discover_protectable_item_request: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ProtectionContainer]: + """Adds a protectable item to the replication protection container. + + The operation to a add a protectable item to a protection container(Add physical server). + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param discover_protectable_item_request: The request object to add a protectable item. + Required. + :type discover_protectable_item_request: JSON + :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 ProtectionContainer. The ProtectionContainer is + compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_discover_protectable_item( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + discover_protectable_item_request: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ProtectionContainer]: + """Adds a protectable item to the replication protection container. + + The operation to a add a protectable item to a protection container(Add physical server). + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param discover_protectable_item_request: The request object to add a protectable item. + Required. + :type discover_protectable_item_request: 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 ProtectionContainer. The ProtectionContainer is + compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_discover_protectable_item( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + discover_protectable_item_request: Union[_models.DiscoverProtectableItemRequest, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.ProtectionContainer]: + """Adds a protectable item to the replication protection container. + + The operation to a add a protectable item to a protection container(Add physical server). + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param discover_protectable_item_request: The request object to add a protectable item. Is one + of the following types: DiscoverProtectableItemRequest, JSON, IO[bytes] Required. + :type discover_protectable_item_request: + ~azure.mgmt.recoveryservicessiterecovery.models.DiscoverProtectableItemRequest or JSON or + IO[bytes] + :return: An instance of LROPoller that returns ProtectionContainer. The ProtectionContainer is + compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] + :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.ProtectionContainer] = 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._discover_protectable_item_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + discover_protectable_item_request=discover_protectable_item_request, + 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.ProtectionContainer, 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.ProtectionContainer].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ProtectionContainer]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_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_replication_protection_containers_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_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 [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) + raise HttpResponseError(response=response, 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")) + + 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, + resource_name: str, + fabric_name: str, + protection_container_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Removes a protection container. + + Operation to remove a protection container. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_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, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_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 + + def _switch_cluster_protection_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + switch_input: Union[_models.SwitchClusterProtectionInput, JSON, 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(switch_input, (IOBase, bytes)): + _content = switch_input + else: + _content = json.dumps(switch_input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_protection_containers_switch_cluster_protection_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_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.ErrorResponse, + 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["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + 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_switch_cluster_protection( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + switch_input: _models.SwitchClusterProtectionInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ProtectionContainer]: + """Switches protection from one container to another. + + Operation to switch protection from one container to another. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param switch_input: Switch protection input. Required. + :type switch_input: + ~azure.mgmt.recoveryservicessiterecovery.models.SwitchClusterProtectionInput + :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 ProtectionContainer. The ProtectionContainer is + compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_switch_cluster_protection( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + switch_input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ProtectionContainer]: + """Switches protection from one container to another. + + Operation to switch protection from one container to another. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param switch_input: Switch protection input. Required. + :type switch_input: JSON + :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 ProtectionContainer. The ProtectionContainer is + compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_switch_cluster_protection( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + switch_input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ProtectionContainer]: + """Switches protection from one container to another. + + Operation to switch protection from one container to another. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param switch_input: Switch protection input. Required. + :type switch_input: 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 ProtectionContainer. The ProtectionContainer is + compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_switch_cluster_protection( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + switch_input: Union[_models.SwitchClusterProtectionInput, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.ProtectionContainer]: + """Switches protection from one container to another. + + Operation to switch protection from one container to another. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param switch_input: Switch protection input. Is one of the following types: + SwitchClusterProtectionInput, JSON, IO[bytes] Required. + :type switch_input: + ~azure.mgmt.recoveryservicessiterecovery.models.SwitchClusterProtectionInput or JSON or + IO[bytes] + :return: An instance of LROPoller that returns ProtectionContainer. The ProtectionContainer is + compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] + :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.ProtectionContainer] = 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._switch_cluster_protection_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + switch_input=switch_input, + 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["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.ProtectionContainer, 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.ProtectionContainer].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ProtectionContainer]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _switch_protection_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + switch_input: Union[_models.SwitchProtectionInput, JSON, 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(switch_input, (IOBase, bytes)): + _content = switch_input + else: + _content = json.dumps(switch_input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_protection_containers_switch_protection_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + 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_switch_protection( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + switch_input: _models.SwitchProtectionInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ProtectionContainer]: + """Switches protection from one container to another or one replication provider to another. + + Operation to switch protection from one container to another or one replication provider to + another. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param switch_input: Switch protection input. Required. + :type switch_input: ~azure.mgmt.recoveryservicessiterecovery.models.SwitchProtectionInput + :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 ProtectionContainer. The ProtectionContainer is + compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_switch_protection( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + switch_input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ProtectionContainer]: + """Switches protection from one container to another or one replication provider to another. + + Operation to switch protection from one container to another or one replication provider to + another. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param switch_input: Switch protection input. Required. + :type switch_input: JSON + :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 ProtectionContainer. The ProtectionContainer is + compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_switch_protection( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + switch_input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ProtectionContainer]: + """Switches protection from one container to another or one replication provider to another. + + Operation to switch protection from one container to another or one replication provider to + another. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param switch_input: Switch protection input. Required. + :type switch_input: 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 ProtectionContainer. The ProtectionContainer is + compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_switch_protection( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + switch_input: Union[_models.SwitchProtectionInput, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.ProtectionContainer]: + """Switches protection from one container to another or one replication provider to another. + + Operation to switch protection from one container to another or one replication provider to + another. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param switch_input: Switch protection input. Is one of the following types: + SwitchProtectionInput, JSON, IO[bytes] Required. + :type switch_input: ~azure.mgmt.recoveryservicessiterecovery.models.SwitchProtectionInput or + JSON or IO[bytes] + :return: An instance of LROPoller that returns ProtectionContainer. The ProtectionContainer is + compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] + :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.ProtectionContainer] = 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._switch_protection_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + switch_input=switch_input, + 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.ProtectionContainer, 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.ProtectionContainer].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ProtectionContainer]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def list( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> ItemPaged["_models.ProtectionContainer"]: + """Gets the list of all protection containers in a vault. + + Lists the protection containers in a vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :return: An iterator like instance of ProtectionContainer + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ProtectionContainer]] = 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_replication_protection_containers_list_request( + resource_group_name=resource_group_name, + resource_name=resource_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), 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.ProtectionContainer], + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class ReplicationMigrationItemsOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.SiteRecoveryManagementClient`'s + :attr:`replication_migration_items` 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: SiteRecoveryManagementClientConfiguration = ( + 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, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + **kwargs: Any + ) -> _models.MigrationItem: + """Gets the details of a migration item. + + Gets the details of a migration item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :return: MigrationItem. The MigrationItem is compatible with MutableMapping + :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem + :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.MigrationItem] = kwargs.pop("cls", None) + + _request = build_replication_migration_items_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + migration_item_name=migration_item_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.MigrationItem, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + input: Union[_models.EnableMigrationInput, JSON, 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(input, (IOBase, bytes)): + _content = input + else: + _content = json.dumps(input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_migration_items_create_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + migration_item_name=migration_item_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) + raise HttpResponseError(response=response, 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")) + + 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, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + input: _models.EnableMigrationInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MigrationItem]: + """Enables migration. + + The operation to create an ASR migration item (enable migration). + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param input: Enable migration input. Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.EnableMigrationInput + :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 MigrationItem. The MigrationItem is compatible + with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MigrationItem]: + """Enables migration. + + The operation to create an ASR migration item (enable migration). + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param input: Enable migration input. Required. + :type input: JSON + :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 MigrationItem. The MigrationItem is compatible + with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MigrationItem]: + """Enables migration. + + The operation to create an ASR migration item (enable migration). + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param input: Enable migration input. Required. + :type input: 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 MigrationItem. The MigrationItem is compatible + with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + input: Union[_models.EnableMigrationInput, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.MigrationItem]: + """Enables migration. + + The operation to create an ASR migration item (enable migration). + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param input: Enable migration input. Is one of the following types: EnableMigrationInput, + JSON, IO[bytes] Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.EnableMigrationInput or JSON or + IO[bytes] + :return: An instance of LROPoller that returns MigrationItem. The MigrationItem is compatible + with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :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.MigrationItem] = 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, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + migration_item_name=migration_item_name, + input=input, + 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.MigrationItem, 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.MigrationItem].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.MigrationItem]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + input: Union[_models.UpdateMigrationItemInput, JSON, 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(input, (IOBase, bytes)): + _content = input + else: + _content = json.dumps(input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_migration_items_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + migration_item_name=migration_item_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) + raise HttpResponseError(response=response, 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")) + + 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, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + input: _models.UpdateMigrationItemInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MigrationItem]: + """Updates migration item. + + The operation to update the recovery settings of an ASR migration item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param input: Update migration item input. Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.UpdateMigrationItemInput + :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 MigrationItem. The MigrationItem is compatible + with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MigrationItem]: + """Updates migration item. + + The operation to update the recovery settings of an ASR migration item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param input: Update migration item input. Required. + :type input: JSON + :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 MigrationItem. The MigrationItem is compatible + with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MigrationItem]: + """Updates migration item. + + The operation to update the recovery settings of an ASR migration item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param input: Update migration item input. Required. + :type input: 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 MigrationItem. The MigrationItem is compatible + with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + input: Union[_models.UpdateMigrationItemInput, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.MigrationItem]: + """Updates migration item. + + The operation to update the recovery settings of an ASR migration item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param input: Update migration item input. Is one of the following types: + UpdateMigrationItemInput, JSON, IO[bytes] Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.UpdateMigrationItemInput or JSON + or IO[bytes] + :return: An instance of LROPoller that returns MigrationItem. The MigrationItem is compatible + with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :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.MigrationItem] = 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, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + migration_item_name=migration_item_name, + input=input, + 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.MigrationItem, 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.MigrationItem].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.MigrationItem]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + *, + delete_option: Optional[str] = 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 = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_replication_migration_items_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + migration_item_name=migration_item_name, + subscription_id=self._config.subscription_id, + delete_option=delete_option, + 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 [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) + raise HttpResponseError(response=response, 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")) + + 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, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + *, + delete_option: Optional[str] = None, + **kwargs: Any + ) -> LROPoller[None]: + """Delete the migration item. + + The operation to delete an ASR migration item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :keyword delete_option: The delete option. Default value is None. + :paramtype delete_option: 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, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + migration_item_name=migration_item_name, + delete_option=delete_option, + 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_replication_protection_containers( # pylint: disable=name-too-long + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + *, + skip_token: Optional[str] = None, + take_token: Optional[str] = None, + filter: Optional[str] = None, + **kwargs: Any + ) -> ItemPaged["_models.MigrationItem"]: + """Gets the list of migration items in the protection container. + + Gets the list of ASR migration items in the protection container. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :keyword skip_token: The pagination token. Default value is None. + :paramtype skip_token: str + :keyword take_token: The page size. Default value is None. + :paramtype take_token: str + :keyword filter: OData filter options. Default value is None. + :paramtype filter: str + :return: An iterator like instance of MigrationItem + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.MigrationItem]] = 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_replication_migration_items_list_by_replication_protection_containers_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + subscription_id=self._config.subscription_id, + skip_token=skip_token, + take_token=take_token, + filter=filter, + 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), 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.MigrationItem], + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + def _migrate_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + migrate_input: Union[_models.MigrateInput, JSON, 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(migrate_input, (IOBase, bytes)): + _content = migrate_input + else: + _content = json.dumps(migrate_input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_migration_items_migrate_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + migration_item_name=migration_item_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) + raise HttpResponseError(response=response, 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")) + + 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_migrate( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + migrate_input: _models.MigrateInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MigrationItem]: + """Migrate item. + + The operation to initiate migration of the item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param migrate_input: Migrate input. Required. + :type migrate_input: ~azure.mgmt.recoveryservicessiterecovery.models.MigrateInput + :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 MigrationItem. The MigrationItem is compatible + with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_migrate( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + migrate_input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MigrationItem]: + """Migrate item. + + The operation to initiate migration of the item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param migrate_input: Migrate input. Required. + :type migrate_input: JSON + :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 MigrationItem. The MigrationItem is compatible + with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_migrate( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + migrate_input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MigrationItem]: + """Migrate item. + + The operation to initiate migration of the item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param migrate_input: Migrate input. Required. + :type migrate_input: 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 MigrationItem. The MigrationItem is compatible + with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_migrate( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + migrate_input: Union[_models.MigrateInput, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.MigrationItem]: + """Migrate item. + + The operation to initiate migration of the item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param migrate_input: Migrate input. Is one of the following types: MigrateInput, JSON, + IO[bytes] Required. + :type migrate_input: ~azure.mgmt.recoveryservicessiterecovery.models.MigrateInput or JSON or + IO[bytes] + :return: An instance of LROPoller that returns MigrationItem. The MigrationItem is compatible + with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :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.MigrationItem] = 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._migrate_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + migration_item_name=migration_item_name, + migrate_input=migrate_input, + 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.MigrationItem, 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.MigrationItem].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.MigrationItem]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _pause_replication_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + pause_replication_input: Union[_models.PauseReplicationInput, JSON, 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(pause_replication_input, (IOBase, bytes)): + _content = pause_replication_input + else: + _content = json.dumps(pause_replication_input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_migration_items_pause_replication_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + migration_item_name=migration_item_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) + raise HttpResponseError(response=response, 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")) + + 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_pause_replication( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + pause_replication_input: _models.PauseReplicationInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MigrationItem]: + """Pause replication. + + The operation to initiate pause replication of the item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param pause_replication_input: Pause replication input. Required. + :type pause_replication_input: + ~azure.mgmt.recoveryservicessiterecovery.models.PauseReplicationInput + :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 MigrationItem. The MigrationItem is compatible + with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_pause_replication( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + pause_replication_input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MigrationItem]: + """Pause replication. + + The operation to initiate pause replication of the item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param pause_replication_input: Pause replication input. Required. + :type pause_replication_input: JSON + :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 MigrationItem. The MigrationItem is compatible + with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_pause_replication( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + pause_replication_input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MigrationItem]: + """Pause replication. + + The operation to initiate pause replication of the item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param pause_replication_input: Pause replication input. Required. + :type pause_replication_input: 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 MigrationItem. The MigrationItem is compatible + with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_pause_replication( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + pause_replication_input: Union[_models.PauseReplicationInput, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.MigrationItem]: + """Pause replication. + + The operation to initiate pause replication of the item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param pause_replication_input: Pause replication input. Is one of the following types: + PauseReplicationInput, JSON, IO[bytes] Required. + :type pause_replication_input: + ~azure.mgmt.recoveryservicessiterecovery.models.PauseReplicationInput or JSON or IO[bytes] + :return: An instance of LROPoller that returns MigrationItem. The MigrationItem is compatible + with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :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.MigrationItem] = 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._pause_replication_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + migration_item_name=migration_item_name, + pause_replication_input=pause_replication_input, + 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.MigrationItem, 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.MigrationItem].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.MigrationItem]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _resume_replication_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + resume_replication_input: Union[_models.ResumeReplicationInput, JSON, 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(resume_replication_input, (IOBase, bytes)): + _content = resume_replication_input + else: + _content = json.dumps(resume_replication_input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_migration_items_resume_replication_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + migration_item_name=migration_item_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) + raise HttpResponseError(response=response, 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")) + + 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_resume_replication( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + resume_replication_input: _models.ResumeReplicationInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MigrationItem]: + """Resume replication. + + The operation to initiate resume replication of the item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param resume_replication_input: Resume replication input. Required. + :type resume_replication_input: + ~azure.mgmt.recoveryservicessiterecovery.models.ResumeReplicationInput + :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 MigrationItem. The MigrationItem is compatible + with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_resume_replication( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + resume_replication_input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MigrationItem]: + """Resume replication. + + The operation to initiate resume replication of the item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param resume_replication_input: Resume replication input. Required. + :type resume_replication_input: JSON + :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 MigrationItem. The MigrationItem is compatible + with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_resume_replication( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + resume_replication_input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MigrationItem]: + """Resume replication. + + The operation to initiate resume replication of the item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param resume_replication_input: Resume replication input. Required. + :type resume_replication_input: 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 MigrationItem. The MigrationItem is compatible + with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_resume_replication( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + resume_replication_input: Union[_models.ResumeReplicationInput, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.MigrationItem]: + """Resume replication. + + The operation to initiate resume replication of the item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param resume_replication_input: Resume replication input. Is one of the following types: + ResumeReplicationInput, JSON, IO[bytes] Required. + :type resume_replication_input: + ~azure.mgmt.recoveryservicessiterecovery.models.ResumeReplicationInput or JSON or IO[bytes] + :return: An instance of LROPoller that returns MigrationItem. The MigrationItem is compatible + with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :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.MigrationItem] = 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._resume_replication_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + migration_item_name=migration_item_name, + resume_replication_input=resume_replication_input, + 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.MigrationItem, 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.MigrationItem].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.MigrationItem]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _resync_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + input: Union[_models.ResyncInput, JSON, 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(input, (IOBase, bytes)): + _content = input + else: + _content = json.dumps(input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_migration_items_resync_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + migration_item_name=migration_item_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) + raise HttpResponseError(response=response, 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")) + + 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_resync( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + input: _models.ResyncInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MigrationItem]: + """Resynchronizes replication. + + The operation to resynchronize replication of an ASR migration item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param input: Resync input. Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.ResyncInput + :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 MigrationItem. The MigrationItem is compatible + with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_resync( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MigrationItem]: + """Resynchronizes replication. + + The operation to resynchronize replication of an ASR migration item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param input: Resync input. Required. + :type input: JSON + :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 MigrationItem. The MigrationItem is compatible + with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_resync( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MigrationItem]: + """Resynchronizes replication. + + The operation to resynchronize replication of an ASR migration item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param input: Resync input. Required. + :type input: 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 MigrationItem. The MigrationItem is compatible + with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_resync( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + input: Union[_models.ResyncInput, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.MigrationItem]: + """Resynchronizes replication. + + The operation to resynchronize replication of an ASR migration item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param input: Resync input. Is one of the following types: ResyncInput, JSON, IO[bytes] + Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.ResyncInput or JSON or IO[bytes] + :return: An instance of LROPoller that returns MigrationItem. The MigrationItem is compatible + with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :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.MigrationItem] = 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._resync_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + migration_item_name=migration_item_name, + input=input, + 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.MigrationItem, 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.MigrationItem].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.MigrationItem]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _test_migrate_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + test_migrate_input: Union[_models.TestMigrateInput, JSON, 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(test_migrate_input, (IOBase, bytes)): + _content = test_migrate_input + else: + _content = json.dumps(test_migrate_input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_migration_items_test_migrate_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + migration_item_name=migration_item_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) + raise HttpResponseError(response=response, 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")) + + 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_test_migrate( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + test_migrate_input: _models.TestMigrateInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MigrationItem]: + """Test migrate item. + + The operation to initiate test migration of the item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param test_migrate_input: Test migrate input. Required. + :type test_migrate_input: ~azure.mgmt.recoveryservicessiterecovery.models.TestMigrateInput + :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 MigrationItem. The MigrationItem is compatible + with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_test_migrate( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + test_migrate_input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MigrationItem]: + """Test migrate item. + + The operation to initiate test migration of the item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param test_migrate_input: Test migrate input. Required. + :type test_migrate_input: JSON + :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 MigrationItem. The MigrationItem is compatible + with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_test_migrate( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + test_migrate_input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MigrationItem]: + """Test migrate item. + + The operation to initiate test migration of the item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param test_migrate_input: Test migrate input. Required. + :type test_migrate_input: 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 MigrationItem. The MigrationItem is compatible + with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_test_migrate( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + test_migrate_input: Union[_models.TestMigrateInput, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.MigrationItem]: + """Test migrate item. + + The operation to initiate test migration of the item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param test_migrate_input: Test migrate input. Is one of the following types: TestMigrateInput, + JSON, IO[bytes] Required. + :type test_migrate_input: ~azure.mgmt.recoveryservicessiterecovery.models.TestMigrateInput or + JSON or IO[bytes] + :return: An instance of LROPoller that returns MigrationItem. The MigrationItem is compatible + with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :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.MigrationItem] = 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._test_migrate_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + migration_item_name=migration_item_name, + test_migrate_input=test_migrate_input, + 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.MigrationItem, 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.MigrationItem].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.MigrationItem]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _test_migrate_cleanup_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + test_migrate_cleanup_input: Union[_models.TestMigrateCleanupInput, JSON, 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(test_migrate_cleanup_input, (IOBase, bytes)): + _content = test_migrate_cleanup_input + else: + _content = json.dumps(test_migrate_cleanup_input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_migration_items_test_migrate_cleanup_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + migration_item_name=migration_item_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) + raise HttpResponseError(response=response, 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")) + + 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_test_migrate_cleanup( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + test_migrate_cleanup_input: _models.TestMigrateCleanupInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MigrationItem]: + """Test migrate cleanup. + + The operation to initiate test migrate cleanup. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param test_migrate_cleanup_input: Test migrate cleanup input. Required. + :type test_migrate_cleanup_input: + ~azure.mgmt.recoveryservicessiterecovery.models.TestMigrateCleanupInput + :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 MigrationItem. The MigrationItem is compatible + with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_test_migrate_cleanup( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + test_migrate_cleanup_input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MigrationItem]: + """Test migrate cleanup. + + The operation to initiate test migrate cleanup. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param test_migrate_cleanup_input: Test migrate cleanup input. Required. + :type test_migrate_cleanup_input: JSON + :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 MigrationItem. The MigrationItem is compatible + with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_test_migrate_cleanup( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + test_migrate_cleanup_input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MigrationItem]: + """Test migrate cleanup. + + The operation to initiate test migrate cleanup. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param test_migrate_cleanup_input: Test migrate cleanup input. Required. + :type test_migrate_cleanup_input: 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 MigrationItem. The MigrationItem is compatible + with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_test_migrate_cleanup( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + migration_item_name: str, + test_migrate_cleanup_input: Union[_models.TestMigrateCleanupInput, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.MigrationItem]: + """Test migrate cleanup. + + The operation to initiate test migrate cleanup. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param migration_item_name: Migration item name. Required. + :type migration_item_name: str + :param test_migrate_cleanup_input: Test migrate cleanup input. Is one of the following types: + TestMigrateCleanupInput, JSON, IO[bytes] Required. + :type test_migrate_cleanup_input: + ~azure.mgmt.recoveryservicessiterecovery.models.TestMigrateCleanupInput or JSON or IO[bytes] + :return: An instance of LROPoller that returns MigrationItem. The MigrationItem is compatible + with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :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.MigrationItem] = 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._test_migrate_cleanup_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + migration_item_name=migration_item_name, + test_migrate_cleanup_input=test_migrate_cleanup_input, + 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.MigrationItem, 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.MigrationItem].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.MigrationItem]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def list( + self, + resource_group_name: str, + resource_name: str, + *, + skip_token: Optional[str] = None, + take_token: Optional[str] = None, + filter: Optional[str] = None, + **kwargs: Any + ) -> ItemPaged["_models.MigrationItem"]: + """Gets the list of migration items in the vault. + + Gets the list of migration items in the vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :keyword skip_token: The pagination token. Default value is None. + :paramtype skip_token: str + :keyword take_token: The page size. Default value is None. + :paramtype take_token: str + :keyword filter: OData filter options. Default value is None. + :paramtype filter: str + :return: An iterator like instance of MigrationItem + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.MigrationItem]] = 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_replication_migration_items_list_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + skip_token=skip_token, + take_token=take_token, + filter=filter, + 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), 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.MigrationItem], + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class ReplicationProtectableItemsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.SiteRecoveryManagementClient`'s + :attr:`replication_protectable_items` 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: SiteRecoveryManagementClientConfiguration = ( + 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, + resource_name: str, + fabric_name: str, + protection_container_name: str, + protectable_item_name: str, + **kwargs: Any + ) -> _models.ProtectableItem: + """Gets the details of a protectable item. + + The operation to get the details of a protectable item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param protectable_item_name: Protectable item name. Required. + :type protectable_item_name: str + :return: ProtectableItem. The ProtectableItem is compatible with MutableMapping + :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.ProtectableItem + :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.ProtectableItem] = kwargs.pop("cls", None) + + _request = build_replication_protectable_items_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + protectable_item_name=protectable_item_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ProtectableItem, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_replication_protection_containers( # pylint: disable=name-too-long + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + *, + filter: Optional[str] = None, + take: Optional[str] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> ItemPaged["_models.ProtectableItem"]: + """Gets the list of protectable items. + + Lists the protectable items in a protection container. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :keyword filter: OData filter options. Default value is None. + :paramtype filter: str + :keyword take: take OData query parameter. Default value is None. + :paramtype take: str + :keyword skip_token: skipToken OData query parameter. Default value is None. + :paramtype skip_token: str + :return: An iterator like instance of ProtectableItem + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.ProtectableItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ProtectableItem]] = 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_replication_protectable_items_list_by_replication_protection_containers_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + subscription_id=self._config.subscription_id, + filter=filter, + take=take, + skip_token=skip_token, + 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), 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.ProtectableItem], + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class ClusterRecoveryPointOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.SiteRecoveryManagementClient`'s + :attr:`cluster_recovery_point` 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: SiteRecoveryManagementClientConfiguration = ( + 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, + resource_name: str, + fabric_name: str, + protection_container_name: str, + replication_protection_cluster_name: str, + recovery_point_name: str, + **kwargs: Any + ) -> _models.ClusterRecoveryPoint: + """Gets a recovery point. + + Get the details of specified recovery point. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param replication_protection_cluster_name: Replication protection cluster name. Required. + :type replication_protection_cluster_name: str + :param recovery_point_name: The recovery point name. Required. + :type recovery_point_name: str + :return: ClusterRecoveryPoint. The ClusterRecoveryPoint is compatible with MutableMapping + :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.ClusterRecoveryPoint + :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.ClusterRecoveryPoint] = kwargs.pop("cls", None) + + _request = build_cluster_recovery_point_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + replication_protection_cluster_name=replication_protection_cluster_name, + recovery_point_name=recovery_point_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.ErrorResponse, + 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.ClusterRecoveryPoint, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class ReplicationProtectionContainerMappingsOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.SiteRecoveryManagementClient`'s + :attr:`replication_protection_container_mappings` 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: SiteRecoveryManagementClientConfiguration = ( + 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, + resource_name: str, + fabric_name: str, + protection_container_name: str, + mapping_name: str, + **kwargs: Any + ) -> _models.ProtectionContainerMapping: + """Gets a protection container mapping. + + Gets the details of a protection container mapping. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param mapping_name: Protection Container mapping name. Required. + :type mapping_name: str + :return: ProtectionContainerMapping. The ProtectionContainerMapping is compatible with + MutableMapping + :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerMapping + :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.ProtectionContainerMapping] = kwargs.pop("cls", None) + + _request = build_replication_protection_container_mappings_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + mapping_name=mapping_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ProtectionContainerMapping, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + mapping_name: str, + creation_input: Union[_models.CreateProtectionContainerMappingInput, JSON, 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(creation_input, (IOBase, bytes)): + _content = creation_input + else: + _content = json.dumps(creation_input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_protection_container_mappings_create_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + mapping_name=mapping_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) + raise HttpResponseError(response=response, 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")) + + 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, + resource_name: str, + fabric_name: str, + protection_container_name: str, + mapping_name: str, + creation_input: _models.CreateProtectionContainerMappingInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ProtectionContainerMapping]: + """Create protection container mapping. + + The operation to create a protection container mapping. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param mapping_name: Protection Container mapping name. Required. + :type mapping_name: str + :param creation_input: Mapping creation input. Required. + :type creation_input: + ~azure.mgmt.recoveryservicessiterecovery.models.CreateProtectionContainerMappingInput + :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 ProtectionContainerMapping. The + ProtectionContainerMapping is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerMapping] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + mapping_name: str, + creation_input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ProtectionContainerMapping]: + """Create protection container mapping. + + The operation to create a protection container mapping. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param mapping_name: Protection Container mapping name. Required. + :type mapping_name: str + :param creation_input: Mapping creation input. Required. + :type creation_input: JSON + :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 ProtectionContainerMapping. The + ProtectionContainerMapping is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerMapping] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + mapping_name: str, + creation_input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ProtectionContainerMapping]: + """Create protection container mapping. + + The operation to create a protection container mapping. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param mapping_name: Protection Container mapping name. Required. + :type mapping_name: str + :param creation_input: Mapping creation input. Required. + :type creation_input: 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 ProtectionContainerMapping. The + ProtectionContainerMapping is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerMapping] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + mapping_name: str, + creation_input: Union[_models.CreateProtectionContainerMappingInput, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.ProtectionContainerMapping]: + """Create protection container mapping. + + The operation to create a protection container mapping. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param mapping_name: Protection Container mapping name. Required. + :type mapping_name: str + :param creation_input: Mapping creation input. Is one of the following types: + CreateProtectionContainerMappingInput, JSON, IO[bytes] Required. + :type creation_input: + ~azure.mgmt.recoveryservicessiterecovery.models.CreateProtectionContainerMappingInput or JSON + or IO[bytes] + :return: An instance of LROPoller that returns ProtectionContainerMapping. The + ProtectionContainerMapping is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerMapping] + :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.ProtectionContainerMapping] = 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, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + mapping_name=mapping_name, + creation_input=creation_input, + 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.ProtectionContainerMapping, 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.ProtectionContainerMapping].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ProtectionContainerMapping]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + mapping_name: str, + update_input: Union[_models.UpdateProtectionContainerMappingInput, JSON, 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(update_input, (IOBase, bytes)): + _content = update_input + else: + _content = json.dumps(update_input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_protection_container_mappings_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + mapping_name=mapping_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) + raise HttpResponseError(response=response, 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")) + + 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, + resource_name: str, + fabric_name: str, + protection_container_name: str, + mapping_name: str, + update_input: _models.UpdateProtectionContainerMappingInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ProtectionContainerMapping]: + """Update protection container mapping. + + The operation to update protection container mapping. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param mapping_name: Protection Container mapping name. Required. + :type mapping_name: str + :param update_input: Mapping update input. Required. + :type update_input: + ~azure.mgmt.recoveryservicessiterecovery.models.UpdateProtectionContainerMappingInput + :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 ProtectionContainerMapping. The + ProtectionContainerMapping is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerMapping] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + mapping_name: str, + update_input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ProtectionContainerMapping]: + """Update protection container mapping. + + The operation to update protection container mapping. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param mapping_name: Protection Container mapping name. Required. + :type mapping_name: str + :param update_input: Mapping update input. Required. + :type update_input: JSON + :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 ProtectionContainerMapping. The + ProtectionContainerMapping is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerMapping] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + mapping_name: str, + update_input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ProtectionContainerMapping]: + """Update protection container mapping. + + The operation to update protection container mapping. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param mapping_name: Protection Container mapping name. Required. + :type mapping_name: str + :param update_input: Mapping update input. Required. + :type update_input: 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 ProtectionContainerMapping. The + ProtectionContainerMapping is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerMapping] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + mapping_name: str, + update_input: Union[_models.UpdateProtectionContainerMappingInput, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.ProtectionContainerMapping]: + """Update protection container mapping. + + The operation to update protection container mapping. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param mapping_name: Protection Container mapping name. Required. + :type mapping_name: str + :param update_input: Mapping update input. Is one of the following types: + UpdateProtectionContainerMappingInput, JSON, IO[bytes] Required. + :type update_input: + ~azure.mgmt.recoveryservicessiterecovery.models.UpdateProtectionContainerMappingInput or JSON + or IO[bytes] + :return: An instance of LROPoller that returns ProtectionContainerMapping. The + ProtectionContainerMapping is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerMapping] + :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.ProtectionContainerMapping] = 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, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + mapping_name=mapping_name, + update_input=update_input, + 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.ProtectionContainerMapping, 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.ProtectionContainerMapping].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ProtectionContainerMapping]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _purge_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + mapping_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_replication_protection_container_mappings_purge_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + mapping_name=mapping_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 [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) + raise HttpResponseError(response=response, 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")) + + 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_purge( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + mapping_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Purge protection container mapping. + + The operation to purge(force delete) a protection container mapping. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param mapping_name: Protection Container mapping name. Required. + :type mapping_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._purge_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + mapping_name=mapping_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_replication_protection_containers( # pylint: disable=name-too-long + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + **kwargs: Any + ) -> ItemPaged["_models.ProtectionContainerMapping"]: + """Gets the list of protection container mappings for a protection container. + + Lists the protection container mappings for a protection container. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :return: An iterator like instance of ProtectionContainerMapping + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerMapping] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ProtectionContainerMapping]] = 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_replication_protection_container_mappings_list_by_replication_protection_containers_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_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), 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.ProtectionContainerMapping], + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + def _delete_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + mapping_name: str, + removal_input: Union[_models.RemoveProtectionContainerMappingInput, JSON, 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(removal_input, (IOBase, bytes)): + _content = removal_input + else: + _content = json.dumps(removal_input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_protection_container_mappings_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + mapping_name=mapping_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 [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) + raise HttpResponseError(response=response, 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")) + + 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_delete( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + mapping_name: str, + removal_input: _models.RemoveProtectionContainerMappingInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Remove protection container mapping. + + The operation to delete or remove a protection container mapping. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param mapping_name: Protection Container mapping name. Required. + :type mapping_name: str + :param removal_input: Removal input. Required. + :type removal_input: + ~azure.mgmt.recoveryservicessiterecovery.models.RemoveProtectionContainerMappingInput + :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_delete( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + mapping_name: str, + removal_input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Remove protection container mapping. + + The operation to delete or remove a protection container mapping. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param mapping_name: Protection Container mapping name. Required. + :type mapping_name: str + :param removal_input: Removal input. Required. + :type removal_input: JSON + :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_delete( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + mapping_name: str, + removal_input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Remove protection container mapping. + + The operation to delete or remove a protection container mapping. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param mapping_name: Protection Container mapping name. Required. + :type mapping_name: str + :param removal_input: Removal input. Required. + :type removal_input: 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_delete( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + protection_container_name: str, + mapping_name: str, + removal_input: Union[_models.RemoveProtectionContainerMappingInput, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[None]: + """Remove protection container mapping. + + The operation to delete or remove a protection container mapping. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param protection_container_name: Protection container name. Required. + :type protection_container_name: str + :param mapping_name: Protection Container mapping name. Required. + :type mapping_name: str + :param removal_input: Removal input. Is one of the following types: + RemoveProtectionContainerMappingInput, JSON, IO[bytes] Required. + :type removal_input: + ~azure.mgmt.recoveryservicessiterecovery.models.RemoveProtectionContainerMappingInput or JSON + 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._delete_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + protection_container_name=protection_container_name, + mapping_name=mapping_name, + removal_input=removal_input, + 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 list( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> ItemPaged["_models.ProtectionContainerMapping"]: + """Gets the list of all protection container mappings in a vault. + + Lists the protection container mappings in the vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :return: An iterator like instance of ProtectionContainerMapping + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerMapping] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ProtectionContainerMapping]] = 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_replication_protection_container_mappings_list_request( + resource_group_name=resource_group_name, + resource_name=resource_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), 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.ProtectionContainerMapping], + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class ReplicationRecoveryServicesProvidersOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.SiteRecoveryManagementClient`'s + :attr:`replication_recovery_services_providers` 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: SiteRecoveryManagementClientConfiguration = ( + 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, resource_name: str, fabric_name: str, provider_name: str, **kwargs: Any + ) -> _models.RecoveryServicesProvider: + """Gets the details of a recovery services provider. + + Gets the details of registered recovery services provider. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param provider_name: Recovery services provider name. Required. + :type provider_name: str + :return: RecoveryServicesProvider. The RecoveryServicesProvider is compatible with + MutableMapping + :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryServicesProvider + :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.RecoveryServicesProvider] = kwargs.pop("cls", None) + + _request = build_replication_recovery_services_providers_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + provider_name=provider_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.RecoveryServicesProvider, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + provider_name: str, + add_provider_input: Union[_models.AddRecoveryServicesProviderInput, JSON, 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(add_provider_input, (IOBase, bytes)): + _content = add_provider_input + else: + _content = json.dumps(add_provider_input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_recovery_services_providers_create_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + provider_name=provider_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) + raise HttpResponseError(response=response, 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")) + + 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, + resource_name: str, + fabric_name: str, + provider_name: str, + add_provider_input: _models.AddRecoveryServicesProviderInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RecoveryServicesProvider]: + """Adds a recovery services provider. + + The operation to add a recovery services provider. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param provider_name: Recovery services provider name. Required. + :type provider_name: str + :param add_provider_input: Add provider input. Required. + :type add_provider_input: + ~azure.mgmt.recoveryservicessiterecovery.models.AddRecoveryServicesProviderInput + :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 RecoveryServicesProvider. The + RecoveryServicesProvider is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryServicesProvider] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + provider_name: str, + add_provider_input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RecoveryServicesProvider]: + """Adds a recovery services provider. + + The operation to add a recovery services provider. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param provider_name: Recovery services provider name. Required. + :type provider_name: str + :param add_provider_input: Add provider input. Required. + :type add_provider_input: JSON + :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 RecoveryServicesProvider. The + RecoveryServicesProvider is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryServicesProvider] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + provider_name: str, + add_provider_input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RecoveryServicesProvider]: + """Adds a recovery services provider. + + The operation to add a recovery services provider. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param provider_name: Recovery services provider name. Required. + :type provider_name: str + :param add_provider_input: Add provider input. Required. + :type add_provider_input: 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 RecoveryServicesProvider. The + RecoveryServicesProvider is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryServicesProvider] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + provider_name: str, + add_provider_input: Union[_models.AddRecoveryServicesProviderInput, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.RecoveryServicesProvider]: + """Adds a recovery services provider. + + The operation to add a recovery services provider. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param provider_name: Recovery services provider name. Required. + :type provider_name: str + :param add_provider_input: Add provider input. Is one of the following types: + AddRecoveryServicesProviderInput, JSON, IO[bytes] Required. + :type add_provider_input: + ~azure.mgmt.recoveryservicessiterecovery.models.AddRecoveryServicesProviderInput or JSON or + IO[bytes] + :return: An instance of LROPoller that returns RecoveryServicesProvider. The + RecoveryServicesProvider is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryServicesProvider] + :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.RecoveryServicesProvider] = 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, + resource_name=resource_name, + fabric_name=fabric_name, + provider_name=provider_name, + add_provider_input=add_provider_input, + 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.RecoveryServicesProvider, 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.RecoveryServicesProvider].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.RecoveryServicesProvider]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _purge_initial( + self, resource_group_name: str, resource_name: str, fabric_name: str, provider_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_replication_recovery_services_providers_purge_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + provider_name=provider_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 [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) + raise HttpResponseError(response=response, 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")) + + 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_purge( + self, resource_group_name: str, resource_name: str, fabric_name: str, provider_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Purges recovery service provider from fabric. + + The operation to purge(force delete) a recovery services provider from the vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param provider_name: Recovery services provider name. Required. + :type provider_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._purge_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + provider_name=provider_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_replication_fabrics( + self, resource_group_name: str, resource_name: str, fabric_name: str, **kwargs: Any + ) -> ItemPaged["_models.RecoveryServicesProvider"]: + """Gets the list of registered recovery services providers for the fabric. + + Lists the registered recovery services providers for the specified fabric. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :return: An iterator like instance of RecoveryServicesProvider + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryServicesProvider] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.RecoveryServicesProvider]] = 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_replication_recovery_services_providers_list_by_replication_fabrics_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_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), 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.RecoveryServicesProvider], + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + def _refresh_provider_initial( + self, resource_group_name: str, resource_name: str, fabric_name: str, provider_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_replication_recovery_services_providers_refresh_provider_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + provider_name=provider_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) + raise HttpResponseError(response=response, 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")) + + 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_refresh_provider( + self, resource_group_name: str, resource_name: str, fabric_name: str, provider_name: str, **kwargs: Any + ) -> LROPoller[_models.RecoveryServicesProvider]: + """Refresh details from the recovery services provider. + + The operation to refresh the information from the recovery services provider. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param provider_name: Recovery services provider name. Required. + :type provider_name: str + :return: An instance of LROPoller that returns RecoveryServicesProvider. The + RecoveryServicesProvider is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryServicesProvider] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.RecoveryServicesProvider] = 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._refresh_provider_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + provider_name=provider_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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.RecoveryServicesProvider, 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.RecoveryServicesProvider].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.RecoveryServicesProvider]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, resource_group_name: str, resource_name: str, fabric_name: str, provider_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_replication_recovery_services_providers_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + provider_name=provider_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 [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) + raise HttpResponseError(response=response, 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")) + + 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, resource_name: str, fabric_name: str, provider_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes provider from fabric. Note: Deleting provider for any fabric other than SingleHost is + unsupported. To maintain backward compatibility for released clients the object + "deleteRspInput" is used (if the object is empty we assume that it is old client and continue + the old behavior). + + The operation to removes/delete(unregister) a recovery services provider from the vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param provider_name: Recovery services provider name. Required. + :type provider_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, + resource_name=resource_name, + fabric_name=fabric_name, + provider_name=provider_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( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> ItemPaged["_models.RecoveryServicesProvider"]: + """Gets the list of registered recovery services providers in the vault. This is a view only api. + + Lists the registered recovery services providers in the vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :return: An iterator like instance of RecoveryServicesProvider + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryServicesProvider] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.RecoveryServicesProvider]] = 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_replication_recovery_services_providers_list_request( + resource_group_name=resource_group_name, + resource_name=resource_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), 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.RecoveryServicesProvider], + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class ReplicationStorageClassificationsOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.SiteRecoveryManagementClient`'s + :attr:`replication_storage_classifications` 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: SiteRecoveryManagementClientConfiguration = ( + 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, + resource_name: str, + fabric_name: str, + storage_classification_name: str, + **kwargs: Any + ) -> _models.StorageClassification: + """Gets the details of a storage classification. + + Gets the details of the specified storage classification. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param storage_classification_name: Storage classification name. Required. + :type storage_classification_name: str + :return: StorageClassification. The StorageClassification is compatible with MutableMapping + :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.StorageClassification + :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.StorageClassification] = kwargs.pop("cls", None) + + _request = build_replication_storage_classifications_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + storage_classification_name=storage_classification_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.StorageClassification, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_replication_fabrics( + self, resource_group_name: str, resource_name: str, fabric_name: str, **kwargs: Any + ) -> ItemPaged["_models.StorageClassification"]: + """Gets the list of storage classification objects under a fabric. + + Lists the storage classifications available in the specified fabric. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :return: An iterator like instance of StorageClassification + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.StorageClassification] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.StorageClassification]] = 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_replication_storage_classifications_list_by_replication_fabrics_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_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), 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.StorageClassification], + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> ItemPaged["_models.StorageClassification"]: + """Gets the list of storage classification objects under a vault. + + Lists the storage classifications in the vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :return: An iterator like instance of StorageClassification + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.StorageClassification] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.StorageClassification]] = 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_replication_storage_classifications_list_request( + resource_group_name=resource_group_name, + resource_name=resource_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), 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.StorageClassification], + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class ReplicationStorageClassificationMappingsOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.SiteRecoveryManagementClient`'s + :attr:`replication_storage_classification_mappings` 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: SiteRecoveryManagementClientConfiguration = ( + 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, + resource_name: str, + fabric_name: str, + storage_classification_name: str, + storage_classification_mapping_name: str, + **kwargs: Any + ) -> _models.StorageClassificationMapping: + """Gets the details of a storage classification mapping. + + Gets the details of the specified storage classification mapping. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param storage_classification_name: Storage classification name. Required. + :type storage_classification_name: str + :param storage_classification_mapping_name: Storage classification mapping name. Required. + :type storage_classification_mapping_name: str + :return: StorageClassificationMapping. The StorageClassificationMapping is compatible with + MutableMapping + :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.StorageClassificationMapping + :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.StorageClassificationMapping] = kwargs.pop("cls", None) + + _request = build_replication_storage_classification_mappings_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + storage_classification_name=storage_classification_name, + storage_classification_mapping_name=storage_classification_mapping_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.StorageClassificationMapping, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + storage_classification_name: str, + storage_classification_mapping_name: str, + pairing_input: Union[_models.StorageClassificationMappingInput, JSON, 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(pairing_input, (IOBase, bytes)): + _content = pairing_input + else: + _content = json.dumps(pairing_input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_storage_classification_mappings_create_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + storage_classification_name=storage_classification_name, + storage_classification_mapping_name=storage_classification_mapping_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) + raise HttpResponseError(response=response, 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")) + + 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, + resource_name: str, + fabric_name: str, + storage_classification_name: str, + storage_classification_mapping_name: str, + pairing_input: _models.StorageClassificationMappingInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.StorageClassificationMapping]: + """Create storage classification mapping. + + The operation to create a storage classification mapping. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param storage_classification_name: Storage classification name. Required. + :type storage_classification_name: str + :param storage_classification_mapping_name: Storage classification mapping name. Required. + :type storage_classification_mapping_name: str + :param pairing_input: Pairing input. Required. + :type pairing_input: + ~azure.mgmt.recoveryservicessiterecovery.models.StorageClassificationMappingInput + :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 StorageClassificationMapping. The + StorageClassificationMapping is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.StorageClassificationMapping] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + storage_classification_name: str, + storage_classification_mapping_name: str, + pairing_input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.StorageClassificationMapping]: + """Create storage classification mapping. + + The operation to create a storage classification mapping. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param storage_classification_name: Storage classification name. Required. + :type storage_classification_name: str + :param storage_classification_mapping_name: Storage classification mapping name. Required. + :type storage_classification_mapping_name: str + :param pairing_input: Pairing input. Required. + :type pairing_input: JSON + :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 StorageClassificationMapping. The + StorageClassificationMapping is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.StorageClassificationMapping] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + storage_classification_name: str, + storage_classification_mapping_name: str, + pairing_input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.StorageClassificationMapping]: + """Create storage classification mapping. + + The operation to create a storage classification mapping. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param storage_classification_name: Storage classification name. Required. + :type storage_classification_name: str + :param storage_classification_mapping_name: Storage classification mapping name. Required. + :type storage_classification_mapping_name: str + :param pairing_input: Pairing input. Required. + :type pairing_input: 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 StorageClassificationMapping. The + StorageClassificationMapping is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.StorageClassificationMapping] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + storage_classification_name: str, + storage_classification_mapping_name: str, + pairing_input: Union[_models.StorageClassificationMappingInput, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.StorageClassificationMapping]: + """Create storage classification mapping. + + The operation to create a storage classification mapping. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param storage_classification_name: Storage classification name. Required. + :type storage_classification_name: str + :param storage_classification_mapping_name: Storage classification mapping name. Required. + :type storage_classification_mapping_name: str + :param pairing_input: Pairing input. Is one of the following types: + StorageClassificationMappingInput, JSON, IO[bytes] Required. + :type pairing_input: + ~azure.mgmt.recoveryservicessiterecovery.models.StorageClassificationMappingInput or JSON or + IO[bytes] + :return: An instance of LROPoller that returns StorageClassificationMapping. The + StorageClassificationMapping is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.StorageClassificationMapping] + :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.StorageClassificationMapping] = 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, + resource_name=resource_name, + fabric_name=fabric_name, + storage_classification_name=storage_classification_name, + storage_classification_mapping_name=storage_classification_mapping_name, + pairing_input=pairing_input, + 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.StorageClassificationMapping, 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.StorageClassificationMapping].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.StorageClassificationMapping]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + storage_classification_name: str, + storage_classification_mapping_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_replication_storage_classification_mappings_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + storage_classification_name=storage_classification_name, + storage_classification_mapping_name=storage_classification_mapping_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 [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) + raise HttpResponseError(response=response, 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")) + + 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, + resource_name: str, + fabric_name: str, + storage_classification_name: str, + storage_classification_mapping_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Delete a storage classification mapping. + + The operation to delete a storage classification mapping. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param storage_classification_name: Storage classification name. Required. + :type storage_classification_name: str + :param storage_classification_mapping_name: Storage classification mapping name. Required. + :type storage_classification_mapping_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, + resource_name=resource_name, + fabric_name=fabric_name, + storage_classification_name=storage_classification_name, + storage_classification_mapping_name=storage_classification_mapping_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_replication_storage_classifications( # pylint: disable=name-too-long + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + storage_classification_name: str, + **kwargs: Any + ) -> ItemPaged["_models.StorageClassificationMapping"]: + """Gets the list of storage classification mappings objects under a storage. + + Lists the storage classification mappings for the fabric. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param storage_classification_name: Storage classification name. Required. + :type storage_classification_name: str + :return: An iterator like instance of StorageClassificationMapping + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.StorageClassificationMapping] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.StorageClassificationMapping]] = 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_replication_storage_classification_mappings_list_by_replication_storage_classifications_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + storage_classification_name=storage_classification_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), 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.StorageClassificationMapping], + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> ItemPaged["_models.StorageClassificationMapping"]: + """Gets the list of storage classification mappings objects under a vault. + + Lists the storage classification mappings in the vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :return: An iterator like instance of StorageClassificationMapping + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.StorageClassificationMapping] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.StorageClassificationMapping]] = 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_replication_storage_classification_mappings_list_request( + resource_group_name=resource_group_name, + resource_name=resource_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), 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.StorageClassificationMapping], + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class ReplicationvCentersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.SiteRecoveryManagementClient`'s + :attr:`replicationv_centers` 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: SiteRecoveryManagementClientConfiguration = ( + 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, resource_name: str, fabric_name: str, vcenter_name: str, **kwargs: Any + ) -> _models.VCenter: + """Gets the details of a vCenter. + + Gets the details of a registered vCenter server(Add vCenter server). + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param vcenter_name: vcenter name. Required. + :type vcenter_name: str + :return: VCenter. The VCenter is compatible with MutableMapping + :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.VCenter + :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.VCenter] = kwargs.pop("cls", None) + + _request = build_replicationv_centers_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + vcenter_name=vcenter_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.VCenter, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + vcenter_name: str, + add_v_center_request: Union[_models.AddVCenterRequest, JSON, 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(add_v_center_request, (IOBase, bytes)): + _content = add_v_center_request + else: + _content = json.dumps(add_v_center_request, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replicationv_centers_create_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + vcenter_name=vcenter_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) + raise HttpResponseError(response=response, 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")) + + 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, + resource_name: str, + fabric_name: str, + vcenter_name: str, + add_v_center_request: _models.AddVCenterRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VCenter]: + """Add vCenter. + + The operation to create a vCenter object.. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param vcenter_name: vcenter name. Required. + :type vcenter_name: str + :param add_v_center_request: The input to the add vCenter operation. Required. + :type add_v_center_request: ~azure.mgmt.recoveryservicessiterecovery.models.AddVCenterRequest + :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 VCenter. The VCenter is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.VCenter] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + vcenter_name: str, + add_v_center_request: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VCenter]: + """Add vCenter. + + The operation to create a vCenter object.. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param vcenter_name: vcenter name. Required. + :type vcenter_name: str + :param add_v_center_request: The input to the add vCenter operation. Required. + :type add_v_center_request: JSON + :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 VCenter. The VCenter is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.VCenter] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + vcenter_name: str, + add_v_center_request: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VCenter]: + """Add vCenter. + + The operation to create a vCenter object.. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param vcenter_name: vcenter name. Required. + :type vcenter_name: str + :param add_v_center_request: The input to the add vCenter operation. Required. + :type add_v_center_request: 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 VCenter. The VCenter is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.VCenter] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + vcenter_name: str, + add_v_center_request: Union[_models.AddVCenterRequest, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.VCenter]: + """Add vCenter. + + The operation to create a vCenter object.. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param vcenter_name: vcenter name. Required. + :type vcenter_name: str + :param add_v_center_request: The input to the add vCenter operation. Is one of the following + types: AddVCenterRequest, JSON, IO[bytes] Required. + :type add_v_center_request: ~azure.mgmt.recoveryservicessiterecovery.models.AddVCenterRequest + or JSON or IO[bytes] + :return: An instance of LROPoller that returns VCenter. The VCenter is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.VCenter] + :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.VCenter] = 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, + resource_name=resource_name, + fabric_name=fabric_name, + vcenter_name=vcenter_name, + add_v_center_request=add_v_center_request, + 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.VCenter, 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.VCenter].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.VCenter]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_initial( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + vcenter_name: str, + update_v_center_request: Union[_models.UpdateVCenterRequest, JSON, 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(update_v_center_request, (IOBase, bytes)): + _content = update_v_center_request + else: + _content = json.dumps(update_v_center_request, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replicationv_centers_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + vcenter_name=vcenter_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) + raise HttpResponseError(response=response, 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")) + + 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, + resource_name: str, + fabric_name: str, + vcenter_name: str, + update_v_center_request: _models.UpdateVCenterRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VCenter]: + """Update vCenter operation. + + The operation to update a registered vCenter. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param vcenter_name: vcenter name. Required. + :type vcenter_name: str + :param update_v_center_request: The input to the update vCenter operation. Required. + :type update_v_center_request: + ~azure.mgmt.recoveryservicessiterecovery.models.UpdateVCenterRequest + :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 VCenter. The VCenter is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.VCenter] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + vcenter_name: str, + update_v_center_request: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VCenter]: + """Update vCenter operation. + + The operation to update a registered vCenter. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param vcenter_name: vcenter name. Required. + :type vcenter_name: str + :param update_v_center_request: The input to the update vCenter operation. Required. + :type update_v_center_request: JSON + :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 VCenter. The VCenter is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.VCenter] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + vcenter_name: str, + update_v_center_request: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VCenter]: + """Update vCenter operation. + + The operation to update a registered vCenter. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param vcenter_name: vcenter name. Required. + :type vcenter_name: str + :param update_v_center_request: The input to the update vCenter operation. Required. + :type update_v_center_request: 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 VCenter. The VCenter is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.VCenter] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + resource_name: str, + fabric_name: str, + vcenter_name: str, + update_v_center_request: Union[_models.UpdateVCenterRequest, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.VCenter]: + """Update vCenter operation. + + The operation to update a registered vCenter. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param vcenter_name: vcenter name. Required. + :type vcenter_name: str + :param update_v_center_request: The input to the update vCenter operation. Is one of the + following types: UpdateVCenterRequest, JSON, IO[bytes] Required. + :type update_v_center_request: + ~azure.mgmt.recoveryservicessiterecovery.models.UpdateVCenterRequest or JSON or IO[bytes] + :return: An instance of LROPoller that returns VCenter. The VCenter is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.VCenter] + :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.VCenter] = 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, + resource_name=resource_name, + fabric_name=fabric_name, + vcenter_name=vcenter_name, + update_v_center_request=update_v_center_request, + 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.VCenter, 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.VCenter].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.VCenter]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, resource_group_name: str, resource_name: str, fabric_name: str, vcenter_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_replicationv_centers_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_name, + vcenter_name=vcenter_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 [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) + raise HttpResponseError(response=response, 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")) + + 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, resource_name: str, fabric_name: str, vcenter_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Remove vcenter operation. + + The operation to remove(unregister) a registered vCenter server from the vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :param vcenter_name: vcenter name. Required. + :type vcenter_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, + resource_name=resource_name, + fabric_name=fabric_name, + vcenter_name=vcenter_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_replication_fabrics( + self, resource_group_name: str, resource_name: str, fabric_name: str, **kwargs: Any + ) -> ItemPaged["_models.VCenter"]: + """Gets the list of vCenter registered under a fabric. + + Lists the vCenter servers registered in a fabric. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :return: An iterator like instance of VCenter + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.VCenter] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.VCenter]] = 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_replicationv_centers_list_by_replication_fabrics_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + fabric_name=fabric_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), 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.VCenter], + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> ItemPaged["_models.VCenter"]: + """Gets the list of vCenter registered under the vault. + + Lists the vCenter servers registered in the vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :return: An iterator like instance of VCenter + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.VCenter] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.VCenter]] = 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_replicationv_centers_list_request( + resource_group_name=resource_group_name, + resource_name=resource_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), 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.VCenter], + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class ReplicationJobsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.SiteRecoveryManagementClient`'s + :attr:`replication_jobs` 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: SiteRecoveryManagementClientConfiguration = ( + 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, resource_name: str, job_name: str, **kwargs: Any) -> _models.Job: + """Gets the job details. + + Get the details of an Azure Site Recovery job. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param job_name: Job identifier. Required. + :type job_name: str + :return: Job. The Job is compatible with MutableMapping + :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.Job + :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.Job] = kwargs.pop("cls", None) + + _request = build_replication_jobs_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + job_name=job_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Job, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list( + self, resource_group_name: str, resource_name: str, *, filter: Optional[str] = None, **kwargs: Any + ) -> ItemPaged["_models.Job"]: + """Gets the list of jobs. + + Gets the list of Azure Site Recovery Jobs for the vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :keyword filter: OData filter options. Default value is None. + :paramtype filter: str + :return: An iterator like instance of Job + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.Job] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Job]] = 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_replication_jobs_list_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + filter=filter, + 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), 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.Job], + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + def _cancel_initial( + self, resource_group_name: str, resource_name: str, job_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_replication_jobs_cancel_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + job_name=job_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) + raise HttpResponseError(response=response, 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")) + + 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_cancel( + self, resource_group_name: str, resource_name: str, job_name: str, **kwargs: Any + ) -> LROPoller[_models.Job]: + """Cancels the specified job. + + The operation to cancel an Azure Site Recovery job. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param job_name: Job identifier. Required. + :type job_name: str + :return: An instance of LROPoller that returns Job. The Job is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Job] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Job] = 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._cancel_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + job_name=job_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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.Job, 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.Job].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.Job](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _restart_initial( + self, resource_group_name: str, resource_name: str, job_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_replication_jobs_restart_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + job_name=job_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) + raise HttpResponseError(response=response, 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")) + + 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_restart( + self, resource_group_name: str, resource_name: str, job_name: str, **kwargs: Any + ) -> LROPoller[_models.Job]: + """Restarts the specified job. + + The operation to restart an Azure Site Recovery job. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param job_name: Job identifier. Required. + :type job_name: str + :return: An instance of LROPoller that returns Job. The Job is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Job] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Job] = 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._restart_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + job_name=job_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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.Job, 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.Job].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.Job](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _resume_initial( + self, + resource_group_name: str, + resource_name: str, + job_name: str, + resume_job_params: Union[_models.ResumeJobParams, JSON, 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(resume_job_params, (IOBase, bytes)): + _content = resume_job_params + else: + _content = json.dumps(resume_job_params, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_jobs_resume_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + job_name=job_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) + raise HttpResponseError(response=response, 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")) + + 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_resume( + self, + resource_group_name: str, + resource_name: str, + job_name: str, + resume_job_params: _models.ResumeJobParams, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Job]: + """Resumes the specified job. + + The operation to resume an Azure Site Recovery job. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param job_name: Job identifier. Required. + :type job_name: str + :param resume_job_params: Resume rob comments. Required. + :type resume_job_params: ~azure.mgmt.recoveryservicessiterecovery.models.ResumeJobParams + :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 Job. The Job is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Job] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_resume( + self, + resource_group_name: str, + resource_name: str, + job_name: str, + resume_job_params: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Job]: + """Resumes the specified job. + + The operation to resume an Azure Site Recovery job. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param job_name: Job identifier. Required. + :type job_name: str + :param resume_job_params: Resume rob comments. Required. + :type resume_job_params: JSON + :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 Job. The Job is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Job] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_resume( + self, + resource_group_name: str, + resource_name: str, + job_name: str, + resume_job_params: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Job]: + """Resumes the specified job. + + The operation to resume an Azure Site Recovery job. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param job_name: Job identifier. Required. + :type job_name: str + :param resume_job_params: Resume rob comments. Required. + :type resume_job_params: 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 Job. The Job is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Job] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_resume( + self, + resource_group_name: str, + resource_name: str, + job_name: str, + resume_job_params: Union[_models.ResumeJobParams, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.Job]: + """Resumes the specified job. + + The operation to resume an Azure Site Recovery job. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param job_name: Job identifier. Required. + :type job_name: str + :param resume_job_params: Resume rob comments. Is one of the following types: ResumeJobParams, + JSON, IO[bytes] Required. + :type resume_job_params: ~azure.mgmt.recoveryservicessiterecovery.models.ResumeJobParams or + JSON or IO[bytes] + :return: An instance of LROPoller that returns Job. The Job is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Job] + :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.Job] = 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._resume_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + job_name=job_name, + resume_job_params=resume_job_params, + 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.Job, 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.Job].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.Job](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _export_initial( + self, + resource_group_name: str, + resource_name: str, + job_query_parameter: Union[_models.JobQueryParameter, JSON, 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(job_query_parameter, (IOBase, bytes)): + _content = job_query_parameter + else: + _content = json.dumps(job_query_parameter, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_jobs_export_request( + resource_group_name=resource_group_name, + resource_name=resource_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) + raise HttpResponseError(response=response, 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")) + + 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_export( + self, + resource_group_name: str, + resource_name: str, + job_query_parameter: _models.JobQueryParameter, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Job]: + """Exports the details of the Azure Site Recovery jobs of the vault. + + The operation to export the details of the Azure Site Recovery jobs of the vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :param job_query_parameter: The request body. Required. + :type job_query_parameter: ~azure.mgmt.recoveryservicessiterecovery.models.JobQueryParameter + :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 Job. The Job is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Job] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_export( + self, + resource_group_name: str, + resource_name: str, + job_query_parameter: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Job]: + """Exports the details of the Azure Site Recovery jobs of the vault. + + The operation to export the details of the Azure Site Recovery jobs of the vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :param job_query_parameter: The request body. Required. + :type job_query_parameter: JSON + :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 Job. The Job is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Job] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_export( + self, + resource_group_name: str, + resource_name: str, + job_query_parameter: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Job]: + """Exports the details of the Azure Site Recovery jobs of the vault. + + The operation to export the details of the Azure Site Recovery jobs of the vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :param job_query_parameter: The request body. Required. + :type job_query_parameter: 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 Job. The Job is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Job] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_export( + self, + resource_group_name: str, + resource_name: str, + job_query_parameter: Union[_models.JobQueryParameter, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.Job]: + """Exports the details of the Azure Site Recovery jobs of the vault. + + The operation to export the details of the Azure Site Recovery jobs of the vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :param job_query_parameter: The request body. Is one of the following types: JobQueryParameter, + JSON, IO[bytes] Required. + :type job_query_parameter: ~azure.mgmt.recoveryservicessiterecovery.models.JobQueryParameter or + JSON or IO[bytes] + :return: An instance of LROPoller that returns Job. The Job is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Job] + :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.Job] = 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._export_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + job_query_parameter=job_query_parameter, + 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["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.Job, 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.Job].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.Job](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + +class ReplicationPoliciesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.SiteRecoveryManagementClient`'s + :attr:`replication_policies` 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: SiteRecoveryManagementClientConfiguration = ( + 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, resource_name: str, policy_name: str, **kwargs: Any) -> _models.Policy: + """Gets the requested policy. + + Gets the details of a replication policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param policy_name: Replication policy name. Required. + :type policy_name: str + :return: Policy. The Policy is compatible with MutableMapping + :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.Policy + :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.Policy] = kwargs.pop("cls", None) + + _request = build_replication_policies_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + policy_name=policy_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Policy, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_initial( + self, + resource_group_name: str, + resource_name: str, + policy_name: str, + input: Union[_models.CreatePolicyInput, JSON, 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(input, (IOBase, bytes)): + _content = input + else: + _content = json.dumps(input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_policies_create_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + policy_name=policy_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) + raise HttpResponseError(response=response, 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")) + + 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, + resource_name: str, + policy_name: str, + input: _models.CreatePolicyInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Policy]: + """Creates the policy. + + The operation to create a replication policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param policy_name: Replication policy name. Required. + :type policy_name: str + :param input: Create policy input. Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.CreatePolicyInput + :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 Policy. The Policy is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Policy] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + resource_name: str, + policy_name: str, + input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Policy]: + """Creates the policy. + + The operation to create a replication policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param policy_name: Replication policy name. Required. + :type policy_name: str + :param input: Create policy input. Required. + :type input: JSON + :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 Policy. The Policy is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Policy] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + resource_name: str, + policy_name: str, + input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Policy]: + """Creates the policy. + + The operation to create a replication policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param policy_name: Replication policy name. Required. + :type policy_name: str + :param input: Create policy input. Required. + :type input: 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 Policy. The Policy is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Policy] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + resource_name: str, + policy_name: str, + input: Union[_models.CreatePolicyInput, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.Policy]: + """Creates the policy. + + The operation to create a replication policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param policy_name: Replication policy name. Required. + :type policy_name: str + :param input: Create policy input. Is one of the following types: CreatePolicyInput, JSON, + IO[bytes] Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.CreatePolicyInput or JSON or + IO[bytes] + :return: An instance of LROPoller that returns Policy. The Policy is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Policy] + :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.Policy] = 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, + resource_name=resource_name, + policy_name=policy_name, + input=input, + 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.Policy, 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.Policy].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.Policy]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_initial( + self, + resource_group_name: str, + resource_name: str, + policy_name: str, + input: Union[_models.UpdatePolicyInput, JSON, 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(input, (IOBase, bytes)): + _content = input + else: + _content = json.dumps(input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_policies_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + policy_name=policy_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) + raise HttpResponseError(response=response, 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")) + + 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, + resource_name: str, + policy_name: str, + input: _models.UpdatePolicyInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Policy]: + """Updates the policy. + + The operation to update a replication policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param policy_name: Replication policy name. Required. + :type policy_name: str + :param input: Update Policy Input. Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.UpdatePolicyInput + :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 Policy. The Policy is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Policy] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + resource_name: str, + policy_name: str, + input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Policy]: + """Updates the policy. + + The operation to update a replication policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param policy_name: Replication policy name. Required. + :type policy_name: str + :param input: Update Policy Input. Required. + :type input: JSON + :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 Policy. The Policy is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Policy] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + resource_name: str, + policy_name: str, + input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Policy]: + """Updates the policy. + + The operation to update a replication policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param policy_name: Replication policy name. Required. + :type policy_name: str + :param input: Update Policy Input. Required. + :type input: 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 Policy. The Policy is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Policy] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + resource_name: str, + policy_name: str, + input: Union[_models.UpdatePolicyInput, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.Policy]: + """Updates the policy. + + The operation to update a replication policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param policy_name: Replication policy name. Required. + :type policy_name: str + :param input: Update Policy Input. Is one of the following types: UpdatePolicyInput, JSON, + IO[bytes] Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.UpdatePolicyInput or JSON or + IO[bytes] + :return: An instance of LROPoller that returns Policy. The Policy is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Policy] + :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.Policy] = 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, + resource_name=resource_name, + policy_name=policy_name, + input=input, + 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.Policy, 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.Policy].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.Policy]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, resource_group_name: str, resource_name: str, policy_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_replication_policies_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + policy_name=policy_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 [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) + raise HttpResponseError(response=response, 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")) + + 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, resource_name: str, policy_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Delete the policy. + + The operation to delete a replication policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param policy_name: Replication policy name. Required. + :type policy_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, + resource_name=resource_name, + policy_name=policy_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(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> ItemPaged["_models.Policy"]: + """Gets the list of replication policies. + + Lists the replication policies for a vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :return: An iterator like instance of Policy + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.Policy] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Policy]] = 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_replication_policies_list_request( + resource_group_name=resource_group_name, + resource_name=resource_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), 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.Policy], + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class ReplicationRecoveryPlansOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.SiteRecoveryManagementClient`'s + :attr:`replication_recovery_plans` 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: SiteRecoveryManagementClientConfiguration = ( + 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, resource_name: str, recovery_plan_name: str, **kwargs: Any + ) -> _models.RecoveryPlan: + """Gets the requested recovery plan. + + Gets the details of the recovery plan. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param recovery_plan_name: Name of the recovery plan. Required. + :type recovery_plan_name: str + :return: RecoveryPlan. The RecoveryPlan is compatible with MutableMapping + :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan + :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.RecoveryPlan] = kwargs.pop("cls", None) + + _request = build_replication_recovery_plans_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + recovery_plan_name=recovery_plan_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.RecoveryPlan, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_initial( + self, + resource_group_name: str, + resource_name: str, + recovery_plan_name: str, + input: Union[_models.CreateRecoveryPlanInput, JSON, 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(input, (IOBase, bytes)): + _content = input + else: + _content = json.dumps(input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_recovery_plans_create_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + recovery_plan_name=recovery_plan_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) + raise HttpResponseError(response=response, 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")) + + 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, + resource_name: str, + recovery_plan_name: str, + input: _models.CreateRecoveryPlanInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RecoveryPlan]: + """Creates a recovery plan with the given details. + + The operation to create a recovery plan. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param recovery_plan_name: Name of the recovery plan. Required. + :type recovery_plan_name: str + :param input: Recovery Plan creation input. Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.CreateRecoveryPlanInput + :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 RecoveryPlan. The RecoveryPlan is compatible + with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + resource_name: str, + recovery_plan_name: str, + input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RecoveryPlan]: + """Creates a recovery plan with the given details. + + The operation to create a recovery plan. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param recovery_plan_name: Name of the recovery plan. Required. + :type recovery_plan_name: str + :param input: Recovery Plan creation input. Required. + :type input: JSON + :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 RecoveryPlan. The RecoveryPlan is compatible + with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + resource_name: str, + recovery_plan_name: str, + input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RecoveryPlan]: + """Creates a recovery plan with the given details. + + The operation to create a recovery plan. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param recovery_plan_name: Name of the recovery plan. Required. + :type recovery_plan_name: str + :param input: Recovery Plan creation input. Required. + :type input: 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 RecoveryPlan. The RecoveryPlan is compatible + with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + resource_name: str, + recovery_plan_name: str, + input: Union[_models.CreateRecoveryPlanInput, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.RecoveryPlan]: + """Creates a recovery plan with the given details. + + The operation to create a recovery plan. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param recovery_plan_name: Name of the recovery plan. Required. + :type recovery_plan_name: str + :param input: Recovery Plan creation input. Is one of the following types: + CreateRecoveryPlanInput, JSON, IO[bytes] Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.CreateRecoveryPlanInput or JSON or + IO[bytes] + :return: An instance of LROPoller that returns RecoveryPlan. The RecoveryPlan is compatible + with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :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.RecoveryPlan] = 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, + resource_name=resource_name, + recovery_plan_name=recovery_plan_name, + input=input, + 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.RecoveryPlan, 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.RecoveryPlan].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.RecoveryPlan]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_initial( + self, + resource_group_name: str, + resource_name: str, + recovery_plan_name: str, + input: Union[_models.UpdateRecoveryPlanInput, JSON, 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(input, (IOBase, bytes)): + _content = input + else: + _content = json.dumps(input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_recovery_plans_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + recovery_plan_name=recovery_plan_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) + raise HttpResponseError(response=response, 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")) + + 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, + resource_name: str, + recovery_plan_name: str, + input: _models.UpdateRecoveryPlanInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RecoveryPlan]: + """Updates the given recovery plan. + + The operation to update a recovery plan. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param recovery_plan_name: Name of the recovery plan. Required. + :type recovery_plan_name: str + :param input: Update recovery plan input. Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.UpdateRecoveryPlanInput + :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 RecoveryPlan. The RecoveryPlan is compatible + with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + resource_name: str, + recovery_plan_name: str, + input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RecoveryPlan]: + """Updates the given recovery plan. + + The operation to update a recovery plan. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param recovery_plan_name: Name of the recovery plan. Required. + :type recovery_plan_name: str + :param input: Update recovery plan input. Required. + :type input: JSON + :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 RecoveryPlan. The RecoveryPlan is compatible + with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + resource_name: str, + recovery_plan_name: str, + input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RecoveryPlan]: + """Updates the given recovery plan. + + The operation to update a recovery plan. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param recovery_plan_name: Name of the recovery plan. Required. + :type recovery_plan_name: str + :param input: Update recovery plan input. Required. + :type input: 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 RecoveryPlan. The RecoveryPlan is compatible + with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + resource_name: str, + recovery_plan_name: str, + input: Union[_models.UpdateRecoveryPlanInput, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.RecoveryPlan]: + """Updates the given recovery plan. + + The operation to update a recovery plan. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param recovery_plan_name: Name of the recovery plan. Required. + :type recovery_plan_name: str + :param input: Update recovery plan input. Is one of the following types: + UpdateRecoveryPlanInput, JSON, IO[bytes] Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.UpdateRecoveryPlanInput or JSON or + IO[bytes] + :return: An instance of LROPoller that returns RecoveryPlan. The RecoveryPlan is compatible + with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :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.RecoveryPlan] = 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, + resource_name=resource_name, + recovery_plan_name=recovery_plan_name, + input=input, + 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.RecoveryPlan, 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.RecoveryPlan].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.RecoveryPlan]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, resource_group_name: str, resource_name: str, recovery_plan_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_replication_recovery_plans_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + recovery_plan_name=recovery_plan_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 [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) + raise HttpResponseError(response=response, 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")) + + 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, resource_name: str, recovery_plan_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes the specified recovery plan. + + Delete a recovery plan. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param recovery_plan_name: Name of the recovery plan. Required. + :type recovery_plan_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, + resource_name=resource_name, + recovery_plan_name=recovery_plan_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(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> ItemPaged["_models.RecoveryPlan"]: + """Gets the list of recovery plans. + + Lists the recovery plans in the vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :return: An iterator like instance of RecoveryPlan + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.RecoveryPlan]] = 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_replication_recovery_plans_list_request( + resource_group_name=resource_group_name, + resource_name=resource_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), 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.RecoveryPlan], + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + def _failover_cancel_initial( + self, resource_group_name: str, resource_name: str, recovery_plan_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_replication_recovery_plans_failover_cancel_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + recovery_plan_name=recovery_plan_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) + raise HttpResponseError(response=response, 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")) + + 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_failover_cancel( + self, resource_group_name: str, resource_name: str, recovery_plan_name: str, **kwargs: Any + ) -> LROPoller[_models.RecoveryPlan]: + """Execute cancel failover of the recovery plan. + + The operation to cancel the failover of a recovery plan. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param recovery_plan_name: Name of the recovery plan. Required. + :type recovery_plan_name: str + :return: An instance of LROPoller that returns RecoveryPlan. The RecoveryPlan is compatible + with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.RecoveryPlan] = 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._failover_cancel_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + recovery_plan_name=recovery_plan_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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.RecoveryPlan, 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.RecoveryPlan].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.RecoveryPlan]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _failover_commit_initial( + self, resource_group_name: str, resource_name: str, recovery_plan_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_replication_recovery_plans_failover_commit_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + recovery_plan_name=recovery_plan_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) + raise HttpResponseError(response=response, 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")) + + 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_failover_commit( + self, resource_group_name: str, resource_name: str, recovery_plan_name: str, **kwargs: Any + ) -> LROPoller[_models.RecoveryPlan]: + """Execute commit failover of the recovery plan. + + The operation to commit the failover of a recovery plan. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param recovery_plan_name: Name of the recovery plan. Required. + :type recovery_plan_name: str + :return: An instance of LROPoller that returns RecoveryPlan. The RecoveryPlan is compatible + with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.RecoveryPlan] = 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._failover_commit_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + recovery_plan_name=recovery_plan_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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.RecoveryPlan, 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.RecoveryPlan].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.RecoveryPlan]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _planned_failover_initial( + self, + resource_group_name: str, + resource_name: str, + recovery_plan_name: str, + input: Union[_models.RecoveryPlanPlannedFailoverInput, JSON, 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(input, (IOBase, bytes)): + _content = input + else: + _content = json.dumps(input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_recovery_plans_planned_failover_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + recovery_plan_name=recovery_plan_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) + raise HttpResponseError(response=response, 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")) + + 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_planned_failover( + self, + resource_group_name: str, + resource_name: str, + recovery_plan_name: str, + input: _models.RecoveryPlanPlannedFailoverInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RecoveryPlan]: + """Execute planned failover of the recovery plan. + + The operation to start the planned failover of a recovery plan. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param recovery_plan_name: Name of the recovery plan. Required. + :type recovery_plan_name: str + :param input: Failover input. Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanPlannedFailoverInput + :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 RecoveryPlan. The RecoveryPlan is compatible + with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_planned_failover( + self, + resource_group_name: str, + resource_name: str, + recovery_plan_name: str, + input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RecoveryPlan]: + """Execute planned failover of the recovery plan. + + The operation to start the planned failover of a recovery plan. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param recovery_plan_name: Name of the recovery plan. Required. + :type recovery_plan_name: str + :param input: Failover input. Required. + :type input: JSON + :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 RecoveryPlan. The RecoveryPlan is compatible + with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_planned_failover( + self, + resource_group_name: str, + resource_name: str, + recovery_plan_name: str, + input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RecoveryPlan]: + """Execute planned failover of the recovery plan. + + The operation to start the planned failover of a recovery plan. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param recovery_plan_name: Name of the recovery plan. Required. + :type recovery_plan_name: str + :param input: Failover input. Required. + :type input: 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 RecoveryPlan. The RecoveryPlan is compatible + with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_planned_failover( + self, + resource_group_name: str, + resource_name: str, + recovery_plan_name: str, + input: Union[_models.RecoveryPlanPlannedFailoverInput, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.RecoveryPlan]: + """Execute planned failover of the recovery plan. + + The operation to start the planned failover of a recovery plan. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param recovery_plan_name: Name of the recovery plan. Required. + :type recovery_plan_name: str + :param input: Failover input. Is one of the following types: RecoveryPlanPlannedFailoverInput, + JSON, IO[bytes] Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanPlannedFailoverInput + or JSON or IO[bytes] + :return: An instance of LROPoller that returns RecoveryPlan. The RecoveryPlan is compatible + with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :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.RecoveryPlan] = 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._planned_failover_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + recovery_plan_name=recovery_plan_name, + input=input, + 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.RecoveryPlan, 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.RecoveryPlan].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.RecoveryPlan]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _reprotect_initial( + self, resource_group_name: str, resource_name: str, recovery_plan_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_replication_recovery_plans_reprotect_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + recovery_plan_name=recovery_plan_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) + raise HttpResponseError(response=response, 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")) + + 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_reprotect( + self, resource_group_name: str, resource_name: str, recovery_plan_name: str, **kwargs: Any + ) -> LROPoller[_models.RecoveryPlan]: + """Execute reprotect of the recovery plan. + + The operation to reprotect(reverse replicate) a recovery plan. This api is for deprecated + scenarios and no longer works. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param recovery_plan_name: Name of the recovery plan. Required. + :type recovery_plan_name: str + :return: An instance of LROPoller that returns RecoveryPlan. The RecoveryPlan is compatible + with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.RecoveryPlan] = 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._reprotect_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + recovery_plan_name=recovery_plan_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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.RecoveryPlan, 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.RecoveryPlan].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.RecoveryPlan]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _test_failover_initial( + self, + resource_group_name: str, + resource_name: str, + recovery_plan_name: str, + input: Union[_models.RecoveryPlanTestFailoverInput, JSON, 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(input, (IOBase, bytes)): + _content = input + else: + _content = json.dumps(input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_recovery_plans_test_failover_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + recovery_plan_name=recovery_plan_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) + raise HttpResponseError(response=response, 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")) + + 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_test_failover( + self, + resource_group_name: str, + resource_name: str, + recovery_plan_name: str, + input: _models.RecoveryPlanTestFailoverInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RecoveryPlan]: + """Execute test failover of the recovery plan. + + The operation to start the test failover of a recovery plan. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param recovery_plan_name: Name of the recovery plan. Required. + :type recovery_plan_name: str + :param input: Recovery plan test failover input. Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanTestFailoverInput + :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 RecoveryPlan. The RecoveryPlan is compatible + with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_test_failover( + self, + resource_group_name: str, + resource_name: str, + recovery_plan_name: str, + input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RecoveryPlan]: + """Execute test failover of the recovery plan. + + The operation to start the test failover of a recovery plan. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param recovery_plan_name: Name of the recovery plan. Required. + :type recovery_plan_name: str + :param input: Recovery plan test failover input. Required. + :type input: JSON + :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 RecoveryPlan. The RecoveryPlan is compatible + with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_test_failover( + self, + resource_group_name: str, + resource_name: str, + recovery_plan_name: str, + input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RecoveryPlan]: + """Execute test failover of the recovery plan. + + The operation to start the test failover of a recovery plan. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param recovery_plan_name: Name of the recovery plan. Required. + :type recovery_plan_name: str + :param input: Recovery plan test failover input. Required. + :type input: 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 RecoveryPlan. The RecoveryPlan is compatible + with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_test_failover( + self, + resource_group_name: str, + resource_name: str, + recovery_plan_name: str, + input: Union[_models.RecoveryPlanTestFailoverInput, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.RecoveryPlan]: + """Execute test failover of the recovery plan. + + The operation to start the test failover of a recovery plan. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param recovery_plan_name: Name of the recovery plan. Required. + :type recovery_plan_name: str + :param input: Recovery plan test failover input. Is one of the following types: + RecoveryPlanTestFailoverInput, JSON, IO[bytes] Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanTestFailoverInput or + JSON or IO[bytes] + :return: An instance of LROPoller that returns RecoveryPlan. The RecoveryPlan is compatible + with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :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.RecoveryPlan] = 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._test_failover_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + recovery_plan_name=recovery_plan_name, + input=input, + 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.RecoveryPlan, 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.RecoveryPlan].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.RecoveryPlan]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _test_failover_cleanup_initial( + self, + resource_group_name: str, + resource_name: str, + recovery_plan_name: str, + input: Union[_models.RecoveryPlanTestFailoverCleanupInput, JSON, 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(input, (IOBase, bytes)): + _content = input + else: + _content = json.dumps(input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_recovery_plans_test_failover_cleanup_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + recovery_plan_name=recovery_plan_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) + raise HttpResponseError(response=response, 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")) + + 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_test_failover_cleanup( + self, + resource_group_name: str, + resource_name: str, + recovery_plan_name: str, + input: _models.RecoveryPlanTestFailoverCleanupInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RecoveryPlan]: + """Execute test failover cleanup of the recovery plan. + + The operation to cleanup test failover of a recovery plan. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param recovery_plan_name: Name of the recovery plan. Required. + :type recovery_plan_name: str + :param input: Recovery plan test failover cleanup input. Required. + :type input: + ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanTestFailoverCleanupInput + :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 RecoveryPlan. The RecoveryPlan is compatible + with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_test_failover_cleanup( + self, + resource_group_name: str, + resource_name: str, + recovery_plan_name: str, + input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RecoveryPlan]: + """Execute test failover cleanup of the recovery plan. + + The operation to cleanup test failover of a recovery plan. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param recovery_plan_name: Name of the recovery plan. Required. + :type recovery_plan_name: str + :param input: Recovery plan test failover cleanup input. Required. + :type input: JSON + :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 RecoveryPlan. The RecoveryPlan is compatible + with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_test_failover_cleanup( + self, + resource_group_name: str, + resource_name: str, + recovery_plan_name: str, + input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RecoveryPlan]: + """Execute test failover cleanup of the recovery plan. + + The operation to cleanup test failover of a recovery plan. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param recovery_plan_name: Name of the recovery plan. Required. + :type recovery_plan_name: str + :param input: Recovery plan test failover cleanup input. Required. + :type input: 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 RecoveryPlan. The RecoveryPlan is compatible + with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_test_failover_cleanup( + self, + resource_group_name: str, + resource_name: str, + recovery_plan_name: str, + input: Union[_models.RecoveryPlanTestFailoverCleanupInput, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.RecoveryPlan]: + """Execute test failover cleanup of the recovery plan. + + The operation to cleanup test failover of a recovery plan. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param recovery_plan_name: Name of the recovery plan. Required. + :type recovery_plan_name: str + :param input: Recovery plan test failover cleanup input. Is one of the following types: + RecoveryPlanTestFailoverCleanupInput, JSON, IO[bytes] Required. + :type input: + ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanTestFailoverCleanupInput or JSON or + IO[bytes] + :return: An instance of LROPoller that returns RecoveryPlan. The RecoveryPlan is compatible + with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :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.RecoveryPlan] = 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._test_failover_cleanup_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + recovery_plan_name=recovery_plan_name, + input=input, + 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.RecoveryPlan, 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.RecoveryPlan].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.RecoveryPlan]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _unplanned_failover_initial( + self, + resource_group_name: str, + resource_name: str, + recovery_plan_name: str, + input: Union[_models.RecoveryPlanUnplannedFailoverInput, JSON, 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(input, (IOBase, bytes)): + _content = input + else: + _content = json.dumps(input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_recovery_plans_unplanned_failover_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + recovery_plan_name=recovery_plan_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) + raise HttpResponseError(response=response, 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")) + + 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_unplanned_failover( + self, + resource_group_name: str, + resource_name: str, + recovery_plan_name: str, + input: _models.RecoveryPlanUnplannedFailoverInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RecoveryPlan]: + """Execute unplanned failover of the recovery plan. + + The operation to start the unplanned failover of a recovery plan. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param recovery_plan_name: Name of the recovery plan. Required. + :type recovery_plan_name: str + :param input: Recovery plan unplanned failover input. Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanUnplannedFailoverInput + :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 RecoveryPlan. The RecoveryPlan is compatible + with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_unplanned_failover( + self, + resource_group_name: str, + resource_name: str, + recovery_plan_name: str, + input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RecoveryPlan]: + """Execute unplanned failover of the recovery plan. + + The operation to start the unplanned failover of a recovery plan. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param recovery_plan_name: Name of the recovery plan. Required. + :type recovery_plan_name: str + :param input: Recovery plan unplanned failover input. Required. + :type input: JSON + :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 RecoveryPlan. The RecoveryPlan is compatible + with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_unplanned_failover( + self, + resource_group_name: str, + resource_name: str, + recovery_plan_name: str, + input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RecoveryPlan]: + """Execute unplanned failover of the recovery plan. + + The operation to start the unplanned failover of a recovery plan. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param recovery_plan_name: Name of the recovery plan. Required. + :type recovery_plan_name: str + :param input: Recovery plan unplanned failover input. Required. + :type input: 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 RecoveryPlan. The RecoveryPlan is compatible + with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_unplanned_failover( + self, + resource_group_name: str, + resource_name: str, + recovery_plan_name: str, + input: Union[_models.RecoveryPlanUnplannedFailoverInput, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.RecoveryPlan]: + """Execute unplanned failover of the recovery plan. + + The operation to start the unplanned failover of a recovery plan. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param recovery_plan_name: Name of the recovery plan. Required. + :type recovery_plan_name: str + :param input: Recovery plan unplanned failover input. Is one of the following types: + RecoveryPlanUnplannedFailoverInput, JSON, IO[bytes] Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanUnplannedFailoverInput + or JSON or IO[bytes] + :return: An instance of LROPoller that returns RecoveryPlan. The RecoveryPlan is compatible + with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] + :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.RecoveryPlan] = 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._unplanned_failover_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + recovery_plan_name=recovery_plan_name, + input=input, + 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.RecoveryPlan, 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.RecoveryPlan].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.RecoveryPlan]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + +class ReplicationVaultSettingOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.SiteRecoveryManagementClient`'s + :attr:`replication_vault_setting` 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: SiteRecoveryManagementClientConfiguration = ( + 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, resource_name: str, vault_setting_name: str, **kwargs: Any + ) -> _models.VaultSetting: + """Gets the vault setting. + + Gets the vault setting. This includes the Migration Hub connection settings. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param vault_setting_name: Vault setting name. Required. + :type vault_setting_name: str + :return: VaultSetting. The VaultSetting is compatible with MutableMapping + :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.VaultSetting + :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.VaultSetting] = kwargs.pop("cls", None) + + _request = build_replication_vault_setting_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + vault_setting_name=vault_setting_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.VaultSetting, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_initial( + self, + resource_group_name: str, + resource_name: str, + vault_setting_name: str, + input: Union[_models.VaultSettingCreationInput, JSON, 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(input, (IOBase, bytes)): + _content = input + else: + _content = json.dumps(input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replication_vault_setting_create_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + vault_setting_name=vault_setting_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]: + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + 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, + resource_name: str, + vault_setting_name: str, + input: _models.VaultSettingCreationInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VaultSetting]: + """Updates vault setting. A vault setting object is a singleton per vault and it is always present + by default. + + The operation to configure vault setting. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param vault_setting_name: Vault setting name. Required. + :type vault_setting_name: str + :param input: Vault setting creation input. Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.VaultSettingCreationInput + :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 VaultSetting. The VaultSetting is compatible + with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.VaultSetting] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + resource_name: str, + vault_setting_name: str, + input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VaultSetting]: + """Updates vault setting. A vault setting object is a singleton per vault and it is always present + by default. + + The operation to configure vault setting. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param vault_setting_name: Vault setting name. Required. + :type vault_setting_name: str + :param input: Vault setting creation input. Required. + :type input: JSON + :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 VaultSetting. The VaultSetting is compatible + with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.VaultSetting] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + resource_name: str, + vault_setting_name: str, + input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VaultSetting]: + """Updates vault setting. A vault setting object is a singleton per vault and it is always present + by default. + + The operation to configure vault setting. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param vault_setting_name: Vault setting name. Required. + :type vault_setting_name: str + :param input: Vault setting creation input. Required. + :type input: 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 VaultSetting. The VaultSetting is compatible + with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.VaultSetting] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + resource_name: str, + vault_setting_name: str, + input: Union[_models.VaultSettingCreationInput, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.VaultSetting]: + """Updates vault setting. A vault setting object is a singleton per vault and it is always present + by default. + + The operation to configure vault setting. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Vault. Required. + :type resource_name: str + :param vault_setting_name: Vault setting name. Required. + :type vault_setting_name: str + :param input: Vault setting creation input. Is one of the following types: + VaultSettingCreationInput, JSON, IO[bytes] Required. + :type input: ~azure.mgmt.recoveryservicessiterecovery.models.VaultSettingCreationInput or JSON + or IO[bytes] + :return: An instance of LROPoller that returns VaultSetting. The VaultSetting is compatible + with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.VaultSetting] + :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.VaultSetting] = 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, + resource_name=resource_name, + vault_setting_name=vault_setting_name, + input=input, + 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["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.VaultSetting, 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.VaultSetting].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.VaultSetting]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> ItemPaged["_models.VaultSetting"]: + """Gets the list of vault setting. + + Gets the list of vault setting. This includes the Migration Hub connection settings. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :return: An iterator like instance of VaultSetting + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.VaultSetting] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.VaultSetting]] = 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_replication_vault_setting_list_request( + resource_group_name=resource_group_name, + resource_name=resource_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) - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + 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 + ) + 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) - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return _request - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.VaultSetting], + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) class Operations: @@ -75,9 +31701,7 @@ class Operations: :attr:`operations` attribute. """ - models = _models - - def __init__(self, *args, **kwargs): + 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: SiteRecoveryManagementClientConfiguration = ( @@ -87,21 +31711,142 @@ def __init__(self, *args, **kwargs): self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.OperationsDiscovery"]: + def list(self, resource_group_name: str, **kwargs: Any) -> ItemPaged["_models.OperationsDiscovery"]: """Returns the list of available operations. Operation to return the list of available operations. - :return: An iterator like instance of either OperationsDiscovery or the result of cls(response) + :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 OperationsDiscovery :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.OperationsDiscovery] :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.OperationsDiscovery]] = 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( + 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), 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.OperationsDiscovery], + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class ReplicationAppliancesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.SiteRecoveryManagementClient`'s + :attr:`replication_appliances` 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: SiteRecoveryManagementClientConfiguration = ( + 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, resource_group_name: str, resource_name: str, *, filter: Optional[str] = None, **kwargs: Any + ) -> ItemPaged["_models.ReplicationAppliance"]: + """Gets the list of appliances. + + Gets the list of Azure Site Recovery appliances for the vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :keyword filter: OData filter options. Default value is None. + :paramtype filter: str + :return: An iterator like instance of ReplicationAppliance + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationAppliance] + :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.OperationsDiscoveryCollection] = kwargs.pop("cls", None) + cls: ClsType[List[_models.ReplicationAppliance]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -114,14 +31859,21 @@ def list(self, **kwargs: Any) -> Iterable["_models.OperationsDiscovery"]: def prepare_request(next_link=None): if not next_link: - _request = build_list_request( - resource_group_name=self._config.resource_group_name, + _request = build_replication_appliances_list_request( + resource_group_name=resource_group_name, + resource_name=resource_name, subscription_id=self._config.subscription_id, - api_version=api_version, + filter=filter, + 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 @@ -136,16 +31888,24 @@ def prepare_request(next_link=None): _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" + 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("OperationsDiscoveryCollection", pipeline_response) - list_of_elem = deserialized.value + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.ReplicationAppliance], + 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) @@ -163,3 +31923,312 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) + + +class SupportedOperatingSystemsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.SiteRecoveryManagementClient`'s + :attr:`supported_operating_systems` 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: SiteRecoveryManagementClientConfiguration = ( + 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, resource_name: str, *, instance_type: Optional[str] = None, **kwargs: Any + ) -> _models.SupportedOperatingSystems: + """Gets the data of supported operating systems by SRS. + + Gets the data of supported operating systems by SRS. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :keyword instance_type: The instance type. Default value is None. + :paramtype instance_type: str + :return: SupportedOperatingSystems. The SupportedOperatingSystems is compatible with + MutableMapping + :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.SupportedOperatingSystems + :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.SupportedOperatingSystems] = kwargs.pop("cls", None) + + _request = build_supported_operating_systems_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + instance_type=instance_type, + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.SupportedOperatingSystems, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class ReplicationVaultHealthOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicessiterecovery.SiteRecoveryManagementClient`'s + :attr:`replication_vault_health` 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: SiteRecoveryManagementClientConfiguration = ( + 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, resource_name: str, **kwargs: Any) -> _models.VaultHealthDetails: + """Gets the health summary for the vault. + + Gets the health details of the vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :return: VaultHealthDetails. The VaultHealthDetails is compatible with MutableMapping + :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.VaultHealthDetails + :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.VaultHealthDetails] = kwargs.pop("cls", None) + + _request = build_replication_vault_health_get_request( + resource_group_name=resource_group_name, + resource_name=resource_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.VaultHealthDetails, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _refresh_initial(self, resource_group_name: str, resource_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_replication_vault_health_refresh_request( + resource_group_name=resource_group_name, + resource_name=resource_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) + raise HttpResponseError(response=response, 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")) + + 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_refresh( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> LROPoller[_models.VaultHealthDetails]: + """Refreshes health summary of the vault. + + Refreshes health summary of the vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the recovery services vault. Required. + :type resource_name: str + :return: An instance of LROPoller that returns VaultHealthDetails. The VaultHealthDetails is + compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.VaultHealthDetails] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.VaultHealthDetails] = 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._refresh_initial( + resource_group_name=resource_group_name, + resource_name=resource_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): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.VaultHealthDetails, 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.VaultHealthDetails].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.VaultHealthDetails]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_patch.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_patch.py index f7dd32510333..87676c65a8f0 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_patch.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_patch.py @@ -1,14 +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/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_recovery_points_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_recovery_points_operations.py deleted file mode 100644 index 5796c9bd039a..000000000000 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_recovery_points_operations.py +++ /dev/null @@ -1,306 +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, Dict, Iterable, 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 SiteRecoveryManagementClientConfiguration -from .._serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_replication_protected_items_request( # pylint: disable=name-too-long - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - resource_group_name: str, - resource_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", "2025-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/recoveryPoints", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), - "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), - "replicatedProtectedItemName": _SERIALIZER.url( - "replicated_protected_item_name", replicated_protected_item_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( - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - recovery_point_name: str, - resource_group_name: str, - resource_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", "2025-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/recoveryPoints/{recoveryPointName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), - "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), - "replicatedProtectedItemName": _SERIALIZER.url( - "replicated_protected_item_name", replicated_protected_item_name, "str" - ), - "recoveryPointName": _SERIALIZER.url("recovery_point_name", recovery_point_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 RecoveryPointsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicessiterecovery.SiteRecoveryManagementClient`'s - :attr:`recovery_points` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: SiteRecoveryManagementClientConfiguration = ( - 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_replication_protected_items( - self, fabric_name: str, protection_container_name: str, replicated_protected_item_name: str, **kwargs: Any - ) -> Iterable["_models.RecoveryPoint"]: - """Gets the list of recovery points for a replication protected item. - - Lists the available recovery points for a replication protected item. - - :param fabric_name: The fabric name. Required. - :type fabric_name: str - :param protection_container_name: The protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: The replication protected item name. Required. - :type replicated_protected_item_name: str - :return: An iterator like instance of either RecoveryPoint or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPoint] - :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.RecoveryPointCollection] = 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_replication_protected_items_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replicated_protected_item_name=replicated_protected_item_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("RecoveryPointCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - recovery_point_name: str, - **kwargs: Any - ) -> _models.RecoveryPoint: - """Gets a recovery point. - - Get the details of specified recovery point. - - :param fabric_name: The fabric name. Required. - :type fabric_name: str - :param protection_container_name: The protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: The replication protected item name. Required. - :type replicated_protected_item_name: str - :param recovery_point_name: The recovery point name. Required. - :type recovery_point_name: str - :return: RecoveryPoint or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPoint - :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.RecoveryPoint] = kwargs.pop("cls", None) - - _request = build_get_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replicated_protected_item_name=replicated_protected_item_name, - recovery_point_name=recovery_point_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("RecoveryPoint", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_alert_settings_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_alert_settings_operations.py deleted file mode 100644 index 1b7e2cac6d1e..000000000000 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_alert_settings_operations.py +++ /dev/null @@ -1,409 +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, Dict, IO, Iterable, 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 SiteRecoveryManagementClientConfiguration -from .._serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request( - resource_group_name: str, resource_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", "2025-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationAlertSettings", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "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_get_request( - alert_setting_name: str, resource_group_name: str, resource_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", "2025-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationAlertSettings/{alertSettingName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "alertSettingName": _SERIALIZER.url("alert_setting_name", alert_setting_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( - alert_setting_name: str, resource_group_name: str, resource_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", "2025-01-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.RecoveryServices/vaults/{resourceName}/replicationAlertSettings/{alertSettingName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "alertSettingName": _SERIALIZER.url("alert_setting_name", alert_setting_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) - - -class ReplicationAlertSettingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicessiterecovery.SiteRecoveryManagementClient`'s - :attr:`replication_alert_settings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: SiteRecoveryManagementClientConfiguration = ( - 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) -> Iterable["_models.Alert"]: - """Gets the list of configured email notification(alert) configurations. - - Gets the list of email notification(alert) configurations for the vault. - - :return: An iterator like instance of either Alert or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.Alert] - :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.AlertCollection] = 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_request( - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("AlertCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get(self, alert_setting_name: str, **kwargs: Any) -> _models.Alert: - """Gets an email notification(alert) configuration. - - Gets the details of the specified email notification(alert) configuration. - - :param alert_setting_name: The name of the email notification configuration. Required. - :type alert_setting_name: str - :return: Alert or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.Alert - :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.Alert] = kwargs.pop("cls", None) - - _request = build_get_request( - alert_setting_name=alert_setting_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("Alert", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def create( - self, - alert_setting_name: str, - request: _models.ConfigureAlertRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Alert: - """Configures email notifications for this vault. - - Create or update an email notification(alert) configuration. - - :param alert_setting_name: The name of the email notification(alert) configuration. Required. - :type alert_setting_name: str - :param request: The input to configure the email notification(alert). Required. - :type request: ~azure.mgmt.recoveryservicessiterecovery.models.ConfigureAlertRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Alert or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.Alert - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create( - self, alert_setting_name: str, request: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Alert: - """Configures email notifications for this vault. - - Create or update an email notification(alert) configuration. - - :param alert_setting_name: The name of the email notification(alert) configuration. Required. - :type alert_setting_name: str - :param request: The input to configure the email notification(alert). Required. - :type request: 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: Alert or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.Alert - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create( - self, alert_setting_name: str, request: Union[_models.ConfigureAlertRequest, IO[bytes]], **kwargs: Any - ) -> _models.Alert: - """Configures email notifications for this vault. - - Create or update an email notification(alert) configuration. - - :param alert_setting_name: The name of the email notification(alert) configuration. Required. - :type alert_setting_name: str - :param request: The input to configure the email notification(alert). Is either a - ConfigureAlertRequest type or a IO[bytes] type. Required. - :type request: ~azure.mgmt.recoveryservicessiterecovery.models.ConfigureAlertRequest or - IO[bytes] - :return: Alert or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.Alert - :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.Alert] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(request, (IOBase, bytes)): - _content = request - else: - _json = self._serialize.body(request, "ConfigureAlertRequest") - - _request = build_create_request( - alert_setting_name=alert_setting_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("Alert", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_appliances_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_appliances_operations.py deleted file mode 100644 index 42ffd0421940..000000000000 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_appliances_operations.py +++ /dev/null @@ -1,175 +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, Dict, Iterable, 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 SiteRecoveryManagementClientConfiguration -from .._serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request( - resource_group_name: str, resource_name: str, subscription_id: str, *, filter: Optional[str] = None, **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", "2025-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationAppliances", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "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") - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class ReplicationAppliancesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicessiterecovery.SiteRecoveryManagementClient`'s - :attr:`replication_appliances` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: SiteRecoveryManagementClientConfiguration = ( - 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, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models.ReplicationAppliance"]: - """Gets the list of appliances. - - Gets the list of Azure Site Recovery appliances for the vault. - - :param filter: OData filter options. Default value is None. - :type filter: str - :return: An iterator like instance of either ReplicationAppliance or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationAppliance] - :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.ApplianceCollection] = 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_request( - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_name, - subscription_id=self._config.subscription_id, - filter=filter, - 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("ApplianceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_eligibility_results_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_eligibility_results_operations.py deleted file mode 100644 index 8a4cd0af212a..000000000000 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_eligibility_results_operations.py +++ /dev/null @@ -1,227 +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, Dict, 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 SiteRecoveryManagementClientConfiguration -from .._serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request( - virtual_machine_name: str, 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", "2025-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{virtualMachineName}/providers/Microsoft.RecoveryServices/replicationEligibilityResults", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_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( - virtual_machine_name: str, 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", "2025-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{virtualMachineName}/providers/Microsoft.RecoveryServices/replicationEligibilityResults/default", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_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 ReplicationEligibilityResultsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicessiterecovery.SiteRecoveryManagementClient`'s - :attr:`replication_eligibility_results` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: SiteRecoveryManagementClientConfiguration = ( - 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, virtual_machine_name: str, **kwargs: Any) -> _models.ReplicationEligibilityResultsCollection: - """Gets the validation errors in case the VM is unsuitable for protection. - - Validates whether a given VM can be protected or not in which case returns list of errors. - - :param virtual_machine_name: Virtual Machine name. Required. - :type virtual_machine_name: str - :return: ReplicationEligibilityResultsCollection or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationEligibilityResultsCollection - :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.ReplicationEligibilityResultsCollection] = kwargs.pop("cls", None) - - _request = build_list_request( - virtual_machine_name=virtual_machine_name, - resource_group_name=self._config.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) - - _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("ReplicationEligibilityResultsCollection", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def get(self, virtual_machine_name: str, **kwargs: Any) -> _models.ReplicationEligibilityResults: - """Gets the validation errors in case the VM is unsuitable for protection. - - Validates whether a given VM can be protected or not in which case returns list of errors. - - :param virtual_machine_name: Virtual Machine name. Required. - :type virtual_machine_name: str - :return: ReplicationEligibilityResults or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationEligibilityResults - :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.ReplicationEligibilityResults] = kwargs.pop("cls", None) - - _request = build_get_request( - virtual_machine_name=virtual_machine_name, - resource_group_name=self._config.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) - - _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("ReplicationEligibilityResults", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_events_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_events_operations.py deleted file mode 100644 index 732bdc5893bd..000000000000 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_events_operations.py +++ /dev/null @@ -1,260 +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, Dict, Iterable, 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 SiteRecoveryManagementClientConfiguration -from .._serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request( - resource_group_name: str, resource_name: str, subscription_id: str, *, filter: Optional[str] = None, **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", "2025-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationEvents", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "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") - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "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( - event_name: str, resource_group_name: str, resource_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", "2025-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationEvents/{eventName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "eventName": _SERIALIZER.url("event_name", event_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 ReplicationEventsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicessiterecovery.SiteRecoveryManagementClient`'s - :attr:`replication_events` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: SiteRecoveryManagementClientConfiguration = ( - 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, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models.Event"]: - """Gets the list of Azure Site Recovery events. - - Gets the list of Azure Site Recovery events for the vault. - - :param filter: OData filter options. Default value is None. - :type filter: str - :return: An iterator like instance of either Event or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.Event] - :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.EventCollection] = 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_request( - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_name, - subscription_id=self._config.subscription_id, - filter=filter, - 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("EventCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get(self, event_name: str, **kwargs: Any) -> _models.Event: - """Get the details of an Azure Site recovery event. - - The operation to get the details of an Azure Site recovery event. - - :param event_name: The name of the Azure Site Recovery event. Required. - :type event_name: str - :return: Event or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.Event - :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.Event] = kwargs.pop("cls", None) - - _request = build_get_request( - event_name=event_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("Event", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_fabrics_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_fabrics_operations.py deleted file mode 100644 index 9430707e3da5..000000000000 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_fabrics_operations.py +++ /dev/null @@ -1,1562 +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, Dict, IO, Iterable, 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 SiteRecoveryManagementClientConfiguration -from .._serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request( - resource_group_name: str, resource_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", "2025-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "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_get_request( - fabric_name: str, - resource_group_name: str, - resource_name: str, - subscription_id: str, - *, - filter: Optional[str] = None, - **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", "2025-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "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( - fabric_name: str, resource_group_name: str, resource_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", "2025-01-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url("fabric_name", fabric_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_purge_request( - fabric_name: str, resource_group_name: str, resource_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", "2025-01-01")) - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url("fabric_name", fabric_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_check_consistency_request( - fabric_name: str, resource_group_name: str, resource_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", "2025-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/checkConsistency", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url("fabric_name", fabric_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_migrate_to_aad_request( - fabric_name: str, resource_group_name: str, resource_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", "2025-01-01")) - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/migratetoaad", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url("fabric_name", fabric_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_reassociate_gateway_request( - fabric_name: str, resource_group_name: str, resource_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", "2025-01-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/reassociateGateway", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url("fabric_name", fabric_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_delete_request( - fabric_name: str, resource_group_name: str, resource_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", "2025-01-01")) - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/remove", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url("fabric_name", fabric_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_renew_certificate_request( - fabric_name: str, resource_group_name: str, resource_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", "2025-01-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/renewCertificate", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url("fabric_name", fabric_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_remove_infra_request( - resource_name: str, fabric_name: str, 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", "2025-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/removeInfra", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceName": _SERIALIZER.url( - "resource_name", resource_name, "str", pattern=r"^[A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9]$" - ), - "fabricName": _SERIALIZER.url( - "fabric_name", fabric_name, "str", pattern=r"^[A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9]$" - ), - } - - _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 ReplicationFabricsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicessiterecovery.SiteRecoveryManagementClient`'s - :attr:`replication_fabrics` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: SiteRecoveryManagementClientConfiguration = ( - 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) -> Iterable["_models.Fabric"]: - """Gets the list of ASR fabrics. - - Gets a list of the Azure Site Recovery fabrics in the vault. - - :return: An iterator like instance of either Fabric or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.Fabric] - :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.FabricCollection] = 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_request( - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("FabricCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get(self, fabric_name: str, filter: Optional[str] = None, **kwargs: Any) -> _models.Fabric: - """Gets the details of an ASR fabric. - - Gets the details of an Azure Site Recovery fabric. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param filter: OData filter options. Default value is None. - :type filter: str - :return: Fabric or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.Fabric - :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.Fabric] = kwargs.pop("cls", None) - - _request = build_get_request( - fabric_name=fabric_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_name, - subscription_id=self._config.subscription_id, - filter=filter, - 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("Fabric", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_initial( - self, fabric_name: str, input: Union[_models.FabricCreationInput, 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(input, (IOBase, bytes)): - _content = input - else: - _json = self._serialize.body(input, "FabricCreationInput") - - _request = build_create_request( - fabric_name=fabric_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create( - self, - fabric_name: str, - input: _models.FabricCreationInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Fabric]: - """Creates an Azure Site Recovery fabric. - - The operation to create an Azure Site Recovery fabric (for e.g. Hyper-V site). - - :param fabric_name: Name of the ASR fabric. Required. - :type fabric_name: str - :param input: Fabric creation input. Required. - :type input: ~azure.mgmt.recoveryservicessiterecovery.models.FabricCreationInput - :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 Fabric or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Fabric] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create( - self, fabric_name: str, input: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.Fabric]: - """Creates an Azure Site Recovery fabric. - - The operation to create an Azure Site Recovery fabric (for e.g. Hyper-V site). - - :param fabric_name: Name of the ASR fabric. Required. - :type fabric_name: str - :param input: Fabric creation input. Required. - :type input: 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 Fabric or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Fabric] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create( - self, fabric_name: str, input: Union[_models.FabricCreationInput, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.Fabric]: - """Creates an Azure Site Recovery fabric. - - The operation to create an Azure Site Recovery fabric (for e.g. Hyper-V site). - - :param fabric_name: Name of the ASR fabric. Required. - :type fabric_name: str - :param input: Fabric creation input. Is either a FabricCreationInput type or a IO[bytes] type. - Required. - :type input: ~azure.mgmt.recoveryservicessiterecovery.models.FabricCreationInput or IO[bytes] - :return: An instance of LROPoller that returns either Fabric or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Fabric] - :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.Fabric] = 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( - fabric_name=fabric_name, - input=input, - 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("Fabric", 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.Fabric].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.Fabric]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _purge_initial(self, fabric_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_purge_request( - fabric_name=fabric_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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 [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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_purge(self, fabric_name: str, **kwargs: Any) -> LROPoller[None]: - """Purges the site. - - The operation to purge(force delete) an Azure Site Recovery fabric. - - :param fabric_name: ASR fabric to purge. Required. - :type fabric_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._purge_initial( - fabric_name=fabric_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 - - def _check_consistency_initial(self, fabric_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_check_consistency_request( - fabric_name=fabric_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_check_consistency(self, fabric_name: str, **kwargs: Any) -> LROPoller[_models.Fabric]: - """Checks the consistency of the ASR fabric. - - The operation to perform a consistency check on the fabric. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :return: An instance of LROPoller that returns either Fabric or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Fabric] - :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.Fabric] = 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._check_consistency_initial( - fabric_name=fabric_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): - deserialized = self._deserialize("Fabric", 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.Fabric].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.Fabric]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _migrate_to_aad_initial(self, fabric_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_migrate_to_aad_request( - fabric_name=fabric_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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 [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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_migrate_to_aad(self, fabric_name: str, **kwargs: Any) -> LROPoller[None]: - """Migrates the site to AAD. - - The operation to migrate an Azure Site Recovery fabric to AAD. - - :param fabric_name: ASR fabric to migrate. Required. - :type fabric_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._migrate_to_aad_initial( - fabric_name=fabric_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 - - def _reassociate_gateway_initial( - self, - fabric_name: str, - failover_process_server_request: Union[_models.FailoverProcessServerRequest, 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(failover_process_server_request, (IOBase, bytes)): - _content = failover_process_server_request - else: - _json = self._serialize.body(failover_process_server_request, "FailoverProcessServerRequest") - - _request = build_reassociate_gateway_request( - fabric_name=fabric_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_reassociate_gateway( - self, - fabric_name: str, - failover_process_server_request: _models.FailoverProcessServerRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Fabric]: - """Perform failover of the process server. - - The operation to move replications from a process server to another process server. - - :param fabric_name: The name of the fabric containing the process server. Required. - :type fabric_name: str - :param failover_process_server_request: The input to the failover process server operation. - Required. - :type failover_process_server_request: - ~azure.mgmt.recoveryservicessiterecovery.models.FailoverProcessServerRequest - :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 Fabric or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Fabric] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_reassociate_gateway( - self, - fabric_name: str, - failover_process_server_request: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Fabric]: - """Perform failover of the process server. - - The operation to move replications from a process server to another process server. - - :param fabric_name: The name of the fabric containing the process server. Required. - :type fabric_name: str - :param failover_process_server_request: The input to the failover process server operation. - Required. - :type failover_process_server_request: 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 Fabric or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Fabric] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_reassociate_gateway( - self, - fabric_name: str, - failover_process_server_request: Union[_models.FailoverProcessServerRequest, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.Fabric]: - """Perform failover of the process server. - - The operation to move replications from a process server to another process server. - - :param fabric_name: The name of the fabric containing the process server. Required. - :type fabric_name: str - :param failover_process_server_request: The input to the failover process server operation. Is - either a FailoverProcessServerRequest type or a IO[bytes] type. Required. - :type failover_process_server_request: - ~azure.mgmt.recoveryservicessiterecovery.models.FailoverProcessServerRequest or IO[bytes] - :return: An instance of LROPoller that returns either Fabric or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Fabric] - :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.Fabric] = 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._reassociate_gateway_initial( - fabric_name=fabric_name, - failover_process_server_request=failover_process_server_request, - 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("Fabric", 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.Fabric].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.Fabric]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial(self, fabric_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( - fabric_name=fabric_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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 [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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete(self, fabric_name: str, **kwargs: Any) -> LROPoller[None]: - """Deletes the site. - - The operation to delete or remove an Azure Site Recovery fabric. - - :param fabric_name: ASR fabric to delete. Required. - :type fabric_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( - fabric_name=fabric_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 - - def _renew_certificate_initial( - self, fabric_name: str, renew_certificate: Union[_models.RenewCertificateInput, 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(renew_certificate, (IOBase, bytes)): - _content = renew_certificate - else: - _json = self._serialize.body(renew_certificate, "RenewCertificateInput") - - _request = build_renew_certificate_request( - fabric_name=fabric_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_renew_certificate( - self, - fabric_name: str, - renew_certificate: _models.RenewCertificateInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Fabric]: - """Renews certificate for the fabric. - - Renews the connection certificate for the ASR replication fabric. - - :param fabric_name: fabric name to renew certs for. Required. - :type fabric_name: str - :param renew_certificate: Renew certificate input. Required. - :type renew_certificate: ~azure.mgmt.recoveryservicessiterecovery.models.RenewCertificateInput - :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 Fabric or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Fabric] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_renew_certificate( - self, fabric_name: str, renew_certificate: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.Fabric]: - """Renews certificate for the fabric. - - Renews the connection certificate for the ASR replication fabric. - - :param fabric_name: fabric name to renew certs for. Required. - :type fabric_name: str - :param renew_certificate: Renew certificate input. Required. - :type renew_certificate: 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 Fabric or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Fabric] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_renew_certificate( - self, fabric_name: str, renew_certificate: Union[_models.RenewCertificateInput, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.Fabric]: - """Renews certificate for the fabric. - - Renews the connection certificate for the ASR replication fabric. - - :param fabric_name: fabric name to renew certs for. Required. - :type fabric_name: str - :param renew_certificate: Renew certificate input. Is either a RenewCertificateInput type or a - IO[bytes] type. Required. - :type renew_certificate: ~azure.mgmt.recoveryservicessiterecovery.models.RenewCertificateInput - or IO[bytes] - :return: An instance of LROPoller that returns either Fabric or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Fabric] - :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.Fabric] = 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._renew_certificate_initial( - fabric_name=fabric_name, - renew_certificate=renew_certificate, - 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("Fabric", 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.Fabric].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.Fabric]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _remove_infra_initial(self, resource_name: str, fabric_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_remove_infra_request( - resource_name=resource_name, - fabric_name=fabric_name, - resource_group_name=self._config.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) - - _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 [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.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - 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_remove_infra(self, resource_name: str, fabric_name: str, **kwargs: Any) -> LROPoller[None]: - """Removes the appliance's infrastructure under the fabric. - - Removes the appliance's infrastructure under the fabric. - - :param resource_name: Resource name. Required. - :type resource_name: str - :param fabric_name: Fabric name. Required. - :type fabric_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._remove_infra_initial( - resource_name=resource_name, - fabric_name=fabric_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 diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_jobs_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_jobs_operations.py deleted file mode 100644 index a617a9aaaf72..000000000000 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_jobs_operations.py +++ /dev/null @@ -1,929 +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, Dict, IO, Iterable, 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 SiteRecoveryManagementClientConfiguration -from .._serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request( - resource_group_name: str, resource_name: str, subscription_id: str, *, filter: Optional[str] = None, **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", "2025-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "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") - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "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( - job_name: str, resource_group_name: str, resource_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", "2025-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs/{jobName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "jobName": _SERIALIZER.url("job_name", job_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_cancel_request( - job_name: str, resource_group_name: str, resource_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", "2025-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs/{jobName}/cancel", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "jobName": _SERIALIZER.url("job_name", job_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_restart_request( - job_name: str, resource_group_name: str, resource_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", "2025-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs/{jobName}/restart", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "jobName": _SERIALIZER.url("job_name", job_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_resume_request( - job_name: str, resource_group_name: str, resource_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", "2025-01-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.RecoveryServices/vaults/{resourceName}/replicationJobs/{jobName}/resume", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "jobName": _SERIALIZER.url("job_name", job_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_export_request( - resource_group_name: str, resource_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", "2025-01-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.RecoveryServices/vaults/{resourceName}/replicationJobs/export", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "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 - 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 ReplicationJobsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicessiterecovery.SiteRecoveryManagementClient`'s - :attr:`replication_jobs` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: SiteRecoveryManagementClientConfiguration = ( - 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, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models.Job"]: - """Gets the list of jobs. - - Gets the list of Azure Site Recovery Jobs for the vault. - - :param filter: OData filter options. Default value is None. - :type filter: str - :return: An iterator like instance of either Job or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.Job] - :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.JobCollection] = 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_request( - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_name, - subscription_id=self._config.subscription_id, - filter=filter, - 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("JobCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get(self, job_name: str, **kwargs: Any) -> _models.Job: - """Gets the job details. - - Get the details of an Azure Site Recovery job. - - :param job_name: Job identifier. Required. - :type job_name: str - :return: Job or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.Job - :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.Job] = kwargs.pop("cls", None) - - _request = build_get_request( - job_name=job_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("Job", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _cancel_initial(self, job_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_cancel_request( - job_name=job_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_cancel(self, job_name: str, **kwargs: Any) -> LROPoller[_models.Job]: - """Cancels the specified job. - - The operation to cancel an Azure Site Recovery job. - - :param job_name: Job identifier. Required. - :type job_name: str - :return: An instance of LROPoller that returns either Job or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Job] - :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.Job] = 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._cancel_initial( - job_name=job_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): - deserialized = self._deserialize("Job", 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.Job].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.Job](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _restart_initial(self, job_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_restart_request( - job_name=job_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_restart(self, job_name: str, **kwargs: Any) -> LROPoller[_models.Job]: - """Restarts the specified job. - - The operation to restart an Azure Site Recovery job. - - :param job_name: Job identifier. Required. - :type job_name: str - :return: An instance of LROPoller that returns either Job or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Job] - :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.Job] = 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._restart_initial( - job_name=job_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): - deserialized = self._deserialize("Job", 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.Job].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.Job](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _resume_initial( - self, job_name: str, resume_job_params: Union[_models.ResumeJobParams, 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(resume_job_params, (IOBase, bytes)): - _content = resume_job_params - else: - _json = self._serialize.body(resume_job_params, "ResumeJobParams") - - _request = build_resume_request( - job_name=job_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_resume( - self, - job_name: str, - resume_job_params: _models.ResumeJobParams, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Job]: - """Resumes the specified job. - - The operation to resume an Azure Site Recovery job. - - :param job_name: Job identifier. Required. - :type job_name: str - :param resume_job_params: Resume rob comments. Required. - :type resume_job_params: ~azure.mgmt.recoveryservicessiterecovery.models.ResumeJobParams - :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 Job or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Job] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_resume( - self, job_name: str, resume_job_params: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.Job]: - """Resumes the specified job. - - The operation to resume an Azure Site Recovery job. - - :param job_name: Job identifier. Required. - :type job_name: str - :param resume_job_params: Resume rob comments. Required. - :type resume_job_params: 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 Job or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Job] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_resume( - self, job_name: str, resume_job_params: Union[_models.ResumeJobParams, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.Job]: - """Resumes the specified job. - - The operation to resume an Azure Site Recovery job. - - :param job_name: Job identifier. Required. - :type job_name: str - :param resume_job_params: Resume rob comments. Is either a ResumeJobParams type or a IO[bytes] - type. Required. - :type resume_job_params: ~azure.mgmt.recoveryservicessiterecovery.models.ResumeJobParams or - IO[bytes] - :return: An instance of LROPoller that returns either Job or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Job] - :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.Job] = 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._resume_initial( - job_name=job_name, - resume_job_params=resume_job_params, - 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("Job", 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.Job].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.Job](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _export_initial( - self, job_query_parameter: Union[_models.JobQueryParameter, 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(job_query_parameter, (IOBase, bytes)): - _content = job_query_parameter - else: - _json = self._serialize.body(job_query_parameter, "JobQueryParameter") - - _request = build_export_request( - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_export( - self, job_query_parameter: _models.JobQueryParameter, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.Job]: - """Exports the details of the Azure Site Recovery jobs of the vault. - - The operation to export the details of the Azure Site Recovery jobs of the vault. - - :param job_query_parameter: job query filter. Required. - :type job_query_parameter: ~azure.mgmt.recoveryservicessiterecovery.models.JobQueryParameter - :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 Job or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Job] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_export( - self, job_query_parameter: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.Job]: - """Exports the details of the Azure Site Recovery jobs of the vault. - - The operation to export the details of the Azure Site Recovery jobs of the vault. - - :param job_query_parameter: job query filter. Required. - :type job_query_parameter: 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 Job or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Job] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_export( - self, job_query_parameter: Union[_models.JobQueryParameter, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.Job]: - """Exports the details of the Azure Site Recovery jobs of the vault. - - The operation to export the details of the Azure Site Recovery jobs of the vault. - - :param job_query_parameter: job query filter. Is either a JobQueryParameter type or a IO[bytes] - type. Required. - :type job_query_parameter: ~azure.mgmt.recoveryservicessiterecovery.models.JobQueryParameter or - IO[bytes] - :return: An instance of LROPoller that returns either Job or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Job] - :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.Job] = 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._export_initial( - job_query_parameter=job_query_parameter, - 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("Job", 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.Job].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.Job](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_logical_networks_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_logical_networks_operations.py deleted file mode 100644 index 434642c1afe6..000000000000 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_logical_networks_operations.py +++ /dev/null @@ -1,269 +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, Dict, Iterable, 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 SiteRecoveryManagementClientConfiguration -from .._serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_replication_fabrics_request( # pylint: disable=name-too-long - fabric_name: str, resource_group_name: str, resource_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", "2025-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationLogicalNetworks", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url("fabric_name", fabric_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( - fabric_name: str, - logical_network_name: str, - resource_group_name: str, - resource_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", "2025-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationLogicalNetworks/{logicalNetworkName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), - "logicalNetworkName": _SERIALIZER.url("logical_network_name", logical_network_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 ReplicationLogicalNetworksOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicessiterecovery.SiteRecoveryManagementClient`'s - :attr:`replication_logical_networks` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: SiteRecoveryManagementClientConfiguration = ( - 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_replication_fabrics(self, fabric_name: str, **kwargs: Any) -> Iterable["_models.LogicalNetwork"]: - """Gets the list of logical networks under a fabric. - - Lists all the logical networks of the Azure Site Recovery fabric. - - :param fabric_name: Server Id. Required. - :type fabric_name: str - :return: An iterator like instance of either LogicalNetwork or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.LogicalNetwork] - :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.LogicalNetworkCollection] = 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_replication_fabrics_request( - fabric_name=fabric_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("LogicalNetworkCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get(self, fabric_name: str, logical_network_name: str, **kwargs: Any) -> _models.LogicalNetwork: - """Gets a logical network with specified server id and logical network name. - - Gets the details of a logical network. - - :param fabric_name: Server Id. Required. - :type fabric_name: str - :param logical_network_name: Logical network name. Required. - :type logical_network_name: str - :return: LogicalNetwork or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.LogicalNetwork - :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.LogicalNetwork] = kwargs.pop("cls", None) - - _request = build_get_request( - fabric_name=fabric_name, - logical_network_name=logical_network_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("LogicalNetwork", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_migration_items_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_migration_items_operations.py deleted file mode 100644 index d9c94ded16fe..000000000000 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_migration_items_operations.py +++ /dev/null @@ -1,2666 +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, Dict, IO, Iterable, 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 SiteRecoveryManagementClientConfiguration -from .._serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_replication_protection_containers_request( # pylint: disable=name-too-long - fabric_name: str, - protection_container_name: str, - resource_group_name: str, - resource_name: str, - subscription_id: str, - *, - skip_token: Optional[str] = None, - take_token: Optional[str] = None, - filter: Optional[str] = None, - **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", "2025-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), - "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if skip_token is not None: - _params["skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") - if take_token is not None: - _params["takeToken"] = _SERIALIZER.query("take_token", take_token, "str") - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "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( - fabric_name: str, - protection_container_name: str, - migration_item_name: str, - resource_group_name: str, - resource_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", "2025-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), - "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), - "migrationItemName": _SERIALIZER.url("migration_item_name", migration_item_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( - fabric_name: str, - protection_container_name: str, - migration_item_name: str, - resource_group_name: str, - resource_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", "2025-01-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), - "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), - "migrationItemName": _SERIALIZER.url("migration_item_name", migration_item_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( - fabric_name: str, - protection_container_name: str, - migration_item_name: str, - resource_group_name: str, - resource_name: str, - subscription_id: str, - *, - delete_option: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01")) - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), - "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), - "migrationItemName": _SERIALIZER.url("migration_item_name", migration_item_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if delete_option is not None: - _params["deleteOption"] = _SERIALIZER.query("delete_option", delete_option, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) - - -def build_update_request( - fabric_name: str, - protection_container_name: str, - migration_item_name: str, - resource_group_name: str, - resource_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", "2025-01-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), - "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), - "migrationItemName": _SERIALIZER.url("migration_item_name", migration_item_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_migrate_request( - fabric_name: str, - protection_container_name: str, - migration_item_name: str, - resource_group_name: str, - resource_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", "2025-01-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/migrate", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), - "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), - "migrationItemName": _SERIALIZER.url("migration_item_name", migration_item_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_pause_replication_request( - fabric_name: str, - protection_container_name: str, - migration_item_name: str, - resource_group_name: str, - resource_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", "2025-01-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/pauseReplication", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), - "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), - "migrationItemName": _SERIALIZER.url("migration_item_name", migration_item_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_resume_replication_request( - fabric_name: str, - protection_container_name: str, - migration_item_name: str, - resource_group_name: str, - resource_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", "2025-01-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/resumeReplication", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), - "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), - "migrationItemName": _SERIALIZER.url("migration_item_name", migration_item_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_resync_request( - fabric_name: str, - protection_container_name: str, - migration_item_name: str, - resource_group_name: str, - resource_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", "2025-01-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/resync", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), - "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), - "migrationItemName": _SERIALIZER.url("migration_item_name", migration_item_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_test_migrate_request( - fabric_name: str, - protection_container_name: str, - migration_item_name: str, - resource_group_name: str, - resource_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", "2025-01-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/testMigrate", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), - "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), - "migrationItemName": _SERIALIZER.url("migration_item_name", migration_item_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_test_migrate_cleanup_request( - fabric_name: str, - protection_container_name: str, - migration_item_name: str, - resource_group_name: str, - resource_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", "2025-01-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/testMigrateCleanup", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), - "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), - "migrationItemName": _SERIALIZER.url("migration_item_name", migration_item_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_list_request( - resource_group_name: str, - resource_name: str, - subscription_id: str, - *, - skip_token: Optional[str] = None, - take_token: Optional[str] = None, - filter: Optional[str] = None, - **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", "2025-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationMigrationItems", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "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") - if skip_token is not None: - _params["skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") - if take_token is not None: - _params["takeToken"] = _SERIALIZER.query("take_token", take_token, "str") - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class ReplicationMigrationItemsOperations: # pylint: disable=too-many-public-methods - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicessiterecovery.SiteRecoveryManagementClient`'s - :attr:`replication_migration_items` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: SiteRecoveryManagementClientConfiguration = ( - 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_replication_protection_containers( # pylint: disable=name-too-long - self, - fabric_name: str, - protection_container_name: str, - skip_token: Optional[str] = None, - take_token: Optional[str] = None, - filter: Optional[str] = None, - **kwargs: Any - ) -> Iterable["_models.MigrationItem"]: - """Gets the list of migration items in the protection container. - - Gets the list of ASR migration items in the protection container. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param skip_token: The pagination token. Default value is None. - :type skip_token: str - :param take_token: The page size. Default value is None. - :type take_token: str - :param filter: OData filter options. Default value is None. - :type filter: str - :return: An iterator like instance of either MigrationItem or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] - :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.MigrationItemCollection] = 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_replication_protection_containers_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_name, - subscription_id=self._config.subscription_id, - skip_token=skip_token, - take_token=take_token, - filter=filter, - 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("MigrationItemCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get( - self, fabric_name: str, protection_container_name: str, migration_item_name: str, **kwargs: Any - ) -> _models.MigrationItem: - """Gets the details of a migration item. - - Gets the details of a migration item. - - :param fabric_name: Fabric unique name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param migration_item_name: Migration item name. Required. - :type migration_item_name: str - :return: MigrationItem or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem - :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.MigrationItem] = kwargs.pop("cls", None) - - _request = build_get_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - migration_item_name=migration_item_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("MigrationItem", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_initial( - self, - fabric_name: str, - protection_container_name: str, - migration_item_name: str, - input: Union[_models.EnableMigrationInput, 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(input, (IOBase, bytes)): - _content = input - else: - _json = self._serialize.body(input, "EnableMigrationInput") - - _request = build_create_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - migration_item_name=migration_item_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create( - self, - fabric_name: str, - protection_container_name: str, - migration_item_name: str, - input: _models.EnableMigrationInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.MigrationItem]: - """Enables migration. - - The operation to create an ASR migration item (enable migration). - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param migration_item_name: Migration item name. Required. - :type migration_item_name: str - :param input: Enable migration input. Required. - :type input: ~azure.mgmt.recoveryservicessiterecovery.models.EnableMigrationInput - :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 MigrationItem or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create( - self, - fabric_name: str, - protection_container_name: str, - migration_item_name: str, - input: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.MigrationItem]: - """Enables migration. - - The operation to create an ASR migration item (enable migration). - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param migration_item_name: Migration item name. Required. - :type migration_item_name: str - :param input: Enable migration input. Required. - :type input: 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 MigrationItem or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create( - self, - fabric_name: str, - protection_container_name: str, - migration_item_name: str, - input: Union[_models.EnableMigrationInput, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.MigrationItem]: - """Enables migration. - - The operation to create an ASR migration item (enable migration). - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param migration_item_name: Migration item name. Required. - :type migration_item_name: str - :param input: Enable migration input. Is either a EnableMigrationInput type or a IO[bytes] - type. Required. - :type input: ~azure.mgmt.recoveryservicessiterecovery.models.EnableMigrationInput or IO[bytes] - :return: An instance of LROPoller that returns either MigrationItem or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] - :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.MigrationItem] = 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( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - migration_item_name=migration_item_name, - input=input, - 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("MigrationItem", 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.MigrationItem].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.MigrationItem]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, - fabric_name: str, - protection_container_name: str, - migration_item_name: str, - delete_option: Optional[str] = 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 = 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( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - migration_item_name=migration_item_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_name, - subscription_id=self._config.subscription_id, - delete_option=delete_option, - 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 [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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, - fabric_name: str, - protection_container_name: str, - migration_item_name: str, - delete_option: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[None]: - """Delete the migration item. - - The operation to delete an ASR migration item. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param migration_item_name: Migration item name. Required. - :type migration_item_name: str - :param delete_option: The delete option. Default value is None. - :type delete_option: 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( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - migration_item_name=migration_item_name, - delete_option=delete_option, - 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 _update_initial( - self, - fabric_name: str, - protection_container_name: str, - migration_item_name: str, - input: Union[_models.UpdateMigrationItemInput, 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(input, (IOBase, bytes)): - _content = input - else: - _json = self._serialize.body(input, "UpdateMigrationItemInput") - - _request = build_update_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - migration_item_name=migration_item_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - fabric_name: str, - protection_container_name: str, - migration_item_name: str, - input: _models.UpdateMigrationItemInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.MigrationItem]: - """Updates migration item. - - The operation to update the recovery settings of an ASR migration item. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param migration_item_name: Migration item name. Required. - :type migration_item_name: str - :param input: Update migration item input. Required. - :type input: ~azure.mgmt.recoveryservicessiterecovery.models.UpdateMigrationItemInput - :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 MigrationItem or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - fabric_name: str, - protection_container_name: str, - migration_item_name: str, - input: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.MigrationItem]: - """Updates migration item. - - The operation to update the recovery settings of an ASR migration item. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param migration_item_name: Migration item name. Required. - :type migration_item_name: str - :param input: Update migration item input. Required. - :type input: 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 MigrationItem or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - fabric_name: str, - protection_container_name: str, - migration_item_name: str, - input: Union[_models.UpdateMigrationItemInput, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.MigrationItem]: - """Updates migration item. - - The operation to update the recovery settings of an ASR migration item. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param migration_item_name: Migration item name. Required. - :type migration_item_name: str - :param input: Update migration item input. Is either a UpdateMigrationItemInput type or a - IO[bytes] type. Required. - :type input: ~azure.mgmt.recoveryservicessiterecovery.models.UpdateMigrationItemInput or - IO[bytes] - :return: An instance of LROPoller that returns either MigrationItem or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] - :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.MigrationItem] = 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( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - migration_item_name=migration_item_name, - input=input, - 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("MigrationItem", 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.MigrationItem].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.MigrationItem]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _migrate_initial( - self, - fabric_name: str, - protection_container_name: str, - migration_item_name: str, - migrate_input: Union[_models.MigrateInput, 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(migrate_input, (IOBase, bytes)): - _content = migrate_input - else: - _json = self._serialize.body(migrate_input, "MigrateInput") - - _request = build_migrate_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - migration_item_name=migration_item_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_migrate( - self, - fabric_name: str, - protection_container_name: str, - migration_item_name: str, - migrate_input: _models.MigrateInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.MigrationItem]: - """Migrate item. - - The operation to initiate migration of the item. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param migration_item_name: Migration item name. Required. - :type migration_item_name: str - :param migrate_input: Migrate input. Required. - :type migrate_input: ~azure.mgmt.recoveryservicessiterecovery.models.MigrateInput - :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 MigrationItem or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_migrate( - self, - fabric_name: str, - protection_container_name: str, - migration_item_name: str, - migrate_input: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.MigrationItem]: - """Migrate item. - - The operation to initiate migration of the item. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param migration_item_name: Migration item name. Required. - :type migration_item_name: str - :param migrate_input: Migrate input. Required. - :type migrate_input: 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 MigrationItem or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_migrate( - self, - fabric_name: str, - protection_container_name: str, - migration_item_name: str, - migrate_input: Union[_models.MigrateInput, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.MigrationItem]: - """Migrate item. - - The operation to initiate migration of the item. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param migration_item_name: Migration item name. Required. - :type migration_item_name: str - :param migrate_input: Migrate input. Is either a MigrateInput type or a IO[bytes] type. - Required. - :type migrate_input: ~azure.mgmt.recoveryservicessiterecovery.models.MigrateInput or IO[bytes] - :return: An instance of LROPoller that returns either MigrationItem or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] - :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.MigrationItem] = 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._migrate_initial( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - migration_item_name=migration_item_name, - migrate_input=migrate_input, - 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("MigrationItem", 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.MigrationItem].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.MigrationItem]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _pause_replication_initial( - self, - fabric_name: str, - protection_container_name: str, - migration_item_name: str, - pause_replication_input: Union[_models.PauseReplicationInput, 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(pause_replication_input, (IOBase, bytes)): - _content = pause_replication_input - else: - _json = self._serialize.body(pause_replication_input, "PauseReplicationInput") - - _request = build_pause_replication_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - migration_item_name=migration_item_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_pause_replication( - self, - fabric_name: str, - protection_container_name: str, - migration_item_name: str, - pause_replication_input: _models.PauseReplicationInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.MigrationItem]: - """Pause replication. - - The operation to initiate pause replication of the item. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param migration_item_name: Migration item name. Required. - :type migration_item_name: str - :param pause_replication_input: Pause replication input. Required. - :type pause_replication_input: - ~azure.mgmt.recoveryservicessiterecovery.models.PauseReplicationInput - :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 MigrationItem or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_pause_replication( - self, - fabric_name: str, - protection_container_name: str, - migration_item_name: str, - pause_replication_input: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.MigrationItem]: - """Pause replication. - - The operation to initiate pause replication of the item. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param migration_item_name: Migration item name. Required. - :type migration_item_name: str - :param pause_replication_input: Pause replication input. Required. - :type pause_replication_input: 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 MigrationItem or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_pause_replication( - self, - fabric_name: str, - protection_container_name: str, - migration_item_name: str, - pause_replication_input: Union[_models.PauseReplicationInput, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.MigrationItem]: - """Pause replication. - - The operation to initiate pause replication of the item. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param migration_item_name: Migration item name. Required. - :type migration_item_name: str - :param pause_replication_input: Pause replication input. Is either a PauseReplicationInput type - or a IO[bytes] type. Required. - :type pause_replication_input: - ~azure.mgmt.recoveryservicessiterecovery.models.PauseReplicationInput or IO[bytes] - :return: An instance of LROPoller that returns either MigrationItem or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] - :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.MigrationItem] = 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._pause_replication_initial( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - migration_item_name=migration_item_name, - pause_replication_input=pause_replication_input, - 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("MigrationItem", 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.MigrationItem].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.MigrationItem]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _resume_replication_initial( - self, - fabric_name: str, - protection_container_name: str, - migration_item_name: str, - resume_replication_input: Union[_models.ResumeReplicationInput, 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(resume_replication_input, (IOBase, bytes)): - _content = resume_replication_input - else: - _json = self._serialize.body(resume_replication_input, "ResumeReplicationInput") - - _request = build_resume_replication_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - migration_item_name=migration_item_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_resume_replication( - self, - fabric_name: str, - protection_container_name: str, - migration_item_name: str, - resume_replication_input: _models.ResumeReplicationInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.MigrationItem]: - """Resume replication. - - The operation to initiate resume replication of the item. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param migration_item_name: Migration item name. Required. - :type migration_item_name: str - :param resume_replication_input: Resume replication input. Required. - :type resume_replication_input: - ~azure.mgmt.recoveryservicessiterecovery.models.ResumeReplicationInput - :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 MigrationItem or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_resume_replication( - self, - fabric_name: str, - protection_container_name: str, - migration_item_name: str, - resume_replication_input: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.MigrationItem]: - """Resume replication. - - The operation to initiate resume replication of the item. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param migration_item_name: Migration item name. Required. - :type migration_item_name: str - :param resume_replication_input: Resume replication input. Required. - :type resume_replication_input: 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 MigrationItem or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_resume_replication( - self, - fabric_name: str, - protection_container_name: str, - migration_item_name: str, - resume_replication_input: Union[_models.ResumeReplicationInput, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.MigrationItem]: - """Resume replication. - - The operation to initiate resume replication of the item. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param migration_item_name: Migration item name. Required. - :type migration_item_name: str - :param resume_replication_input: Resume replication input. Is either a ResumeReplicationInput - type or a IO[bytes] type. Required. - :type resume_replication_input: - ~azure.mgmt.recoveryservicessiterecovery.models.ResumeReplicationInput or IO[bytes] - :return: An instance of LROPoller that returns either MigrationItem or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] - :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.MigrationItem] = 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._resume_replication_initial( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - migration_item_name=migration_item_name, - resume_replication_input=resume_replication_input, - 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("MigrationItem", 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.MigrationItem].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.MigrationItem]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _resync_initial( - self, - fabric_name: str, - protection_container_name: str, - migration_item_name: str, - input: Union[_models.ResyncInput, 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(input, (IOBase, bytes)): - _content = input - else: - _json = self._serialize.body(input, "ResyncInput") - - _request = build_resync_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - migration_item_name=migration_item_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_resync( - self, - fabric_name: str, - protection_container_name: str, - migration_item_name: str, - input: _models.ResyncInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.MigrationItem]: - """Resynchronizes replication. - - The operation to resynchronize replication of an ASR migration item. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param migration_item_name: Migration item name. Required. - :type migration_item_name: str - :param input: Resync input. Required. - :type input: ~azure.mgmt.recoveryservicessiterecovery.models.ResyncInput - :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 MigrationItem or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_resync( - self, - fabric_name: str, - protection_container_name: str, - migration_item_name: str, - input: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.MigrationItem]: - """Resynchronizes replication. - - The operation to resynchronize replication of an ASR migration item. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param migration_item_name: Migration item name. Required. - :type migration_item_name: str - :param input: Resync input. Required. - :type input: 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 MigrationItem or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_resync( - self, - fabric_name: str, - protection_container_name: str, - migration_item_name: str, - input: Union[_models.ResyncInput, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.MigrationItem]: - """Resynchronizes replication. - - The operation to resynchronize replication of an ASR migration item. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param migration_item_name: Migration item name. Required. - :type migration_item_name: str - :param input: Resync input. Is either a ResyncInput type or a IO[bytes] type. Required. - :type input: ~azure.mgmt.recoveryservicessiterecovery.models.ResyncInput or IO[bytes] - :return: An instance of LROPoller that returns either MigrationItem or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] - :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.MigrationItem] = 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._resync_initial( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - migration_item_name=migration_item_name, - input=input, - 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("MigrationItem", 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.MigrationItem].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.MigrationItem]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _test_migrate_initial( - self, - fabric_name: str, - protection_container_name: str, - migration_item_name: str, - test_migrate_input: Union[_models.TestMigrateInput, 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(test_migrate_input, (IOBase, bytes)): - _content = test_migrate_input - else: - _json = self._serialize.body(test_migrate_input, "TestMigrateInput") - - _request = build_test_migrate_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - migration_item_name=migration_item_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_test_migrate( - self, - fabric_name: str, - protection_container_name: str, - migration_item_name: str, - test_migrate_input: _models.TestMigrateInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.MigrationItem]: - """Test migrate item. - - The operation to initiate test migration of the item. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param migration_item_name: Migration item name. Required. - :type migration_item_name: str - :param test_migrate_input: Test migrate input. Required. - :type test_migrate_input: ~azure.mgmt.recoveryservicessiterecovery.models.TestMigrateInput - :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 MigrationItem or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_test_migrate( - self, - fabric_name: str, - protection_container_name: str, - migration_item_name: str, - test_migrate_input: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.MigrationItem]: - """Test migrate item. - - The operation to initiate test migration of the item. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param migration_item_name: Migration item name. Required. - :type migration_item_name: str - :param test_migrate_input: Test migrate input. Required. - :type test_migrate_input: 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 MigrationItem or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_test_migrate( - self, - fabric_name: str, - protection_container_name: str, - migration_item_name: str, - test_migrate_input: Union[_models.TestMigrateInput, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.MigrationItem]: - """Test migrate item. - - The operation to initiate test migration of the item. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param migration_item_name: Migration item name. Required. - :type migration_item_name: str - :param test_migrate_input: Test migrate input. Is either a TestMigrateInput type or a IO[bytes] - type. Required. - :type test_migrate_input: ~azure.mgmt.recoveryservicessiterecovery.models.TestMigrateInput or - IO[bytes] - :return: An instance of LROPoller that returns either MigrationItem or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] - :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.MigrationItem] = 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._test_migrate_initial( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - migration_item_name=migration_item_name, - test_migrate_input=test_migrate_input, - 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("MigrationItem", 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.MigrationItem].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.MigrationItem]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _test_migrate_cleanup_initial( - self, - fabric_name: str, - protection_container_name: str, - migration_item_name: str, - test_migrate_cleanup_input: Union[_models.TestMigrateCleanupInput, 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(test_migrate_cleanup_input, (IOBase, bytes)): - _content = test_migrate_cleanup_input - else: - _json = self._serialize.body(test_migrate_cleanup_input, "TestMigrateCleanupInput") - - _request = build_test_migrate_cleanup_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - migration_item_name=migration_item_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_test_migrate_cleanup( - self, - fabric_name: str, - protection_container_name: str, - migration_item_name: str, - test_migrate_cleanup_input: _models.TestMigrateCleanupInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.MigrationItem]: - """Test migrate cleanup. - - The operation to initiate test migrate cleanup. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param migration_item_name: Migration item name. Required. - :type migration_item_name: str - :param test_migrate_cleanup_input: Test migrate cleanup input. Required. - :type test_migrate_cleanup_input: - ~azure.mgmt.recoveryservicessiterecovery.models.TestMigrateCleanupInput - :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 MigrationItem or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_test_migrate_cleanup( - self, - fabric_name: str, - protection_container_name: str, - migration_item_name: str, - test_migrate_cleanup_input: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.MigrationItem]: - """Test migrate cleanup. - - The operation to initiate test migrate cleanup. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param migration_item_name: Migration item name. Required. - :type migration_item_name: str - :param test_migrate_cleanup_input: Test migrate cleanup input. Required. - :type test_migrate_cleanup_input: 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 MigrationItem or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_test_migrate_cleanup( - self, - fabric_name: str, - protection_container_name: str, - migration_item_name: str, - test_migrate_cleanup_input: Union[_models.TestMigrateCleanupInput, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.MigrationItem]: - """Test migrate cleanup. - - The operation to initiate test migrate cleanup. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param migration_item_name: Migration item name. Required. - :type migration_item_name: str - :param test_migrate_cleanup_input: Test migrate cleanup input. Is either a - TestMigrateCleanupInput type or a IO[bytes] type. Required. - :type test_migrate_cleanup_input: - ~azure.mgmt.recoveryservicessiterecovery.models.TestMigrateCleanupInput or IO[bytes] - :return: An instance of LROPoller that returns either MigrationItem or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] - :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.MigrationItem] = 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._test_migrate_cleanup_initial( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - migration_item_name=migration_item_name, - test_migrate_cleanup_input=test_migrate_cleanup_input, - 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("MigrationItem", 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.MigrationItem].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.MigrationItem]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, - skip_token: Optional[str] = None, - take_token: Optional[str] = None, - filter: Optional[str] = None, - **kwargs: Any - ) -> Iterable["_models.MigrationItem"]: - """Gets the list of migration items in the vault. - - Gets the list of migration items in the vault. - - :param skip_token: The pagination token. Default value is None. - :type skip_token: str - :param take_token: The page size. Default value is None. - :type take_token: str - :param filter: OData filter options. Default value is None. - :type filter: str - :return: An iterator like instance of either MigrationItem or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.MigrationItem] - :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.MigrationItemCollection] = 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_request( - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_name, - subscription_id=self._config.subscription_id, - skip_token=skip_token, - take_token=take_token, - filter=filter, - 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("MigrationItemCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_network_mappings_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_network_mappings_operations.py deleted file mode 100644 index 371568d5ea76..000000000000 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_network_mappings_operations.py +++ /dev/null @@ -1,1060 +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, Dict, IO, Iterable, 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 SiteRecoveryManagementClientConfiguration -from .._serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_replication_networks_request( # pylint: disable=name-too-long - fabric_name: str, - network_name: str, - resource_group_name: str, - resource_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", "2025-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}/replicationNetworkMappings", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), - "networkName": _SERIALIZER.url("network_name", network_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( - fabric_name: str, - network_name: str, - network_mapping_name: str, - resource_group_name: str, - resource_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", "2025-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}/replicationNetworkMappings/{networkMappingName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), - "networkName": _SERIALIZER.url("network_name", network_name, "str"), - "networkMappingName": _SERIALIZER.url("network_mapping_name", network_mapping_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( - fabric_name: str, - network_name: str, - network_mapping_name: str, - resource_group_name: str, - resource_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", "2025-01-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}/replicationNetworkMappings/{networkMappingName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), - "networkName": _SERIALIZER.url("network_name", network_name, "str"), - "networkMappingName": _SERIALIZER.url("network_mapping_name", network_mapping_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( - fabric_name: str, - network_name: str, - network_mapping_name: str, - resource_group_name: str, - resource_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", "2025-01-01")) - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}/replicationNetworkMappings/{networkMappingName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), - "networkName": _SERIALIZER.url("network_name", network_name, "str"), - "networkMappingName": _SERIALIZER.url("network_mapping_name", network_mapping_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_update_request( - fabric_name: str, - network_name: str, - network_mapping_name: str, - resource_group_name: str, - resource_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", "2025-01-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}/replicationNetworkMappings/{networkMappingName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), - "networkName": _SERIALIZER.url("network_name", network_name, "str"), - "networkMappingName": _SERIALIZER.url("network_mapping_name", network_mapping_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_list_request( - resource_group_name: str, resource_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", "2025-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationNetworkMappings", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "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) - - -class ReplicationNetworkMappingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicessiterecovery.SiteRecoveryManagementClient`'s - :attr:`replication_network_mappings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: SiteRecoveryManagementClientConfiguration = ( - 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_replication_networks( - self, fabric_name: str, network_name: str, **kwargs: Any - ) -> Iterable["_models.NetworkMapping"]: - """Gets all the network mappings under a network. - - Lists all ASR network mappings for the specified network. - - :param fabric_name: Primary fabric name. Required. - :type fabric_name: str - :param network_name: Primary network name. Required. - :type network_name: str - :return: An iterator like instance of either NetworkMapping or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.NetworkMapping] - :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.NetworkMappingCollection] = 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_replication_networks_request( - fabric_name=fabric_name, - network_name=network_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("NetworkMappingCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get( - self, fabric_name: str, network_name: str, network_mapping_name: str, **kwargs: Any - ) -> _models.NetworkMapping: - """Gets network mapping by name. - - Gets the details of an ASR network mapping. - - :param fabric_name: Primary fabric name. Required. - :type fabric_name: str - :param network_name: Primary network name. Required. - :type network_name: str - :param network_mapping_name: Network mapping name. Required. - :type network_mapping_name: str - :return: NetworkMapping or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.NetworkMapping - :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.NetworkMapping] = kwargs.pop("cls", None) - - _request = build_get_request( - fabric_name=fabric_name, - network_name=network_name, - network_mapping_name=network_mapping_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("NetworkMapping", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_initial( - self, - fabric_name: str, - network_name: str, - network_mapping_name: str, - input: Union[_models.CreateNetworkMappingInput, 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(input, (IOBase, bytes)): - _content = input - else: - _json = self._serialize.body(input, "CreateNetworkMappingInput") - - _request = build_create_request( - fabric_name=fabric_name, - network_name=network_name, - network_mapping_name=network_mapping_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create( - self, - fabric_name: str, - network_name: str, - network_mapping_name: str, - input: _models.CreateNetworkMappingInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.NetworkMapping]: - """Creates network mapping. - - The operation to create an ASR network mapping. - - :param fabric_name: Primary fabric name. Required. - :type fabric_name: str - :param network_name: Primary network name. Required. - :type network_name: str - :param network_mapping_name: Network mapping name. Required. - :type network_mapping_name: str - :param input: Create network mapping input. Required. - :type input: ~azure.mgmt.recoveryservicessiterecovery.models.CreateNetworkMappingInput - :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 NetworkMapping or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.NetworkMapping] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create( - self, - fabric_name: str, - network_name: str, - network_mapping_name: str, - input: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.NetworkMapping]: - """Creates network mapping. - - The operation to create an ASR network mapping. - - :param fabric_name: Primary fabric name. Required. - :type fabric_name: str - :param network_name: Primary network name. Required. - :type network_name: str - :param network_mapping_name: Network mapping name. Required. - :type network_mapping_name: str - :param input: Create network mapping input. Required. - :type input: 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 NetworkMapping or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.NetworkMapping] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create( - self, - fabric_name: str, - network_name: str, - network_mapping_name: str, - input: Union[_models.CreateNetworkMappingInput, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.NetworkMapping]: - """Creates network mapping. - - The operation to create an ASR network mapping. - - :param fabric_name: Primary fabric name. Required. - :type fabric_name: str - :param network_name: Primary network name. Required. - :type network_name: str - :param network_mapping_name: Network mapping name. Required. - :type network_mapping_name: str - :param input: Create network mapping input. Is either a CreateNetworkMappingInput type or a - IO[bytes] type. Required. - :type input: ~azure.mgmt.recoveryservicessiterecovery.models.CreateNetworkMappingInput or - IO[bytes] - :return: An instance of LROPoller that returns either NetworkMapping or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.NetworkMapping] - :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.NetworkMapping] = 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( - fabric_name=fabric_name, - network_name=network_name, - network_mapping_name=network_mapping_name, - input=input, - 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("NetworkMapping", 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.NetworkMapping].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.NetworkMapping]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, fabric_name: str, network_name: str, network_mapping_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( - fabric_name=fabric_name, - network_name=network_name, - network_mapping_name=network_mapping_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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 [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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, fabric_name: str, network_name: str, network_mapping_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Delete network mapping. - - The operation to delete a network mapping. - - :param fabric_name: Primary fabric name. Required. - :type fabric_name: str - :param network_name: Primary network name. Required. - :type network_name: str - :param network_mapping_name: ARM Resource Name for network mapping. Required. - :type network_mapping_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( - fabric_name=fabric_name, - network_name=network_name, - network_mapping_name=network_mapping_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 - - def _update_initial( - self, - fabric_name: str, - network_name: str, - network_mapping_name: str, - input: Union[_models.UpdateNetworkMappingInput, 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(input, (IOBase, bytes)): - _content = input - else: - _json = self._serialize.body(input, "UpdateNetworkMappingInput") - - _request = build_update_request( - fabric_name=fabric_name, - network_name=network_name, - network_mapping_name=network_mapping_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - fabric_name: str, - network_name: str, - network_mapping_name: str, - input: _models.UpdateNetworkMappingInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.NetworkMapping]: - """Updates network mapping. - - The operation to update an ASR network mapping. - - :param fabric_name: Primary fabric name. Required. - :type fabric_name: str - :param network_name: Primary network name. Required. - :type network_name: str - :param network_mapping_name: Network mapping name. Required. - :type network_mapping_name: str - :param input: Update network mapping input. Required. - :type input: ~azure.mgmt.recoveryservicessiterecovery.models.UpdateNetworkMappingInput - :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 NetworkMapping or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.NetworkMapping] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - fabric_name: str, - network_name: str, - network_mapping_name: str, - input: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.NetworkMapping]: - """Updates network mapping. - - The operation to update an ASR network mapping. - - :param fabric_name: Primary fabric name. Required. - :type fabric_name: str - :param network_name: Primary network name. Required. - :type network_name: str - :param network_mapping_name: Network mapping name. Required. - :type network_mapping_name: str - :param input: Update network mapping input. Required. - :type input: 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 NetworkMapping or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.NetworkMapping] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - fabric_name: str, - network_name: str, - network_mapping_name: str, - input: Union[_models.UpdateNetworkMappingInput, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.NetworkMapping]: - """Updates network mapping. - - The operation to update an ASR network mapping. - - :param fabric_name: Primary fabric name. Required. - :type fabric_name: str - :param network_name: Primary network name. Required. - :type network_name: str - :param network_mapping_name: Network mapping name. Required. - :type network_mapping_name: str - :param input: Update network mapping input. Is either a UpdateNetworkMappingInput type or a - IO[bytes] type. Required. - :type input: ~azure.mgmt.recoveryservicessiterecovery.models.UpdateNetworkMappingInput or - IO[bytes] - :return: An instance of LROPoller that returns either NetworkMapping or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.NetworkMapping] - :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.NetworkMapping] = 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( - fabric_name=fabric_name, - network_name=network_name, - network_mapping_name=network_mapping_name, - input=input, - 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("NetworkMapping", 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.NetworkMapping].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.NetworkMapping]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.NetworkMapping"]: - """Gets all the network mappings under a vault. - - Lists all ASR network mappings in the vault. - - :return: An iterator like instance of either NetworkMapping or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.NetworkMapping] - :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.NetworkMappingCollection] = 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_request( - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("NetworkMappingCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_networks_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_networks_operations.py deleted file mode 100644 index 3db1f0b877ee..000000000000 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_networks_operations.py +++ /dev/null @@ -1,377 +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, Dict, Iterable, 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 SiteRecoveryManagementClientConfiguration -from .._serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_replication_fabrics_request( # pylint: disable=name-too-long - fabric_name: str, resource_group_name: str, resource_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", "2025-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url("fabric_name", fabric_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( - fabric_name: str, - network_name: str, - resource_group_name: str, - resource_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", "2025-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), - "networkName": _SERIALIZER.url("network_name", network_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_list_request( - resource_group_name: str, resource_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", "2025-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationNetworks", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "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) - - -class ReplicationNetworksOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicessiterecovery.SiteRecoveryManagementClient`'s - :attr:`replication_networks` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: SiteRecoveryManagementClientConfiguration = ( - 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_replication_fabrics(self, fabric_name: str, **kwargs: Any) -> Iterable["_models.Network"]: - """Gets the list of networks under a fabric. - - Lists the networks available for a fabric. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :return: An iterator like instance of either Network or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.Network] - :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.NetworkCollection] = 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_replication_fabrics_request( - fabric_name=fabric_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("NetworkCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get(self, fabric_name: str, network_name: str, **kwargs: Any) -> _models.Network: - """Gets a network with specified server id and network name. - - Gets the details of a network. - - :param fabric_name: Server Id. Required. - :type fabric_name: str - :param network_name: Primary network name. Required. - :type network_name: str - :return: Network or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.Network - :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.Network] = kwargs.pop("cls", None) - - _request = build_get_request( - fabric_name=fabric_name, - network_name=network_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("Network", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.Network"]: - """Gets the list of networks. View-only API. - - Lists the networks available in a vault. - - :return: An iterator like instance of either Network or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.Network] - :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.NetworkCollection] = 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_request( - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("NetworkCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_policies_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_policies_operations.py deleted file mode 100644 index aa08f3548180..000000000000 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_policies_operations.py +++ /dev/null @@ -1,798 +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, Dict, IO, Iterable, 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 SiteRecoveryManagementClientConfiguration -from .._serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request( - resource_group_name: str, resource_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", "2025-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationPolicies", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "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_get_request( - policy_name: str, resource_group_name: str, resource_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", "2025-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationPolicies/{policyName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "policyName": _SERIALIZER.url("policy_name", policy_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( - policy_name: str, resource_group_name: str, resource_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", "2025-01-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.RecoveryServices/vaults/{resourceName}/replicationPolicies/{policyName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "policyName": _SERIALIZER.url("policy_name", policy_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( - policy_name: str, resource_group_name: str, resource_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", "2025-01-01")) - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationPolicies/{policyName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "policyName": _SERIALIZER.url("policy_name", policy_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_update_request( - policy_name: str, resource_group_name: str, resource_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", "2025-01-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.RecoveryServices/vaults/{resourceName}/replicationPolicies/{policyName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "policyName": _SERIALIZER.url("policy_name", policy_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) - - -class ReplicationPoliciesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicessiterecovery.SiteRecoveryManagementClient`'s - :attr:`replication_policies` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: SiteRecoveryManagementClientConfiguration = ( - 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) -> Iterable["_models.Policy"]: - """Gets the list of replication policies. - - Lists the replication policies for a vault. - - :return: An iterator like instance of either Policy or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.Policy] - :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.PolicyCollection] = 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_request( - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("PolicyCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get(self, policy_name: str, **kwargs: Any) -> _models.Policy: - """Gets the requested policy. - - Gets the details of a replication policy. - - :param policy_name: Replication policy name. Required. - :type policy_name: str - :return: Policy or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.Policy - :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.Policy] = kwargs.pop("cls", None) - - _request = build_get_request( - policy_name=policy_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("Policy", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_initial( - self, policy_name: str, input: Union[_models.CreatePolicyInput, 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(input, (IOBase, bytes)): - _content = input - else: - _json = self._serialize.body(input, "CreatePolicyInput") - - _request = build_create_request( - policy_name=policy_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create( - self, - policy_name: str, - input: _models.CreatePolicyInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Policy]: - """Creates the policy. - - The operation to create a replication policy. - - :param policy_name: Replication policy name. Required. - :type policy_name: str - :param input: Create policy input. Required. - :type input: ~azure.mgmt.recoveryservicessiterecovery.models.CreatePolicyInput - :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 Policy or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Policy] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create( - self, policy_name: str, input: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.Policy]: - """Creates the policy. - - The operation to create a replication policy. - - :param policy_name: Replication policy name. Required. - :type policy_name: str - :param input: Create policy input. Required. - :type input: 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 Policy or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Policy] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create( - self, policy_name: str, input: Union[_models.CreatePolicyInput, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.Policy]: - """Creates the policy. - - The operation to create a replication policy. - - :param policy_name: Replication policy name. Required. - :type policy_name: str - :param input: Create policy input. Is either a CreatePolicyInput type or a IO[bytes] type. - Required. - :type input: ~azure.mgmt.recoveryservicessiterecovery.models.CreatePolicyInput or IO[bytes] - :return: An instance of LROPoller that returns either Policy or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Policy] - :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.Policy] = 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( - policy_name=policy_name, - input=input, - 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("Policy", 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.Policy].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.Policy]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial(self, policy_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( - policy_name=policy_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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 [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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete(self, policy_name: str, **kwargs: Any) -> LROPoller[None]: - """Delete the policy. - - The operation to delete a replication policy. - - :param policy_name: Replication policy name. Required. - :type policy_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( - policy_name=policy_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 - - def _update_initial( - self, policy_name: str, input: Union[_models.UpdatePolicyInput, 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(input, (IOBase, bytes)): - _content = input - else: - _json = self._serialize.body(input, "UpdatePolicyInput") - - _request = build_update_request( - policy_name=policy_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - policy_name: str, - input: _models.UpdatePolicyInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Policy]: - """Updates the policy. - - The operation to update a replication policy. - - :param policy_name: Policy Id. Required. - :type policy_name: str - :param input: Update Policy Input. Required. - :type input: ~azure.mgmt.recoveryservicessiterecovery.models.UpdatePolicyInput - :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 Policy or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Policy] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, policy_name: str, input: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.Policy]: - """Updates the policy. - - The operation to update a replication policy. - - :param policy_name: Policy Id. Required. - :type policy_name: str - :param input: Update Policy Input. Required. - :type input: 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 Policy or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Policy] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, policy_name: str, input: Union[_models.UpdatePolicyInput, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.Policy]: - """Updates the policy. - - The operation to update a replication policy. - - :param policy_name: Policy Id. Required. - :type policy_name: str - :param input: Update Policy Input. Is either a UpdatePolicyInput type or a IO[bytes] type. - Required. - :type input: ~azure.mgmt.recoveryservicessiterecovery.models.UpdatePolicyInput or IO[bytes] - :return: An instance of LROPoller that returns either Policy or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.Policy] - :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.Policy] = 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( - policy_name=policy_name, - input=input, - 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("Policy", 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.Policy].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.Policy]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_protectable_items_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_protectable_items_operations.py deleted file mode 100644 index 986adc4fa42f..000000000000 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_protectable_items_operations.py +++ /dev/null @@ -1,312 +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, Dict, Iterable, 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 SiteRecoveryManagementClientConfiguration -from .._serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_replication_protection_containers_request( # pylint: disable=name-too-long - fabric_name: str, - protection_container_name: str, - resource_group_name: str, - resource_name: str, - subscription_id: str, - *, - filter: Optional[str] = None, - take: Optional[str] = None, - skip_token: Optional[str] = None, - **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", "2025-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectableItems", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), - "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") - if take is not None: - _params["$take"] = _SERIALIZER.query("take", take, "str") - if skip_token is not None: - _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "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( - fabric_name: str, - protection_container_name: str, - protectable_item_name: str, - resource_group_name: str, - resource_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", "2025-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectableItems/{protectableItemName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), - "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), - "protectableItemName": _SERIALIZER.url("protectable_item_name", protectable_item_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 ReplicationProtectableItemsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicessiterecovery.SiteRecoveryManagementClient`'s - :attr:`replication_protectable_items` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: SiteRecoveryManagementClientConfiguration = ( - 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_replication_protection_containers( # pylint: disable=name-too-long - self, - fabric_name: str, - protection_container_name: str, - filter: Optional[str] = None, - take: Optional[str] = None, - skip_token: Optional[str] = None, - **kwargs: Any - ) -> Iterable["_models.ProtectableItem"]: - """Gets the list of protectable items. - - Lists the protectable items in a protection container. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param filter: OData filter options. Default value is None. - :type filter: str - :param take: take OData query parameter. Default value is None. - :type take: str - :param skip_token: skipToken OData query parameter. Default value is None. - :type skip_token: str - :return: An iterator like instance of either ProtectableItem or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.ProtectableItem] - :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.ProtectableItemCollection] = 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_replication_protection_containers_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_name, - subscription_id=self._config.subscription_id, - filter=filter, - take=take, - skip_token=skip_token, - 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("ProtectableItemCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get( - self, fabric_name: str, protection_container_name: str, protectable_item_name: str, **kwargs: Any - ) -> _models.ProtectableItem: - """Gets the details of a protectable item. - - The operation to get the details of a protectable item. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param protectable_item_name: Protectable item name. Required. - :type protectable_item_name: str - :return: ProtectableItem or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.ProtectableItem - :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.ProtectableItem] = kwargs.pop("cls", None) - - _request = build_get_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - protectable_item_name=protectable_item_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("ProtectableItem", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_protected_items_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_protected_items_operations.py deleted file mode 100644 index 41fdd956cbce..000000000000 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_protected_items_operations.py +++ /dev/null @@ -1,4942 +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, Dict, IO, Iterable, 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 SiteRecoveryManagementClientConfiguration -from .._serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_replication_protection_containers_request( # pylint: disable=name-too-long - fabric_name: str, - protection_container_name: str, - resource_group_name: str, - resource_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", "2025-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), - "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_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( - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - resource_group_name: str, - resource_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", "2025-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), - "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), - "replicatedProtectedItemName": _SERIALIZER.url( - "replicated_protected_item_name", replicated_protected_item_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( - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - resource_group_name: str, - resource_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", "2025-01-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), - "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), - "replicatedProtectedItemName": _SERIALIZER.url( - "replicated_protected_item_name", replicated_protected_item_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_purge_request( - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - resource_group_name: str, - resource_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", "2025-01-01")) - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), - "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), - "replicatedProtectedItemName": _SERIALIZER.url( - "replicated_protected_item_name", replicated_protected_item_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_update_request( - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - resource_group_name: str, - resource_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", "2025-01-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), - "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), - "replicatedProtectedItemName": _SERIALIZER.url( - "replicated_protected_item_name", replicated_protected_item_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_add_disks_request( - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - resource_group_name: str, - resource_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", "2025-01-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/addDisks", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), - "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), - "replicatedProtectedItemName": _SERIALIZER.url( - "replicated_protected_item_name", replicated_protected_item_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_apply_recovery_point_request( - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - resource_group_name: str, - resource_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", "2025-01-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/applyRecoveryPoint", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), - "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), - "replicatedProtectedItemName": _SERIALIZER.url( - "replicated_protected_item_name", replicated_protected_item_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_failover_cancel_request( - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - resource_group_name: str, - resource_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", "2025-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/failoverCancel", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), - "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), - "replicatedProtectedItemName": _SERIALIZER.url( - "replicated_protected_item_name", replicated_protected_item_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_failover_commit_request( - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - resource_group_name: str, - resource_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", "2025-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/failoverCommit", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), - "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), - "replicatedProtectedItemName": _SERIALIZER.url( - "replicated_protected_item_name", replicated_protected_item_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_planned_failover_request( - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - resource_group_name: str, - resource_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", "2025-01-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/plannedFailover", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), - "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), - "replicatedProtectedItemName": _SERIALIZER.url( - "replicated_protected_item_name", replicated_protected_item_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_delete_request( - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - resource_group_name: str, - resource_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", "2025-01-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/remove", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), - "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), - "replicatedProtectedItemName": _SERIALIZER.url( - "replicated_protected_item_name", replicated_protected_item_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_remove_disks_request( - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - resource_group_name: str, - resource_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", "2025-01-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/removeDisks", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), - "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), - "replicatedProtectedItemName": _SERIALIZER.url( - "replicated_protected_item_name", replicated_protected_item_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_repair_replication_request( - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - resource_group_name: str, - resource_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", "2025-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/repairReplication", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), - "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), - "replicatedProtectedItemName": _SERIALIZER.url( - "replicated_protected_item_name", replicated_protected_item_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_reprotect_request( - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - resource_group_name: str, - resource_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", "2025-01-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/reProtect", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), - "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), - "replicatedProtectedItemName": _SERIALIZER.url( - "replicated_protected_item_name", replicated_protected_item_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_resolve_health_errors_request( - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - resource_group_name: str, - resource_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", "2025-01-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/resolveHealthErrors", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), - "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), - "replicatedProtectedItemName": _SERIALIZER.url( - "replicated_protected_item_name", replicated_protected_item_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_switch_provider_request( - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - resource_group_name: str, - resource_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", "2025-01-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/switchProvider", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), - "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), - "replicatedProtectedItemName": _SERIALIZER.url( - "replicated_protected_item_name", replicated_protected_item_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_test_failover_request( - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - resource_group_name: str, - resource_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", "2025-01-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/testFailover", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), - "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), - "replicatedProtectedItemName": _SERIALIZER.url( - "replicated_protected_item_name", replicated_protected_item_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_test_failover_cleanup_request( - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - resource_group_name: str, - resource_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", "2025-01-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/testFailoverCleanup", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), - "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), - "replicatedProtectedItemName": _SERIALIZER.url( - "replicated_protected_item_name", replicated_protected_item_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_unplanned_failover_request( - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - resource_group_name: str, - resource_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", "2025-01-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/unplannedFailover", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), - "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), - "replicatedProtectedItemName": _SERIALIZER.url( - "replicated_protected_item_name", replicated_protected_item_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_update_appliance_request( - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - resource_group_name: str, - resource_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", "2025-01-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/updateAppliance", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), - "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), - "replicatedProtectedItemName": _SERIALIZER.url( - "replicated_protected_item_name", replicated_protected_item_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_update_mobility_service_request( - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - resource_group_name: str, - resource_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", "2025-01-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/updateMobilityService", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), - "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), - "replicatedProtectedItemName": _SERIALIZER.url( - "replicated_protected_item_name", replicated_protected_item_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_list_request( - resource_group_name: str, - resource_name: str, - subscription_id: str, - *, - skip_token: Optional[str] = None, - filter: Optional[str] = None, - **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", "2025-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationProtectedItems", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "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") - if skip_token is not None: - _params["skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class ReplicationProtectedItemsOperations: # pylint: disable=too-many-public-methods - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicessiterecovery.SiteRecoveryManagementClient`'s - :attr:`replication_protected_items` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: SiteRecoveryManagementClientConfiguration = ( - 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_replication_protection_containers( # pylint: disable=name-too-long - self, fabric_name: str, protection_container_name: str, **kwargs: Any - ) -> Iterable["_models.ReplicationProtectedItem"]: - """Gets the list of Replication protected items. - - Gets the list of ASR replication protected items in the protection container. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :return: An iterator like instance of either ReplicationProtectedItem or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :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.ReplicationProtectedItemCollection] = 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_replication_protection_containers_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("ReplicationProtectedItemCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get( - self, fabric_name: str, protection_container_name: str, replicated_protected_item_name: str, **kwargs: Any - ) -> _models.ReplicationProtectedItem: - """Gets the details of a Replication protected item. - - Gets the details of an ASR replication protected item. - - :param fabric_name: Fabric unique name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. Required. - :type replicated_protected_item_name: str - :return: ReplicationProtectedItem or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem - :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.ReplicationProtectedItem] = kwargs.pop("cls", None) - - _request = build_get_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replicated_protected_item_name=replicated_protected_item_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("ReplicationProtectedItem", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_initial( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - input: Union[_models.EnableProtectionInput, 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(input, (IOBase, bytes)): - _content = input - else: - _json = self._serialize.body(input, "EnableProtectionInput") - - _request = build_create_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replicated_protected_item_name=replicated_protected_item_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - input: _models.EnableProtectionInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ReplicationProtectedItem]: - """Enables protection. - - The operation to create an ASR replication protected item (Enable replication). - - :param fabric_name: Name of the fabric. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: A name for the replication protected item. Required. - :type replicated_protected_item_name: str - :param input: Enable Protection Input. Required. - :type input: ~azure.mgmt.recoveryservicessiterecovery.models.EnableProtectionInput - :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 ReplicationProtectedItem or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - input: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ReplicationProtectedItem]: - """Enables protection. - - The operation to create an ASR replication protected item (Enable replication). - - :param fabric_name: Name of the fabric. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: A name for the replication protected item. Required. - :type replicated_protected_item_name: str - :param input: Enable Protection Input. Required. - :type input: 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 ReplicationProtectedItem or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - input: Union[_models.EnableProtectionInput, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.ReplicationProtectedItem]: - """Enables protection. - - The operation to create an ASR replication protected item (Enable replication). - - :param fabric_name: Name of the fabric. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: A name for the replication protected item. Required. - :type replicated_protected_item_name: str - :param input: Enable Protection Input. Is either a EnableProtectionInput type or a IO[bytes] - type. Required. - :type input: ~azure.mgmt.recoveryservicessiterecovery.models.EnableProtectionInput or IO[bytes] - :return: An instance of LROPoller that returns either ReplicationProtectedItem or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :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.ReplicationProtectedItem] = 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( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replicated_protected_item_name=replicated_protected_item_name, - input=input, - 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("ReplicationProtectedItem", 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.ReplicationProtectedItem].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ReplicationProtectedItem]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _purge_initial( - self, fabric_name: str, protection_container_name: str, replicated_protected_item_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_purge_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replicated_protected_item_name=replicated_protected_item_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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 [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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_purge( - self, fabric_name: str, protection_container_name: str, replicated_protected_item_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Purges protection. - - The operation to delete or purge a replication protected item. This operation will force delete - the replication protected item. Use the remove operation on replication protected item to - perform a clean disable replication for the item. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. Required. - :type replicated_protected_item_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._purge_initial( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replicated_protected_item_name=replicated_protected_item_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 - - def _update_initial( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - update_protection_input: Union[_models.UpdateReplicationProtectedItemInput, 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(update_protection_input, (IOBase, bytes)): - _content = update_protection_input - else: - _json = self._serialize.body(update_protection_input, "UpdateReplicationProtectedItemInput") - - _request = build_update_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replicated_protected_item_name=replicated_protected_item_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - update_protection_input: _models.UpdateReplicationProtectedItemInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ReplicationProtectedItem]: - """Updates the replication protected item settings. - - The operation to update the recovery settings of an ASR replication protected item. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. Required. - :type replicated_protected_item_name: str - :param update_protection_input: Update protection input. Required. - :type update_protection_input: - ~azure.mgmt.recoveryservicessiterecovery.models.UpdateReplicationProtectedItemInput - :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 ReplicationProtectedItem or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - update_protection_input: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ReplicationProtectedItem]: - """Updates the replication protected item settings. - - The operation to update the recovery settings of an ASR replication protected item. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. Required. - :type replicated_protected_item_name: str - :param update_protection_input: Update protection input. Required. - :type update_protection_input: 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 ReplicationProtectedItem or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - update_protection_input: Union[_models.UpdateReplicationProtectedItemInput, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.ReplicationProtectedItem]: - """Updates the replication protected item settings. - - The operation to update the recovery settings of an ASR replication protected item. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. Required. - :type replicated_protected_item_name: str - :param update_protection_input: Update protection input. Is either a - UpdateReplicationProtectedItemInput type or a IO[bytes] type. Required. - :type update_protection_input: - ~azure.mgmt.recoveryservicessiterecovery.models.UpdateReplicationProtectedItemInput or - IO[bytes] - :return: An instance of LROPoller that returns either ReplicationProtectedItem or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :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.ReplicationProtectedItem] = 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( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replicated_protected_item_name=replicated_protected_item_name, - update_protection_input=update_protection_input, - 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("ReplicationProtectedItem", 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.ReplicationProtectedItem].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ReplicationProtectedItem]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _add_disks_initial( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - add_disks_input: Union[_models.AddDisksInput, 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(add_disks_input, (IOBase, bytes)): - _content = add_disks_input - else: - _json = self._serialize.body(add_disks_input, "AddDisksInput") - - _request = build_add_disks_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replicated_protected_item_name=replicated_protected_item_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_add_disks( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - add_disks_input: _models.AddDisksInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ReplicationProtectedItem]: - """Add disk(s) for protection. - - Operation to add disks(s) to the replication protected item. - - :param fabric_name: Unique fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. Required. - :type replicated_protected_item_name: str - :param add_disks_input: Add disks input. Required. - :type add_disks_input: ~azure.mgmt.recoveryservicessiterecovery.models.AddDisksInput - :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 ReplicationProtectedItem or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_add_disks( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - add_disks_input: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ReplicationProtectedItem]: - """Add disk(s) for protection. - - Operation to add disks(s) to the replication protected item. - - :param fabric_name: Unique fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. Required. - :type replicated_protected_item_name: str - :param add_disks_input: Add disks input. Required. - :type add_disks_input: 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 ReplicationProtectedItem or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_add_disks( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - add_disks_input: Union[_models.AddDisksInput, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.ReplicationProtectedItem]: - """Add disk(s) for protection. - - Operation to add disks(s) to the replication protected item. - - :param fabric_name: Unique fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. Required. - :type replicated_protected_item_name: str - :param add_disks_input: Add disks input. Is either a AddDisksInput type or a IO[bytes] type. - Required. - :type add_disks_input: ~azure.mgmt.recoveryservicessiterecovery.models.AddDisksInput or - IO[bytes] - :return: An instance of LROPoller that returns either ReplicationProtectedItem or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :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.ReplicationProtectedItem] = 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._add_disks_initial( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replicated_protected_item_name=replicated_protected_item_name, - add_disks_input=add_disks_input, - 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("ReplicationProtectedItem", 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.ReplicationProtectedItem].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ReplicationProtectedItem]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _apply_recovery_point_initial( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - apply_recovery_point_input: Union[_models.ApplyRecoveryPointInput, 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(apply_recovery_point_input, (IOBase, bytes)): - _content = apply_recovery_point_input - else: - _json = self._serialize.body(apply_recovery_point_input, "ApplyRecoveryPointInput") - - _request = build_apply_recovery_point_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replicated_protected_item_name=replicated_protected_item_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_apply_recovery_point( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - apply_recovery_point_input: _models.ApplyRecoveryPointInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ReplicationProtectedItem]: - """Change or apply recovery point. - - The operation to change the recovery point of a failed over replication protected item. - - :param fabric_name: The ARM fabric name. Required. - :type fabric_name: str - :param protection_container_name: The protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: The replicated protected item name. Required. - :type replicated_protected_item_name: str - :param apply_recovery_point_input: The ApplyRecoveryPointInput. Required. - :type apply_recovery_point_input: - ~azure.mgmt.recoveryservicessiterecovery.models.ApplyRecoveryPointInput - :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 ReplicationProtectedItem or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_apply_recovery_point( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - apply_recovery_point_input: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ReplicationProtectedItem]: - """Change or apply recovery point. - - The operation to change the recovery point of a failed over replication protected item. - - :param fabric_name: The ARM fabric name. Required. - :type fabric_name: str - :param protection_container_name: The protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: The replicated protected item name. Required. - :type replicated_protected_item_name: str - :param apply_recovery_point_input: The ApplyRecoveryPointInput. Required. - :type apply_recovery_point_input: 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 ReplicationProtectedItem or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_apply_recovery_point( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - apply_recovery_point_input: Union[_models.ApplyRecoveryPointInput, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.ReplicationProtectedItem]: - """Change or apply recovery point. - - The operation to change the recovery point of a failed over replication protected item. - - :param fabric_name: The ARM fabric name. Required. - :type fabric_name: str - :param protection_container_name: The protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: The replicated protected item name. Required. - :type replicated_protected_item_name: str - :param apply_recovery_point_input: The ApplyRecoveryPointInput. Is either a - ApplyRecoveryPointInput type or a IO[bytes] type. Required. - :type apply_recovery_point_input: - ~azure.mgmt.recoveryservicessiterecovery.models.ApplyRecoveryPointInput or IO[bytes] - :return: An instance of LROPoller that returns either ReplicationProtectedItem or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :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.ReplicationProtectedItem] = 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._apply_recovery_point_initial( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replicated_protected_item_name=replicated_protected_item_name, - apply_recovery_point_input=apply_recovery_point_input, - 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("ReplicationProtectedItem", 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.ReplicationProtectedItem].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ReplicationProtectedItem]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _failover_cancel_initial( - self, fabric_name: str, protection_container_name: str, replicated_protected_item_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_failover_cancel_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replicated_protected_item_name=replicated_protected_item_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_failover_cancel( - self, fabric_name: str, protection_container_name: str, replicated_protected_item_name: str, **kwargs: Any - ) -> LROPoller[_models.ReplicationProtectedItem]: - """Execute cancel failover. - - Operation to cancel the failover of the replication protected item. - - :param fabric_name: Unique fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. Required. - :type replicated_protected_item_name: str - :return: An instance of LROPoller that returns either ReplicationProtectedItem or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :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.ReplicationProtectedItem] = 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._failover_cancel_initial( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replicated_protected_item_name=replicated_protected_item_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): - deserialized = self._deserialize("ReplicationProtectedItem", 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.ReplicationProtectedItem].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ReplicationProtectedItem]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _failover_commit_initial( - self, fabric_name: str, protection_container_name: str, replicated_protected_item_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_failover_commit_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replicated_protected_item_name=replicated_protected_item_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_failover_commit( - self, fabric_name: str, protection_container_name: str, replicated_protected_item_name: str, **kwargs: Any - ) -> LROPoller[_models.ReplicationProtectedItem]: - """Execute commit failover. - - Operation to commit the failover of the replication protected item. - - :param fabric_name: Unique fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. Required. - :type replicated_protected_item_name: str - :return: An instance of LROPoller that returns either ReplicationProtectedItem or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :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.ReplicationProtectedItem] = 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._failover_commit_initial( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replicated_protected_item_name=replicated_protected_item_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): - deserialized = self._deserialize("ReplicationProtectedItem", 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.ReplicationProtectedItem].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ReplicationProtectedItem]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _planned_failover_initial( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - failover_input: Union[_models.PlannedFailoverInput, 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(failover_input, (IOBase, bytes)): - _content = failover_input - else: - _json = self._serialize.body(failover_input, "PlannedFailoverInput") - - _request = build_planned_failover_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replicated_protected_item_name=replicated_protected_item_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_planned_failover( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - failover_input: _models.PlannedFailoverInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ReplicationProtectedItem]: - """Execute planned failover. - - Operation to initiate a planned failover of the replication protected item. - - :param fabric_name: Unique fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. Required. - :type replicated_protected_item_name: str - :param failover_input: Planned failover input. Required. - :type failover_input: ~azure.mgmt.recoveryservicessiterecovery.models.PlannedFailoverInput - :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 ReplicationProtectedItem or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_planned_failover( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - failover_input: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ReplicationProtectedItem]: - """Execute planned failover. - - Operation to initiate a planned failover of the replication protected item. - - :param fabric_name: Unique fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. Required. - :type replicated_protected_item_name: str - :param failover_input: Planned failover input. Required. - :type failover_input: 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 ReplicationProtectedItem or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_planned_failover( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - failover_input: Union[_models.PlannedFailoverInput, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.ReplicationProtectedItem]: - """Execute planned failover. - - Operation to initiate a planned failover of the replication protected item. - - :param fabric_name: Unique fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. Required. - :type replicated_protected_item_name: str - :param failover_input: Planned failover input. Is either a PlannedFailoverInput type or a - IO[bytes] type. Required. - :type failover_input: ~azure.mgmt.recoveryservicessiterecovery.models.PlannedFailoverInput or - IO[bytes] - :return: An instance of LROPoller that returns either ReplicationProtectedItem or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :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.ReplicationProtectedItem] = 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._planned_failover_initial( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replicated_protected_item_name=replicated_protected_item_name, - failover_input=failover_input, - 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("ReplicationProtectedItem", 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.ReplicationProtectedItem].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ReplicationProtectedItem]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - disable_protection_input: Union[_models.DisableProtectionInput, 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(disable_protection_input, (IOBase, bytes)): - _content = disable_protection_input - else: - _json = self._serialize.body(disable_protection_input, "DisableProtectionInput") - - _request = build_delete_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replicated_protected_item_name=replicated_protected_item_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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 [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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_delete( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - disable_protection_input: _models.DisableProtectionInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Disables protection. - - The operation to disable replication on a replication protected item. This will also remove the - item. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. Required. - :type replicated_protected_item_name: str - :param disable_protection_input: Disable protection input. Required. - :type disable_protection_input: - ~azure.mgmt.recoveryservicessiterecovery.models.DisableProtectionInput - :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_delete( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - disable_protection_input: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Disables protection. - - The operation to disable replication on a replication protected item. This will also remove the - item. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. Required. - :type replicated_protected_item_name: str - :param disable_protection_input: Disable protection input. Required. - :type disable_protection_input: 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_delete( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - disable_protection_input: Union[_models.DisableProtectionInput, IO[bytes]], - **kwargs: Any - ) -> LROPoller[None]: - """Disables protection. - - The operation to disable replication on a replication protected item. This will also remove the - item. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. Required. - :type replicated_protected_item_name: str - :param disable_protection_input: Disable protection input. Is either a DisableProtectionInput - type or a IO[bytes] type. Required. - :type disable_protection_input: - ~azure.mgmt.recoveryservicessiterecovery.models.DisableProtectionInput 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._delete_initial( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replicated_protected_item_name=replicated_protected_item_name, - disable_protection_input=disable_protection_input, - 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 _remove_disks_initial( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - remove_disks_input: Union[_models.RemoveDisksInput, 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(remove_disks_input, (IOBase, bytes)): - _content = remove_disks_input - else: - _json = self._serialize.body(remove_disks_input, "RemoveDisksInput") - - _request = build_remove_disks_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replicated_protected_item_name=replicated_protected_item_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_remove_disks( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - remove_disks_input: _models.RemoveDisksInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ReplicationProtectedItem]: - """Removes disk(s). - - Operation to remove disk(s) from the replication protected item. - - :param fabric_name: Unique fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. Required. - :type replicated_protected_item_name: str - :param remove_disks_input: Remove disks input. Required. - :type remove_disks_input: ~azure.mgmt.recoveryservicessiterecovery.models.RemoveDisksInput - :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 ReplicationProtectedItem or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_remove_disks( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - remove_disks_input: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ReplicationProtectedItem]: - """Removes disk(s). - - Operation to remove disk(s) from the replication protected item. - - :param fabric_name: Unique fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. Required. - :type replicated_protected_item_name: str - :param remove_disks_input: Remove disks input. Required. - :type remove_disks_input: 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 ReplicationProtectedItem or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_remove_disks( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - remove_disks_input: Union[_models.RemoveDisksInput, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.ReplicationProtectedItem]: - """Removes disk(s). - - Operation to remove disk(s) from the replication protected item. - - :param fabric_name: Unique fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. Required. - :type replicated_protected_item_name: str - :param remove_disks_input: Remove disks input. Is either a RemoveDisksInput type or a IO[bytes] - type. Required. - :type remove_disks_input: ~azure.mgmt.recoveryservicessiterecovery.models.RemoveDisksInput or - IO[bytes] - :return: An instance of LROPoller that returns either ReplicationProtectedItem or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :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.ReplicationProtectedItem] = 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._remove_disks_initial( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replicated_protected_item_name=replicated_protected_item_name, - remove_disks_input=remove_disks_input, - 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("ReplicationProtectedItem", 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.ReplicationProtectedItem].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ReplicationProtectedItem]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _repair_replication_initial( - self, fabric_name: str, protection_container_name: str, replicated_protected_item_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_repair_replication_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replicated_protected_item_name=replicated_protected_item_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_repair_replication( - self, fabric_name: str, protection_container_name: str, replicated_protected_item_name: str, **kwargs: Any - ) -> LROPoller[_models.ReplicationProtectedItem]: - """Resynchronize or repair replication. - - The operation to start resynchronize/repair replication for a replication protected item - requiring resynchronization. - - :param fabric_name: The name of the fabric. Required. - :type fabric_name: str - :param protection_container_name: The name of the container. Required. - :type protection_container_name: str - :param replicated_protected_item_name: The name of the replication protected item. Required. - :type replicated_protected_item_name: str - :return: An instance of LROPoller that returns either ReplicationProtectedItem or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :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.ReplicationProtectedItem] = 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._repair_replication_initial( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replicated_protected_item_name=replicated_protected_item_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): - deserialized = self._deserialize("ReplicationProtectedItem", 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.ReplicationProtectedItem].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ReplicationProtectedItem]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _reprotect_initial( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - reprotect_input: Union[_models.ReverseReplicationInput, 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(reprotect_input, (IOBase, bytes)): - _content = reprotect_input - else: - _json = self._serialize.body(reprotect_input, "ReverseReplicationInput") - - _request = build_reprotect_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replicated_protected_item_name=replicated_protected_item_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_reprotect( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - reprotect_input: _models.ReverseReplicationInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ReplicationProtectedItem]: - """Execute Reverse Replication\\Reprotect. - - Operation to reprotect or reverse replicate a failed over replication protected item. - - :param fabric_name: Unique fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. Required. - :type replicated_protected_item_name: str - :param reprotect_input: Reverse replication input. Required. - :type reprotect_input: ~azure.mgmt.recoveryservicessiterecovery.models.ReverseReplicationInput - :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 ReplicationProtectedItem or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_reprotect( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - reprotect_input: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ReplicationProtectedItem]: - """Execute Reverse Replication\\Reprotect. - - Operation to reprotect or reverse replicate a failed over replication protected item. - - :param fabric_name: Unique fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. Required. - :type replicated_protected_item_name: str - :param reprotect_input: Reverse replication input. Required. - :type reprotect_input: 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 ReplicationProtectedItem or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_reprotect( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - reprotect_input: Union[_models.ReverseReplicationInput, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.ReplicationProtectedItem]: - """Execute Reverse Replication\\Reprotect. - - Operation to reprotect or reverse replicate a failed over replication protected item. - - :param fabric_name: Unique fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. Required. - :type replicated_protected_item_name: str - :param reprotect_input: Reverse replication input. Is either a ReverseReplicationInput type or - a IO[bytes] type. Required. - :type reprotect_input: ~azure.mgmt.recoveryservicessiterecovery.models.ReverseReplicationInput - or IO[bytes] - :return: An instance of LROPoller that returns either ReplicationProtectedItem or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :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.ReplicationProtectedItem] = 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._reprotect_initial( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replicated_protected_item_name=replicated_protected_item_name, - reprotect_input=reprotect_input, - 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("ReplicationProtectedItem", 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.ReplicationProtectedItem].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ReplicationProtectedItem]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _resolve_health_errors_initial( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - resolve_health_input: Union[_models.ResolveHealthInput, 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(resolve_health_input, (IOBase, bytes)): - _content = resolve_health_input - else: - _json = self._serialize.body(resolve_health_input, "ResolveHealthInput") - - _request = build_resolve_health_errors_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replicated_protected_item_name=replicated_protected_item_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_resolve_health_errors( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - resolve_health_input: _models.ResolveHealthInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ReplicationProtectedItem]: - """Resolve health errors. - - Operation to resolve health issues of the replication protected item. - - :param fabric_name: Unique fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. Required. - :type replicated_protected_item_name: str - :param resolve_health_input: Health issue input object. Required. - :type resolve_health_input: ~azure.mgmt.recoveryservicessiterecovery.models.ResolveHealthInput - :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 ReplicationProtectedItem or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_resolve_health_errors( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - resolve_health_input: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ReplicationProtectedItem]: - """Resolve health errors. - - Operation to resolve health issues of the replication protected item. - - :param fabric_name: Unique fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. Required. - :type replicated_protected_item_name: str - :param resolve_health_input: Health issue input object. Required. - :type resolve_health_input: 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 ReplicationProtectedItem or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_resolve_health_errors( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - resolve_health_input: Union[_models.ResolveHealthInput, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.ReplicationProtectedItem]: - """Resolve health errors. - - Operation to resolve health issues of the replication protected item. - - :param fabric_name: Unique fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. Required. - :type replicated_protected_item_name: str - :param resolve_health_input: Health issue input object. Is either a ResolveHealthInput type or - a IO[bytes] type. Required. - :type resolve_health_input: ~azure.mgmt.recoveryservicessiterecovery.models.ResolveHealthInput - or IO[bytes] - :return: An instance of LROPoller that returns either ReplicationProtectedItem or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :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.ReplicationProtectedItem] = 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._resolve_health_errors_initial( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replicated_protected_item_name=replicated_protected_item_name, - resolve_health_input=resolve_health_input, - 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("ReplicationProtectedItem", 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.ReplicationProtectedItem].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ReplicationProtectedItem]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _switch_provider_initial( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - switch_provider_input: Union[_models.SwitchProviderInput, 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(switch_provider_input, (IOBase, bytes)): - _content = switch_provider_input - else: - _json = self._serialize.body(switch_provider_input, "SwitchProviderInput") - - _request = build_switch_provider_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replicated_protected_item_name=replicated_protected_item_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_switch_provider( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - switch_provider_input: _models.SwitchProviderInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ReplicationProtectedItem]: - """Execute switch provider. - - Operation to initiate a switch provider of the replication protected item. - - :param fabric_name: Unique fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. Required. - :type replicated_protected_item_name: str - :param switch_provider_input: Switch provider input. Required. - :type switch_provider_input: - ~azure.mgmt.recoveryservicessiterecovery.models.SwitchProviderInput - :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 ReplicationProtectedItem or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_switch_provider( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - switch_provider_input: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ReplicationProtectedItem]: - """Execute switch provider. - - Operation to initiate a switch provider of the replication protected item. - - :param fabric_name: Unique fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. Required. - :type replicated_protected_item_name: str - :param switch_provider_input: Switch provider input. Required. - :type switch_provider_input: 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 ReplicationProtectedItem or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_switch_provider( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - switch_provider_input: Union[_models.SwitchProviderInput, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.ReplicationProtectedItem]: - """Execute switch provider. - - Operation to initiate a switch provider of the replication protected item. - - :param fabric_name: Unique fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. Required. - :type replicated_protected_item_name: str - :param switch_provider_input: Switch provider input. Is either a SwitchProviderInput type or a - IO[bytes] type. Required. - :type switch_provider_input: - ~azure.mgmt.recoveryservicessiterecovery.models.SwitchProviderInput or IO[bytes] - :return: An instance of LROPoller that returns either ReplicationProtectedItem or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :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.ReplicationProtectedItem] = 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._switch_provider_initial( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replicated_protected_item_name=replicated_protected_item_name, - switch_provider_input=switch_provider_input, - 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("ReplicationProtectedItem", 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, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ReplicationProtectedItem].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ReplicationProtectedItem]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _test_failover_initial( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - testfailover_input: Union[_models.TestFailoverInput, 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(testfailover_input, (IOBase, bytes)): - _content = testfailover_input - else: - _json = self._serialize.body(testfailover_input, "TestFailoverInput") - - _request = build_test_failover_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replicated_protected_item_name=replicated_protected_item_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_test_failover( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - testfailover_input: _models.TestFailoverInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ReplicationProtectedItem]: - """Execute test failover. - - Operation to perform a test failover of the replication protected item. - - :param fabric_name: Unique fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. Required. - :type replicated_protected_item_name: str - :param testfailover_input: Test failover input. Required. - :type testfailover_input: ~azure.mgmt.recoveryservicessiterecovery.models.TestFailoverInput - :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 ReplicationProtectedItem or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_test_failover( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - testfailover_input: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ReplicationProtectedItem]: - """Execute test failover. - - Operation to perform a test failover of the replication protected item. - - :param fabric_name: Unique fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. Required. - :type replicated_protected_item_name: str - :param testfailover_input: Test failover input. Required. - :type testfailover_input: 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 ReplicationProtectedItem or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_test_failover( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - testfailover_input: Union[_models.TestFailoverInput, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.ReplicationProtectedItem]: - """Execute test failover. - - Operation to perform a test failover of the replication protected item. - - :param fabric_name: Unique fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. Required. - :type replicated_protected_item_name: str - :param testfailover_input: Test failover input. Is either a TestFailoverInput type or a - IO[bytes] type. Required. - :type testfailover_input: ~azure.mgmt.recoveryservicessiterecovery.models.TestFailoverInput or - IO[bytes] - :return: An instance of LROPoller that returns either ReplicationProtectedItem or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :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.ReplicationProtectedItem] = 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._test_failover_initial( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replicated_protected_item_name=replicated_protected_item_name, - testfailover_input=testfailover_input, - 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("ReplicationProtectedItem", 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.ReplicationProtectedItem].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ReplicationProtectedItem]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _test_failover_cleanup_initial( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - cleanup_input: Union[_models.TestFailoverCleanupInput, 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(cleanup_input, (IOBase, bytes)): - _content = cleanup_input - else: - _json = self._serialize.body(cleanup_input, "TestFailoverCleanupInput") - - _request = build_test_failover_cleanup_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replicated_protected_item_name=replicated_protected_item_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_test_failover_cleanup( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - cleanup_input: _models.TestFailoverCleanupInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ReplicationProtectedItem]: - """Execute test failover cleanup. - - Operation to clean up the test failover of a replication protected item. - - :param fabric_name: Unique fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. Required. - :type replicated_protected_item_name: str - :param cleanup_input: Test failover cleanup input. Required. - :type cleanup_input: ~azure.mgmt.recoveryservicessiterecovery.models.TestFailoverCleanupInput - :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 ReplicationProtectedItem or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_test_failover_cleanup( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - cleanup_input: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ReplicationProtectedItem]: - """Execute test failover cleanup. - - Operation to clean up the test failover of a replication protected item. - - :param fabric_name: Unique fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. Required. - :type replicated_protected_item_name: str - :param cleanup_input: Test failover cleanup input. Required. - :type cleanup_input: 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 ReplicationProtectedItem or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_test_failover_cleanup( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - cleanup_input: Union[_models.TestFailoverCleanupInput, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.ReplicationProtectedItem]: - """Execute test failover cleanup. - - Operation to clean up the test failover of a replication protected item. - - :param fabric_name: Unique fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. Required. - :type replicated_protected_item_name: str - :param cleanup_input: Test failover cleanup input. Is either a TestFailoverCleanupInput type or - a IO[bytes] type. Required. - :type cleanup_input: ~azure.mgmt.recoveryservicessiterecovery.models.TestFailoverCleanupInput - or IO[bytes] - :return: An instance of LROPoller that returns either ReplicationProtectedItem or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :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.ReplicationProtectedItem] = 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._test_failover_cleanup_initial( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replicated_protected_item_name=replicated_protected_item_name, - cleanup_input=cleanup_input, - 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("ReplicationProtectedItem", 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.ReplicationProtectedItem].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ReplicationProtectedItem]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _unplanned_failover_initial( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - failover_input: Union[_models.UnplannedFailoverInput, 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(failover_input, (IOBase, bytes)): - _content = failover_input - else: - _json = self._serialize.body(failover_input, "UnplannedFailoverInput") - - _request = build_unplanned_failover_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replicated_protected_item_name=replicated_protected_item_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_unplanned_failover( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - failover_input: _models.UnplannedFailoverInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ReplicationProtectedItem]: - """Execute unplanned failover. - - Operation to initiate a failover of the replication protected item. - - :param fabric_name: Unique fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. Required. - :type replicated_protected_item_name: str - :param failover_input: Failover input. Required. - :type failover_input: ~azure.mgmt.recoveryservicessiterecovery.models.UnplannedFailoverInput - :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 ReplicationProtectedItem or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_unplanned_failover( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - failover_input: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ReplicationProtectedItem]: - """Execute unplanned failover. - - Operation to initiate a failover of the replication protected item. - - :param fabric_name: Unique fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. Required. - :type replicated_protected_item_name: str - :param failover_input: Failover input. Required. - :type failover_input: 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 ReplicationProtectedItem or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_unplanned_failover( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - failover_input: Union[_models.UnplannedFailoverInput, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.ReplicationProtectedItem]: - """Execute unplanned failover. - - Operation to initiate a failover of the replication protected item. - - :param fabric_name: Unique fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. Required. - :type replicated_protected_item_name: str - :param failover_input: Failover input. Is either a UnplannedFailoverInput type or a IO[bytes] - type. Required. - :type failover_input: ~azure.mgmt.recoveryservicessiterecovery.models.UnplannedFailoverInput or - IO[bytes] - :return: An instance of LROPoller that returns either ReplicationProtectedItem or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :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.ReplicationProtectedItem] = 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._unplanned_failover_initial( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replicated_protected_item_name=replicated_protected_item_name, - failover_input=failover_input, - 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("ReplicationProtectedItem", 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.ReplicationProtectedItem].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ReplicationProtectedItem]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_appliance_initial( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - appliance_update_input: Union[_models.UpdateApplianceForReplicationProtectedItemInput, 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(appliance_update_input, (IOBase, bytes)): - _content = appliance_update_input - else: - _json = self._serialize.body(appliance_update_input, "UpdateApplianceForReplicationProtectedItemInput") - - _request = build_update_appliance_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replicated_protected_item_name=replicated_protected_item_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_appliance( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - appliance_update_input: _models.UpdateApplianceForReplicationProtectedItemInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ReplicationProtectedItem]: - """Updates appliance for replication protected Item. - - The operation to update appliance of an ASR replication protected item. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. Required. - :type replicated_protected_item_name: str - :param appliance_update_input: Appliance update protection input. Required. - :type appliance_update_input: - ~azure.mgmt.recoveryservicessiterecovery.models.UpdateApplianceForReplicationProtectedItemInput - :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 ReplicationProtectedItem or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_appliance( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - appliance_update_input: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ReplicationProtectedItem]: - """Updates appliance for replication protected Item. - - The operation to update appliance of an ASR replication protected item. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. Required. - :type replicated_protected_item_name: str - :param appliance_update_input: Appliance update protection input. Required. - :type appliance_update_input: 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 ReplicationProtectedItem or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_appliance( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - appliance_update_input: Union[_models.UpdateApplianceForReplicationProtectedItemInput, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.ReplicationProtectedItem]: - """Updates appliance for replication protected Item. - - The operation to update appliance of an ASR replication protected item. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. Required. - :type replicated_protected_item_name: str - :param appliance_update_input: Appliance update protection input. Is either a - UpdateApplianceForReplicationProtectedItemInput type or a IO[bytes] type. Required. - :type appliance_update_input: - ~azure.mgmt.recoveryservicessiterecovery.models.UpdateApplianceForReplicationProtectedItemInput - or IO[bytes] - :return: An instance of LROPoller that returns either ReplicationProtectedItem or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :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.ReplicationProtectedItem] = 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_appliance_initial( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replicated_protected_item_name=replicated_protected_item_name, - appliance_update_input=appliance_update_input, - 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("ReplicationProtectedItem", 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.ReplicationProtectedItem].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ReplicationProtectedItem]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_mobility_service_initial( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - update_mobility_service_request: Union[_models.UpdateMobilityServiceRequest, 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(update_mobility_service_request, (IOBase, bytes)): - _content = update_mobility_service_request - else: - _json = self._serialize.body(update_mobility_service_request, "UpdateMobilityServiceRequest") - - _request = build_update_mobility_service_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replicated_protected_item_name=replicated_protected_item_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - 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_mobility_service( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - update_mobility_service_request: _models.UpdateMobilityServiceRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ReplicationProtectedItem]: - """Update the mobility service on a protected item. - - The operation to update(push update) the installed mobility service software on a replication - protected item to the latest available version. - - :param fabric_name: The name of the fabric containing the protected item. Required. - :type fabric_name: str - :param protection_container_name: The name of the container containing the protected item. - Required. - :type protection_container_name: str - :param replicated_protected_item_name: The name of the protected item on which the agent is to - be updated. Required. - :type replicated_protected_item_name: str - :param update_mobility_service_request: Request to update the mobility service on the protected - item. Required. - :type update_mobility_service_request: - ~azure.mgmt.recoveryservicessiterecovery.models.UpdateMobilityServiceRequest - :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 ReplicationProtectedItem or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_mobility_service( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - update_mobility_service_request: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ReplicationProtectedItem]: - """Update the mobility service on a protected item. - - The operation to update(push update) the installed mobility service software on a replication - protected item to the latest available version. - - :param fabric_name: The name of the fabric containing the protected item. Required. - :type fabric_name: str - :param protection_container_name: The name of the container containing the protected item. - Required. - :type protection_container_name: str - :param replicated_protected_item_name: The name of the protected item on which the agent is to - be updated. Required. - :type replicated_protected_item_name: str - :param update_mobility_service_request: Request to update the mobility service on the protected - item. Required. - :type update_mobility_service_request: 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 ReplicationProtectedItem or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_mobility_service( - self, - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - update_mobility_service_request: Union[_models.UpdateMobilityServiceRequest, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.ReplicationProtectedItem]: - """Update the mobility service on a protected item. - - The operation to update(push update) the installed mobility service software on a replication - protected item to the latest available version. - - :param fabric_name: The name of the fabric containing the protected item. Required. - :type fabric_name: str - :param protection_container_name: The name of the container containing the protected item. - Required. - :type protection_container_name: str - :param replicated_protected_item_name: The name of the protected item on which the agent is to - be updated. Required. - :type replicated_protected_item_name: str - :param update_mobility_service_request: Request to update the mobility service on the protected - item. Is either a UpdateMobilityServiceRequest type or a IO[bytes] type. Required. - :type update_mobility_service_request: - ~azure.mgmt.recoveryservicessiterecovery.models.UpdateMobilityServiceRequest or IO[bytes] - :return: An instance of LROPoller that returns either ReplicationProtectedItem or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :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.ReplicationProtectedItem] = 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_mobility_service_initial( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replicated_protected_item_name=replicated_protected_item_name, - update_mobility_service_request=update_mobility_service_request, - 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("ReplicationProtectedItem", 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, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ReplicationProtectedItem].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ReplicationProtectedItem]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, skip_token: Optional[str] = None, filter: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.ReplicationProtectedItem"]: - """Gets the list of replication protected items. - - Gets the list of ASR replication protected items in the vault. - - :param skip_token: The pagination token. Possible values: "FabricId" or "FabricId_CloudId" or - null. Default value is None. - :type skip_token: str - :param filter: OData filter options. Default value is None. - :type filter: str - :return: An iterator like instance of either ReplicationProtectedItem or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectedItem] - :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.ReplicationProtectedItemCollection] = 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_request( - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_name, - subscription_id=self._config.subscription_id, - skip_token=skip_token, - filter=filter, - 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("ReplicationProtectedItemCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_protection_clusters_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_protection_clusters_operations.py deleted file mode 100644 index 0ca481ceaf03..000000000000 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_protection_clusters_operations.py +++ /dev/null @@ -1,2611 +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, Dict, IO, Iterable, 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 SiteRecoveryManagementClientConfiguration -from .._serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_replication_protection_containers_request( # pylint: disable=name-too-long - resource_name: str, - fabric_name: str, - protection_container_name: str, - 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", "2025-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionClusters", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url( - "resource_name", resource_name, "str", pattern=r"^[A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9]$" - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url( - "fabric_name", fabric_name, "str", pattern=r"^[A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9]$" - ), - "protectionContainerName": _SERIALIZER.url( - "protection_container_name", - protection_container_name, - "str", - pattern=r"^[A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9]$", - ), - } - - _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_name: str, - fabric_name: str, - protection_container_name: str, - replication_protection_cluster_name: str, - 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", "2025-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionClusters/{replicationProtectionClusterName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url( - "resource_name", resource_name, "str", pattern=r"^[A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9]$" - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url( - "fabric_name", fabric_name, "str", pattern=r"^[A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9]$" - ), - "protectionContainerName": _SERIALIZER.url( - "protection_container_name", - protection_container_name, - "str", - pattern=r"^[A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9]$", - ), - "replicationProtectionClusterName": _SERIALIZER.url( - "replication_protection_cluster_name", - replication_protection_cluster_name, - "str", - pattern=r"^[A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9]$", - ), - } - - _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( - fabric_name: str, - protection_container_name: str, - replication_protection_cluster_name: str, - resource_group_name: str, - resource_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", "2025-01-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionClusters/{replicationProtectionClusterName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url( - "fabric_name", fabric_name, "str", pattern=r"^[A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9]$" - ), - "protectionContainerName": _SERIALIZER.url( - "protection_container_name", - protection_container_name, - "str", - pattern=r"^[A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9]$", - ), - "replicationProtectionClusterName": _SERIALIZER.url( - "replication_protection_cluster_name", - replication_protection_cluster_name, - "str", - pattern=r"^[A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9]$", - ), - } - - _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_purge_request( - fabric_name: str, - protection_container_name: str, - replication_protection_cluster_name: str, - resource_group_name: str, - resource_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", "2025-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionClusters/{replicationProtectionClusterName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url( - "fabric_name", fabric_name, "str", pattern=r"^[A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9]$" - ), - "protectionContainerName": _SERIALIZER.url( - "protection_container_name", - protection_container_name, - "str", - pattern=r"^[A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9]$", - ), - "replicationProtectionClusterName": _SERIALIZER.url( - "replication_protection_cluster_name", - replication_protection_cluster_name, - "str", - pattern=r"^[A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9]$", - ), - } - - _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_apply_recovery_point_request( - resource_name: str, - fabric_name: str, - protection_container_name: str, - replication_protection_cluster_name: str, - 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", "2025-01-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionClusters/{replicationProtectionClusterName}/applyRecoveryPoint", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url( - "resource_name", resource_name, "str", pattern=r"^[A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9]$" - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url( - "fabric_name", fabric_name, "str", pattern=r"^[A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9]$" - ), - "protectionContainerName": _SERIALIZER.url( - "protection_container_name", - protection_container_name, - "str", - pattern=r"^[A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9]$", - ), - "replicationProtectionClusterName": _SERIALIZER.url( - "replication_protection_cluster_name", - replication_protection_cluster_name, - "str", - pattern=r"^[A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9]$", - ), - } - - _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_failover_commit_request( - resource_name: str, - fabric_name: str, - protection_container_name: str, - replication_protection_cluster_name: str, - 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", "2025-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionClusters/{replicationProtectionClusterName}/failoverCommit", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url( - "resource_name", resource_name, "str", pattern=r"^[A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9]$" - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url( - "fabric_name", fabric_name, "str", pattern=r"^[A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9]$" - ), - "protectionContainerName": _SERIALIZER.url( - "protection_container_name", - protection_container_name, - "str", - pattern=r"^[A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9]$", - ), - "replicationProtectionClusterName": _SERIALIZER.url( - "replication_protection_cluster_name", - replication_protection_cluster_name, - "str", - pattern=r"^[A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9]$", - ), - } - - _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_get_operation_results_request( - resource_name: str, - fabric_name: str, - protection_container_name: str, - replication_protection_cluster_name: str, - job_id: str, - 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", "2025-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionClusters/{replicationProtectionClusterName}/operationResults/{jobId}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url( - "resource_name", resource_name, "str", pattern=r"^[A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9]$" - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url( - "fabric_name", fabric_name, "str", pattern=r"^[A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9]$" - ), - "protectionContainerName": _SERIALIZER.url( - "protection_container_name", - protection_container_name, - "str", - pattern=r"^[A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9]$", - ), - "replicationProtectionClusterName": _SERIALIZER.url( - "replication_protection_cluster_name", - replication_protection_cluster_name, - "str", - pattern=r"^[A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9]$", - ), - "jobId": _SERIALIZER.url("job_id", job_id, "str", pattern=r"^[A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9]$"), - } - - _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_repair_replication_request( - resource_name: str, - fabric_name: str, - protection_container_name: str, - replication_protection_cluster_name: str, - 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", "2025-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionClusters/{replicationProtectionClusterName}/repairReplication", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url( - "resource_name", resource_name, "str", pattern=r"^[A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9]$" - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url( - "fabric_name", fabric_name, "str", pattern=r"^[A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9]$" - ), - "protectionContainerName": _SERIALIZER.url( - "protection_container_name", - protection_container_name, - "str", - pattern=r"^[A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9]$", - ), - "replicationProtectionClusterName": _SERIALIZER.url( - "replication_protection_cluster_name", - replication_protection_cluster_name, - "str", - pattern=r"^[A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9]$", - ), - } - - _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_test_failover_request( - resource_name: str, - fabric_name: str, - protection_container_name: str, - replication_protection_cluster_name: str, - 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", "2025-01-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionClusters/{replicationProtectionClusterName}/testFailover", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url( - "resource_name", resource_name, "str", pattern=r"^[A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9]$" - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url( - "fabric_name", fabric_name, "str", pattern=r"^[A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9]$" - ), - "protectionContainerName": _SERIALIZER.url( - "protection_container_name", - protection_container_name, - "str", - pattern=r"^[A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9]$", - ), - "replicationProtectionClusterName": _SERIALIZER.url( - "replication_protection_cluster_name", - replication_protection_cluster_name, - "str", - pattern=r"^[A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9]$", - ), - } - - _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_test_failover_cleanup_request( - resource_name: str, - fabric_name: str, - protection_container_name: str, - replication_protection_cluster_name: str, - 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", "2025-01-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionClusters/{replicationProtectionClusterName}/testFailoverCleanup", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url( - "resource_name", resource_name, "str", pattern=r"^[A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9]$" - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url( - "fabric_name", fabric_name, "str", pattern=r"^[A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9]$" - ), - "protectionContainerName": _SERIALIZER.url( - "protection_container_name", - protection_container_name, - "str", - pattern=r"^[A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9]$", - ), - "replicationProtectionClusterName": _SERIALIZER.url( - "replication_protection_cluster_name", - replication_protection_cluster_name, - "str", - pattern=r"^[A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9]$", - ), - } - - _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_unplanned_failover_request( - resource_name: str, - fabric_name: str, - protection_container_name: str, - replication_protection_cluster_name: str, - 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", "2025-01-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionClusters/{replicationProtectionClusterName}/unplannedFailover", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url( - "resource_name", resource_name, "str", pattern=r"^[A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9]$" - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url( - "fabric_name", fabric_name, "str", pattern=r"^[A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9]$" - ), - "protectionContainerName": _SERIALIZER.url( - "protection_container_name", - protection_container_name, - "str", - pattern=r"^[A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9]$", - ), - "replicationProtectionClusterName": _SERIALIZER.url( - "replication_protection_cluster_name", - replication_protection_cluster_name, - "str", - pattern=r"^[A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9]$", - ), - } - - _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_list_request( - resource_name: str, - resource_group_name: str, - subscription_id: str, - *, - skip_token: Optional[str] = None, - filter: Optional[str] = None, - **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", "2025-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationProtectionClusters", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url( - "resource_name", resource_name, "str", pattern=r"^[A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9]$" - ), - "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") - if skip_token is not None: - _params["skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class ReplicationProtectionClustersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicessiterecovery.SiteRecoveryManagementClient`'s - :attr:`replication_protection_clusters` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: SiteRecoveryManagementClientConfiguration = ( - 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_replication_protection_containers( # pylint: disable=name-too-long - self, resource_name: str, fabric_name: str, protection_container_name: str, **kwargs: Any - ) -> Iterable["_models.ReplicationProtectionCluster"]: - """Gets the list of Replication protection clusters in fabric, container. - - Gets the list of ASR replication protected clusters in the protection container. - - :param resource_name: The name of the recovery services vault. Required. - :type resource_name: str - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :return: An iterator like instance of either ReplicationProtectionCluster or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster] - :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.ReplicationProtectionClusterCollection] = 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_replication_protection_containers_request( - resource_name=resource_name, - fabric_name=fabric_name, - protection_container_name=protection_container_name, - resource_group_name=self._config.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("ReplicationProtectionClusterCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link 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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, 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_name: str, - fabric_name: str, - protection_container_name: str, - replication_protection_cluster_name: str, - **kwargs: Any - ) -> _models.ReplicationProtectionCluster: - """Gets the details of a Replication protection cluster. - - Gets the details of an ASR replication protection cluster. - - :param resource_name: The name of the recovery services vault. Required. - :type resource_name: str - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replication_protection_cluster_name: Replication protection cluster name. Required. - :type replication_protection_cluster_name: str - :return: ReplicationProtectionCluster or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster - :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.ReplicationProtectionCluster] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_name=resource_name, - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replication_protection_cluster_name=replication_protection_cluster_name, - resource_group_name=self._config.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) - - _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.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ReplicationProtectionCluster", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_initial( - self, - fabric_name: str, - protection_container_name: str, - replication_protection_cluster_name: str, - replication_protection_cluster: Union[_models.ReplicationProtectionCluster, 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(replication_protection_cluster, (IOBase, bytes)): - _content = replication_protection_cluster - else: - _json = self._serialize.body(replication_protection_cluster, "ReplicationProtectionCluster") - - _request = build_create_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replication_protection_cluster_name=replication_protection_cluster_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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.ErrorResponse, 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["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("str", response.headers.get("Retry-After")) - - 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, - fabric_name: str, - protection_container_name: str, - replication_protection_cluster_name: str, - replication_protection_cluster: _models.ReplicationProtectionCluster, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ReplicationProtectionCluster]: - """Create Replication protection Cluster. - - The operation to create an ASR replication protection cluster item. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replication_protection_cluster_name: Replication protection cluster name. Required. - :type replication_protection_cluster_name: str - :param replication_protection_cluster: Create replication protection cluster Input. Required. - :type replication_protection_cluster: - ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster - :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 ReplicationProtectionCluster or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create( - self, - fabric_name: str, - protection_container_name: str, - replication_protection_cluster_name: str, - replication_protection_cluster: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ReplicationProtectionCluster]: - """Create Replication protection Cluster. - - The operation to create an ASR replication protection cluster item. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replication_protection_cluster_name: Replication protection cluster name. Required. - :type replication_protection_cluster_name: str - :param replication_protection_cluster: Create replication protection cluster Input. Required. - :type replication_protection_cluster: 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 ReplicationProtectionCluster or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create( - self, - fabric_name: str, - protection_container_name: str, - replication_protection_cluster_name: str, - replication_protection_cluster: Union[_models.ReplicationProtectionCluster, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.ReplicationProtectionCluster]: - """Create Replication protection Cluster. - - The operation to create an ASR replication protection cluster item. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replication_protection_cluster_name: Replication protection cluster name. Required. - :type replication_protection_cluster_name: str - :param replication_protection_cluster: Create replication protection cluster Input. Is either a - ReplicationProtectionCluster type or a IO[bytes] type. Required. - :type replication_protection_cluster: - ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster or IO[bytes] - :return: An instance of LROPoller that returns either ReplicationProtectionCluster or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster] - :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.ReplicationProtectionCluster] = 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( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replication_protection_cluster_name=replication_protection_cluster_name, - replication_protection_cluster=replication_protection_cluster, - 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("ReplicationProtectionCluster", 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.ReplicationProtectionCluster].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ReplicationProtectionCluster]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _purge_initial( - self, fabric_name: str, protection_container_name: str, replication_protection_cluster_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_purge_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replication_protection_cluster_name=replication_protection_cluster_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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 [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.ErrorResponse, 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["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("str", response.headers.get("Retry-After")) - - 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_purge( - self, fabric_name: str, protection_container_name: str, replication_protection_cluster_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Purge the replication protection cluster. - - The operation to purge the replication protection cluster. This operation will force delete the - replication protection cluster. Use the remove operation on replication protection cluster to - perform a clean disable replication protection cluster. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replication_protection_cluster_name: Replication protection cluster name. Required. - :type replication_protection_cluster_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._purge_initial( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replication_protection_cluster_name=replication_protection_cluster_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, lro_options={"final-state-via": "location"}, **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 _apply_recovery_point_initial( - self, - resource_name: str, - fabric_name: str, - protection_container_name: str, - replication_protection_cluster_name: str, - apply_cluster_recovery_point_input: Union[_models.ApplyClusterRecoveryPointInput, 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(apply_cluster_recovery_point_input, (IOBase, bytes)): - _content = apply_cluster_recovery_point_input - else: - _json = self._serialize.body(apply_cluster_recovery_point_input, "ApplyClusterRecoveryPointInput") - - _request = build_apply_recovery_point_request( - resource_name=resource_name, - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replication_protection_cluster_name=replication_protection_cluster_name, - resource_group_name=self._config.resource_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) - - _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.ErrorResponse, 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["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("str", response.headers.get("Retry-After")) - - 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_apply_recovery_point( - self, - resource_name: str, - fabric_name: str, - protection_container_name: str, - replication_protection_cluster_name: str, - apply_cluster_recovery_point_input: _models.ApplyClusterRecoveryPointInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ReplicationProtectionCluster]: - """Execute the change recovery point operation for cluster. - - Operation to apply a new cluster recovery point on the Protection cluster. - - :param resource_name: The name of the recovery services vault. Required. - :type resource_name: str - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replication_protection_cluster_name: Replication protection cluster name. Required. - :type replication_protection_cluster_name: str - :param apply_cluster_recovery_point_input: Apply recovery point input. Required. - :type apply_cluster_recovery_point_input: - ~azure.mgmt.recoveryservicessiterecovery.models.ApplyClusterRecoveryPointInput - :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 ReplicationProtectionCluster or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_apply_recovery_point( - self, - resource_name: str, - fabric_name: str, - protection_container_name: str, - replication_protection_cluster_name: str, - apply_cluster_recovery_point_input: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ReplicationProtectionCluster]: - """Execute the change recovery point operation for cluster. - - Operation to apply a new cluster recovery point on the Protection cluster. - - :param resource_name: The name of the recovery services vault. Required. - :type resource_name: str - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replication_protection_cluster_name: Replication protection cluster name. Required. - :type replication_protection_cluster_name: str - :param apply_cluster_recovery_point_input: Apply recovery point input. Required. - :type apply_cluster_recovery_point_input: 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 ReplicationProtectionCluster or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_apply_recovery_point( - self, - resource_name: str, - fabric_name: str, - protection_container_name: str, - replication_protection_cluster_name: str, - apply_cluster_recovery_point_input: Union[_models.ApplyClusterRecoveryPointInput, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.ReplicationProtectionCluster]: - """Execute the change recovery point operation for cluster. - - Operation to apply a new cluster recovery point on the Protection cluster. - - :param resource_name: The name of the recovery services vault. Required. - :type resource_name: str - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replication_protection_cluster_name: Replication protection cluster name. Required. - :type replication_protection_cluster_name: str - :param apply_cluster_recovery_point_input: Apply recovery point input. Is either a - ApplyClusterRecoveryPointInput type or a IO[bytes] type. Required. - :type apply_cluster_recovery_point_input: - ~azure.mgmt.recoveryservicessiterecovery.models.ApplyClusterRecoveryPointInput or IO[bytes] - :return: An instance of LROPoller that returns either ReplicationProtectionCluster or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster] - :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.ReplicationProtectionCluster] = 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._apply_recovery_point_initial( - resource_name=resource_name, - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replication_protection_cluster_name=replication_protection_cluster_name, - apply_cluster_recovery_point_input=apply_cluster_recovery_point_input, - 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("ReplicationProtectionCluster", 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, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ReplicationProtectionCluster].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ReplicationProtectionCluster]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _failover_commit_initial( - self, - resource_name: str, - fabric_name: str, - protection_container_name: str, - replication_protection_cluster_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_failover_commit_request( - resource_name=resource_name, - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replication_protection_cluster_name=replication_protection_cluster_name, - resource_group_name=self._config.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) - - _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.ErrorResponse, 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["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("str", response.headers.get("Retry-After")) - - 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_failover_commit( - self, - resource_name: str, - fabric_name: str, - protection_container_name: str, - replication_protection_cluster_name: str, - **kwargs: Any - ) -> LROPoller[_models.ReplicationProtectionCluster]: - """Execute commit failover for cluster. - - Operation to initiate commit failover of the replication protection cluster. - - :param resource_name: The name of the recovery services vault. Required. - :type resource_name: str - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replication_protection_cluster_name: Replication protection cluster name. Required. - :type replication_protection_cluster_name: str - :return: An instance of LROPoller that returns either ReplicationProtectionCluster or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster] - :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.ReplicationProtectionCluster] = 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._failover_commit_initial( - resource_name=resource_name, - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replication_protection_cluster_name=replication_protection_cluster_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): - deserialized = self._deserialize("ReplicationProtectionCluster", 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, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ReplicationProtectionCluster].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ReplicationProtectionCluster]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def get_operation_results( - self, - resource_name: str, - fabric_name: str, - protection_container_name: str, - replication_protection_cluster_name: str, - job_id: str, - **kwargs: Any - ) -> _models.ReplicationProtectionCluster: - """Tracks the Replication protection cluster async operation. - - Track the results of an asynchronous operation on the replication protection cluster. - - :param resource_name: The name of the recovery services vault. Required. - :type resource_name: str - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replication_protection_cluster_name: Replication protection cluster name. Required. - :type replication_protection_cluster_name: str - :param job_id: job id to track. Required. - :type job_id: str - :return: ReplicationProtectionCluster or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster - :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.ReplicationProtectionCluster] = kwargs.pop("cls", None) - - _request = build_get_operation_results_request( - resource_name=resource_name, - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replication_protection_cluster_name=replication_protection_cluster_name, - job_id=job_id, - resource_group_name=self._config.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) - - _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.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ReplicationProtectionCluster", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _repair_replication_initial( - self, - resource_name: str, - fabric_name: str, - protection_container_name: str, - replication_protection_cluster_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_repair_replication_request( - resource_name=resource_name, - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replication_protection_cluster_name=replication_protection_cluster_name, - resource_group_name=self._config.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) - - _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.ErrorResponse, 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["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("str", response.headers.get("Retry-After")) - - 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_repair_replication( - self, - resource_name: str, - fabric_name: str, - protection_container_name: str, - replication_protection_cluster_name: str, - **kwargs: Any - ) -> LROPoller[_models.ReplicationProtectionCluster]: - """Resynchronize or repair replication of protection cluster. - - The operation to repair replication protection cluster. - - :param resource_name: The name of the recovery services vault. Required. - :type resource_name: str - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replication_protection_cluster_name: Replication protection cluster name. Required. - :type replication_protection_cluster_name: str - :return: An instance of LROPoller that returns either ReplicationProtectionCluster or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster] - :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.ReplicationProtectionCluster] = 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._repair_replication_initial( - resource_name=resource_name, - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replication_protection_cluster_name=replication_protection_cluster_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): - deserialized = self._deserialize("ReplicationProtectionCluster", 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, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ReplicationProtectionCluster].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ReplicationProtectionCluster]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _test_failover_initial( - self, - resource_name: str, - fabric_name: str, - protection_container_name: str, - replication_protection_cluster_name: str, - failover_input: Union[_models.ClusterTestFailoverInput, 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(failover_input, (IOBase, bytes)): - _content = failover_input - else: - _json = self._serialize.body(failover_input, "ClusterTestFailoverInput") - - _request = build_test_failover_request( - resource_name=resource_name, - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replication_protection_cluster_name=replication_protection_cluster_name, - resource_group_name=self._config.resource_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) - - _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.ErrorResponse, 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["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("str", response.headers.get("Retry-After")) - - 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_test_failover( - self, - resource_name: str, - fabric_name: str, - protection_container_name: str, - replication_protection_cluster_name: str, - failover_input: _models.ClusterTestFailoverInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ReplicationProtectionCluster]: - """Execute test failover for cluster. - - Operation to initiate a failover of the replication protection cluster. - - :param resource_name: The name of the recovery services vault. Required. - :type resource_name: str - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replication_protection_cluster_name: Replication protection cluster name. Required. - :type replication_protection_cluster_name: str - :param failover_input: Cluster test failover input body. Required. - :type failover_input: ~azure.mgmt.recoveryservicessiterecovery.models.ClusterTestFailoverInput - :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 ReplicationProtectionCluster or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_test_failover( - self, - resource_name: str, - fabric_name: str, - protection_container_name: str, - replication_protection_cluster_name: str, - failover_input: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ReplicationProtectionCluster]: - """Execute test failover for cluster. - - Operation to initiate a failover of the replication protection cluster. - - :param resource_name: The name of the recovery services vault. Required. - :type resource_name: str - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replication_protection_cluster_name: Replication protection cluster name. Required. - :type replication_protection_cluster_name: str - :param failover_input: Cluster test failover input body. Required. - :type failover_input: 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 ReplicationProtectionCluster or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_test_failover( - self, - resource_name: str, - fabric_name: str, - protection_container_name: str, - replication_protection_cluster_name: str, - failover_input: Union[_models.ClusterTestFailoverInput, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.ReplicationProtectionCluster]: - """Execute test failover for cluster. - - Operation to initiate a failover of the replication protection cluster. - - :param resource_name: The name of the recovery services vault. Required. - :type resource_name: str - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replication_protection_cluster_name: Replication protection cluster name. Required. - :type replication_protection_cluster_name: str - :param failover_input: Cluster test failover input body. Is either a ClusterTestFailoverInput - type or a IO[bytes] type. Required. - :type failover_input: ~azure.mgmt.recoveryservicessiterecovery.models.ClusterTestFailoverInput - or IO[bytes] - :return: An instance of LROPoller that returns either ReplicationProtectionCluster or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster] - :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.ReplicationProtectionCluster] = 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._test_failover_initial( - resource_name=resource_name, - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replication_protection_cluster_name=replication_protection_cluster_name, - failover_input=failover_input, - 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("ReplicationProtectionCluster", 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, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ReplicationProtectionCluster].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ReplicationProtectionCluster]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _test_failover_cleanup_initial( - self, - resource_name: str, - fabric_name: str, - protection_container_name: str, - replication_protection_cluster_name: str, - cleanup_input: Union[_models.ClusterTestFailoverCleanupInput, 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(cleanup_input, (IOBase, bytes)): - _content = cleanup_input - else: - _json = self._serialize.body(cleanup_input, "ClusterTestFailoverCleanupInput") - - _request = build_test_failover_cleanup_request( - resource_name=resource_name, - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replication_protection_cluster_name=replication_protection_cluster_name, - resource_group_name=self._config.resource_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) - - _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.ErrorResponse, 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["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("str", response.headers.get("Retry-After")) - - 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_test_failover_cleanup( - self, - resource_name: str, - fabric_name: str, - protection_container_name: str, - replication_protection_cluster_name: str, - cleanup_input: _models.ClusterTestFailoverCleanupInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ReplicationProtectionCluster]: - """Execute test failover cleanup for cluster. - - Operation to clean up the test failover of a replication protected cluster. - - :param resource_name: The name of the recovery services vault. Required. - :type resource_name: str - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replication_protection_cluster_name: Replication protection cluster name. Required. - :type replication_protection_cluster_name: str - :param cleanup_input: Test failover cleanup input. Required. - :type cleanup_input: - ~azure.mgmt.recoveryservicessiterecovery.models.ClusterTestFailoverCleanupInput - :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 ReplicationProtectionCluster or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_test_failover_cleanup( - self, - resource_name: str, - fabric_name: str, - protection_container_name: str, - replication_protection_cluster_name: str, - cleanup_input: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ReplicationProtectionCluster]: - """Execute test failover cleanup for cluster. - - Operation to clean up the test failover of a replication protected cluster. - - :param resource_name: The name of the recovery services vault. Required. - :type resource_name: str - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replication_protection_cluster_name: Replication protection cluster name. Required. - :type replication_protection_cluster_name: str - :param cleanup_input: Test failover cleanup input. Required. - :type cleanup_input: 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 ReplicationProtectionCluster or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_test_failover_cleanup( - self, - resource_name: str, - fabric_name: str, - protection_container_name: str, - replication_protection_cluster_name: str, - cleanup_input: Union[_models.ClusterTestFailoverCleanupInput, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.ReplicationProtectionCluster]: - """Execute test failover cleanup for cluster. - - Operation to clean up the test failover of a replication protected cluster. - - :param resource_name: The name of the recovery services vault. Required. - :type resource_name: str - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replication_protection_cluster_name: Replication protection cluster name. Required. - :type replication_protection_cluster_name: str - :param cleanup_input: Test failover cleanup input. Is either a ClusterTestFailoverCleanupInput - type or a IO[bytes] type. Required. - :type cleanup_input: - ~azure.mgmt.recoveryservicessiterecovery.models.ClusterTestFailoverCleanupInput or IO[bytes] - :return: An instance of LROPoller that returns either ReplicationProtectionCluster or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster] - :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.ReplicationProtectionCluster] = 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._test_failover_cleanup_initial( - resource_name=resource_name, - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replication_protection_cluster_name=replication_protection_cluster_name, - cleanup_input=cleanup_input, - 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("ReplicationProtectionCluster", 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, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ReplicationProtectionCluster].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ReplicationProtectionCluster]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _unplanned_failover_initial( - self, - resource_name: str, - fabric_name: str, - protection_container_name: str, - replication_protection_cluster_name: str, - failover_input: Union[_models.ClusterUnplannedFailoverInput, 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(failover_input, (IOBase, bytes)): - _content = failover_input - else: - _json = self._serialize.body(failover_input, "ClusterUnplannedFailoverInput") - - _request = build_unplanned_failover_request( - resource_name=resource_name, - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replication_protection_cluster_name=replication_protection_cluster_name, - resource_group_name=self._config.resource_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) - - _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.ErrorResponse, 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["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("str", response.headers.get("Retry-After")) - - 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_unplanned_failover( - self, - resource_name: str, - fabric_name: str, - protection_container_name: str, - replication_protection_cluster_name: str, - failover_input: _models.ClusterUnplannedFailoverInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ReplicationProtectionCluster]: - """Execute unplanned cluster failover. - - Operation to initiate a failover of the replication protection cluster. - - :param resource_name: The name of the recovery services vault. Required. - :type resource_name: str - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replication_protection_cluster_name: Replication protection cluster name. Required. - :type replication_protection_cluster_name: str - :param failover_input: Failover input. Required. - :type failover_input: - ~azure.mgmt.recoveryservicessiterecovery.models.ClusterUnplannedFailoverInput - :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 ReplicationProtectionCluster or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_unplanned_failover( - self, - resource_name: str, - fabric_name: str, - protection_container_name: str, - replication_protection_cluster_name: str, - failover_input: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ReplicationProtectionCluster]: - """Execute unplanned cluster failover. - - Operation to initiate a failover of the replication protection cluster. - - :param resource_name: The name of the recovery services vault. Required. - :type resource_name: str - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replication_protection_cluster_name: Replication protection cluster name. Required. - :type replication_protection_cluster_name: str - :param failover_input: Failover input. Required. - :type failover_input: 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 ReplicationProtectionCluster or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_unplanned_failover( - self, - resource_name: str, - fabric_name: str, - protection_container_name: str, - replication_protection_cluster_name: str, - failover_input: Union[_models.ClusterUnplannedFailoverInput, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.ReplicationProtectionCluster]: - """Execute unplanned cluster failover. - - Operation to initiate a failover of the replication protection cluster. - - :param resource_name: The name of the recovery services vault. Required. - :type resource_name: str - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param replication_protection_cluster_name: Replication protection cluster name. Required. - :type replication_protection_cluster_name: str - :param failover_input: Failover input. Is either a ClusterUnplannedFailoverInput type or a - IO[bytes] type. Required. - :type failover_input: - ~azure.mgmt.recoveryservicessiterecovery.models.ClusterUnplannedFailoverInput or IO[bytes] - :return: An instance of LROPoller that returns either ReplicationProtectionCluster or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster] - :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.ReplicationProtectionCluster] = 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._unplanned_failover_initial( - resource_name=resource_name, - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replication_protection_cluster_name=replication_protection_cluster_name, - failover_input=failover_input, - 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("ReplicationProtectionCluster", 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, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ReplicationProtectionCluster].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ReplicationProtectionCluster]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list( - self, resource_name: str, skip_token: Optional[str] = None, filter: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.ReplicationProtectionCluster"]: - """Gets the list of Replication protection clusters in vault. - - Gets the list of ASR replication protected clusters in the vault. - - :param resource_name: The name of the recovery services vault. Required. - :type resource_name: str - :param skip_token: The pagination token. Possible values: "FabricId" or "FabricId_CloudId" or - null. Default value is None. - :type skip_token: str - :param filter: OData filter options. Default value is None. - :type filter: str - :return: An iterator like instance of either ReplicationProtectionCluster or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionCluster] - :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.ReplicationProtectionClusterCollection] = 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_request( - resource_name=resource_name, - resource_group_name=self._config.resource_group_name, - subscription_id=self._config.subscription_id, - skip_token=skip_token, - filter=filter, - 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("ReplicationProtectionClusterCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link 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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_protection_container_mappings_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_protection_container_mappings_operations.py deleted file mode 100644 index df1a976b70c3..000000000000 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_protection_container_mappings_operations.py +++ /dev/null @@ -1,1311 +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, Dict, IO, Iterable, 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 SiteRecoveryManagementClientConfiguration -from .._serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_replication_protection_containers_request( # pylint: disable=name-too-long - fabric_name: str, - protection_container_name: str, - resource_group_name: str, - resource_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", "2025-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), - "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_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( - fabric_name: str, - protection_container_name: str, - mapping_name: str, - resource_group_name: str, - resource_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", "2025-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), - "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), - "mappingName": _SERIALIZER.url("mapping_name", mapping_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( - fabric_name: str, - protection_container_name: str, - mapping_name: str, - resource_group_name: str, - resource_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", "2025-01-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), - "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), - "mappingName": _SERIALIZER.url("mapping_name", mapping_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_purge_request( - fabric_name: str, - protection_container_name: str, - mapping_name: str, - resource_group_name: str, - resource_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", "2025-01-01")) - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), - "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), - "mappingName": _SERIALIZER.url("mapping_name", mapping_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_update_request( - fabric_name: str, - protection_container_name: str, - mapping_name: str, - resource_group_name: str, - resource_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", "2025-01-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), - "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), - "mappingName": _SERIALIZER.url("mapping_name", mapping_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( - fabric_name: str, - protection_container_name: str, - mapping_name: str, - resource_group_name: str, - resource_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", "2025-01-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}/remove", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), - "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), - "mappingName": _SERIALIZER.url("mapping_name", mapping_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_list_request( - resource_group_name: str, resource_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", "2025-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationProtectionContainerMappings", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "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) - - -class ReplicationProtectionContainerMappingsOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicessiterecovery.SiteRecoveryManagementClient`'s - :attr:`replication_protection_container_mappings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: SiteRecoveryManagementClientConfiguration = ( - 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_replication_protection_containers( # pylint: disable=name-too-long - self, fabric_name: str, protection_container_name: str, **kwargs: Any - ) -> Iterable["_models.ProtectionContainerMapping"]: - """Gets the list of protection container mappings for a protection container. - - Lists the protection container mappings for a protection container. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :return: An iterator like instance of either ProtectionContainerMapping or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerMapping] - :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.ProtectionContainerMappingCollection] = 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_replication_protection_containers_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("ProtectionContainerMappingCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get( - self, fabric_name: str, protection_container_name: str, mapping_name: str, **kwargs: Any - ) -> _models.ProtectionContainerMapping: - """Gets a protection container mapping. - - Gets the details of a protection container mapping. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param mapping_name: Protection Container mapping name. Required. - :type mapping_name: str - :return: ProtectionContainerMapping or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerMapping - :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.ProtectionContainerMapping] = kwargs.pop("cls", None) - - _request = build_get_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - mapping_name=mapping_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("ProtectionContainerMapping", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_initial( - self, - fabric_name: str, - protection_container_name: str, - mapping_name: str, - creation_input: Union[_models.CreateProtectionContainerMappingInput, 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(creation_input, (IOBase, bytes)): - _content = creation_input - else: - _json = self._serialize.body(creation_input, "CreateProtectionContainerMappingInput") - - _request = build_create_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - mapping_name=mapping_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create( - self, - fabric_name: str, - protection_container_name: str, - mapping_name: str, - creation_input: _models.CreateProtectionContainerMappingInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ProtectionContainerMapping]: - """Create protection container mapping. - - The operation to create a protection container mapping. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param mapping_name: Protection container mapping name. Required. - :type mapping_name: str - :param creation_input: Mapping creation input. Required. - :type creation_input: - ~azure.mgmt.recoveryservicessiterecovery.models.CreateProtectionContainerMappingInput - :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 ProtectionContainerMapping or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerMapping] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create( - self, - fabric_name: str, - protection_container_name: str, - mapping_name: str, - creation_input: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ProtectionContainerMapping]: - """Create protection container mapping. - - The operation to create a protection container mapping. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param mapping_name: Protection container mapping name. Required. - :type mapping_name: str - :param creation_input: Mapping creation input. Required. - :type creation_input: 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 ProtectionContainerMapping or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerMapping] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create( - self, - fabric_name: str, - protection_container_name: str, - mapping_name: str, - creation_input: Union[_models.CreateProtectionContainerMappingInput, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.ProtectionContainerMapping]: - """Create protection container mapping. - - The operation to create a protection container mapping. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param mapping_name: Protection container mapping name. Required. - :type mapping_name: str - :param creation_input: Mapping creation input. Is either a - CreateProtectionContainerMappingInput type or a IO[bytes] type. Required. - :type creation_input: - ~azure.mgmt.recoveryservicessiterecovery.models.CreateProtectionContainerMappingInput or - IO[bytes] - :return: An instance of LROPoller that returns either ProtectionContainerMapping or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerMapping] - :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.ProtectionContainerMapping] = 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( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - mapping_name=mapping_name, - creation_input=creation_input, - 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("ProtectionContainerMapping", 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.ProtectionContainerMapping].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ProtectionContainerMapping]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _purge_initial( - self, fabric_name: str, protection_container_name: str, mapping_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_purge_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - mapping_name=mapping_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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 [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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_purge( - self, fabric_name: str, protection_container_name: str, mapping_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Purge protection container mapping. - - The operation to purge(force delete) a protection container mapping. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param mapping_name: Protection container mapping name. Required. - :type mapping_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._purge_initial( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - mapping_name=mapping_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 - - def _update_initial( - self, - fabric_name: str, - protection_container_name: str, - mapping_name: str, - update_input: Union[_models.UpdateProtectionContainerMappingInput, 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(update_input, (IOBase, bytes)): - _content = update_input - else: - _json = self._serialize.body(update_input, "UpdateProtectionContainerMappingInput") - - _request = build_update_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - mapping_name=mapping_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - fabric_name: str, - protection_container_name: str, - mapping_name: str, - update_input: _models.UpdateProtectionContainerMappingInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ProtectionContainerMapping]: - """Update protection container mapping. - - The operation to update protection container mapping. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param mapping_name: Protection container mapping name. Required. - :type mapping_name: str - :param update_input: Mapping update input. Required. - :type update_input: - ~azure.mgmt.recoveryservicessiterecovery.models.UpdateProtectionContainerMappingInput - :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 ProtectionContainerMapping or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerMapping] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - fabric_name: str, - protection_container_name: str, - mapping_name: str, - update_input: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ProtectionContainerMapping]: - """Update protection container mapping. - - The operation to update protection container mapping. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param mapping_name: Protection container mapping name. Required. - :type mapping_name: str - :param update_input: Mapping update input. Required. - :type update_input: 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 ProtectionContainerMapping or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerMapping] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - fabric_name: str, - protection_container_name: str, - mapping_name: str, - update_input: Union[_models.UpdateProtectionContainerMappingInput, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.ProtectionContainerMapping]: - """Update protection container mapping. - - The operation to update protection container mapping. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param mapping_name: Protection container mapping name. Required. - :type mapping_name: str - :param update_input: Mapping update input. Is either a UpdateProtectionContainerMappingInput - type or a IO[bytes] type. Required. - :type update_input: - ~azure.mgmt.recoveryservicessiterecovery.models.UpdateProtectionContainerMappingInput or - IO[bytes] - :return: An instance of LROPoller that returns either ProtectionContainerMapping or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerMapping] - :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.ProtectionContainerMapping] = 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( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - mapping_name=mapping_name, - update_input=update_input, - 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("ProtectionContainerMapping", 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.ProtectionContainerMapping].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ProtectionContainerMapping]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, - fabric_name: str, - protection_container_name: str, - mapping_name: str, - removal_input: Union[_models.RemoveProtectionContainerMappingInput, 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(removal_input, (IOBase, bytes)): - _content = removal_input - else: - _json = self._serialize.body(removal_input, "RemoveProtectionContainerMappingInput") - - _request = build_delete_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - mapping_name=mapping_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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 [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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_delete( - self, - fabric_name: str, - protection_container_name: str, - mapping_name: str, - removal_input: _models.RemoveProtectionContainerMappingInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Remove protection container mapping. - - The operation to delete or remove a protection container mapping. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param mapping_name: Protection container mapping name. Required. - :type mapping_name: str - :param removal_input: Removal input. Required. - :type removal_input: - ~azure.mgmt.recoveryservicessiterecovery.models.RemoveProtectionContainerMappingInput - :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_delete( - self, - fabric_name: str, - protection_container_name: str, - mapping_name: str, - removal_input: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Remove protection container mapping. - - The operation to delete or remove a protection container mapping. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param mapping_name: Protection container mapping name. Required. - :type mapping_name: str - :param removal_input: Removal input. Required. - :type removal_input: 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_delete( - self, - fabric_name: str, - protection_container_name: str, - mapping_name: str, - removal_input: Union[_models.RemoveProtectionContainerMappingInput, IO[bytes]], - **kwargs: Any - ) -> LROPoller[None]: - """Remove protection container mapping. - - The operation to delete or remove a protection container mapping. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param mapping_name: Protection container mapping name. Required. - :type mapping_name: str - :param removal_input: Removal input. Is either a RemoveProtectionContainerMappingInput type or - a IO[bytes] type. Required. - :type removal_input: - ~azure.mgmt.recoveryservicessiterecovery.models.RemoveProtectionContainerMappingInput 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._delete_initial( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - mapping_name=mapping_name, - removal_input=removal_input, - 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 list(self, **kwargs: Any) -> Iterable["_models.ProtectionContainerMapping"]: - """Gets the list of all protection container mappings in a vault. - - Lists the protection container mappings in the vault. - - :return: An iterator like instance of either ProtectionContainerMapping or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainerMapping] - :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.ProtectionContainerMappingCollection] = 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_request( - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("ProtectionContainerMappingCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_protection_containers_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_protection_containers_operations.py deleted file mode 100644 index 62f58f666670..000000000000 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_protection_containers_operations.py +++ /dev/null @@ -1,1535 +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, Dict, IO, Iterable, 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 SiteRecoveryManagementClientConfiguration -from .._serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_replication_fabrics_request( # pylint: disable=name-too-long - fabric_name: str, resource_group_name: str, resource_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", "2025-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url("fabric_name", fabric_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( - fabric_name: str, - protection_container_name: str, - resource_group_name: str, - resource_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", "2025-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), - "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_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( - fabric_name: str, - protection_container_name: str, - resource_group_name: str, - resource_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", "2025-01-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), - "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_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_discover_protectable_item_request( - fabric_name: str, - protection_container_name: str, - resource_group_name: str, - resource_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", "2025-01-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/discoverProtectableItem", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), - "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_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_delete_request( - fabric_name: str, - protection_container_name: str, - resource_group_name: str, - resource_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", "2025-01-01")) - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/remove", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), - "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_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_switch_cluster_protection_request( - resource_name: str, - fabric_name: str, - protection_container_name: str, - 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", "2025-01-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/switchClusterProtection", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url( - "resource_name", resource_name, "str", pattern=r"^[A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9]$" - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url( - "fabric_name", fabric_name, "str", pattern=r"^[A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9]$" - ), - "protectionContainerName": _SERIALIZER.url( - "protection_container_name", - protection_container_name, - "str", - pattern=r"^[A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9]$", - ), - } - - _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_switch_protection_request( - fabric_name: str, - protection_container_name: str, - resource_group_name: str, - resource_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", "2025-01-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/switchprotection", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), - "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_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_list_request( - resource_group_name: str, resource_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", "2025-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationProtectionContainers", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "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) - - -class ReplicationProtectionContainersOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicessiterecovery.SiteRecoveryManagementClient`'s - :attr:`replication_protection_containers` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: SiteRecoveryManagementClientConfiguration = ( - 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_replication_fabrics(self, fabric_name: str, **kwargs: Any) -> Iterable["_models.ProtectionContainer"]: - """Gets the list of protection container for a fabric. - - Lists the protection containers in the specified fabric. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :return: An iterator like instance of either ProtectionContainer or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] - :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.ProtectionContainerCollection] = 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_replication_fabrics_request( - fabric_name=fabric_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("ProtectionContainerCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get(self, fabric_name: str, protection_container_name: str, **kwargs: Any) -> _models.ProtectionContainer: - """Gets the protection container details. - - Gets the details of a protection container. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :return: ProtectionContainer or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer - :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.ProtectionContainer] = kwargs.pop("cls", None) - - _request = build_get_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("ProtectionContainer", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_initial( - self, - fabric_name: str, - protection_container_name: str, - creation_input: Union[_models.CreateProtectionContainerInput, 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(creation_input, (IOBase, bytes)): - _content = creation_input - else: - _json = self._serialize.body(creation_input, "CreateProtectionContainerInput") - - _request = build_create_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create( - self, - fabric_name: str, - protection_container_name: str, - creation_input: _models.CreateProtectionContainerInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ProtectionContainer]: - """Create a protection container. - - Operation to create a protection container. - - :param fabric_name: Unique fabric ARM name. Required. - :type fabric_name: str - :param protection_container_name: Unique protection container ARM name. Required. - :type protection_container_name: str - :param creation_input: Creation input. Required. - :type creation_input: - ~azure.mgmt.recoveryservicessiterecovery.models.CreateProtectionContainerInput - :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 ProtectionContainer or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create( - self, - fabric_name: str, - protection_container_name: str, - creation_input: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ProtectionContainer]: - """Create a protection container. - - Operation to create a protection container. - - :param fabric_name: Unique fabric ARM name. Required. - :type fabric_name: str - :param protection_container_name: Unique protection container ARM name. Required. - :type protection_container_name: str - :param creation_input: Creation input. Required. - :type creation_input: 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 ProtectionContainer or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create( - self, - fabric_name: str, - protection_container_name: str, - creation_input: Union[_models.CreateProtectionContainerInput, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.ProtectionContainer]: - """Create a protection container. - - Operation to create a protection container. - - :param fabric_name: Unique fabric ARM name. Required. - :type fabric_name: str - :param protection_container_name: Unique protection container ARM name. Required. - :type protection_container_name: str - :param creation_input: Creation input. Is either a CreateProtectionContainerInput type or a - IO[bytes] type. Required. - :type creation_input: - ~azure.mgmt.recoveryservicessiterecovery.models.CreateProtectionContainerInput or IO[bytes] - :return: An instance of LROPoller that returns either ProtectionContainer or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] - :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.ProtectionContainer] = 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( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - creation_input=creation_input, - 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("ProtectionContainer", 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.ProtectionContainer].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ProtectionContainer]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _discover_protectable_item_initial( - self, - fabric_name: str, - protection_container_name: str, - discover_protectable_item_request: Union[_models.DiscoverProtectableItemRequest, 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(discover_protectable_item_request, (IOBase, bytes)): - _content = discover_protectable_item_request - else: - _json = self._serialize.body(discover_protectable_item_request, "DiscoverProtectableItemRequest") - - _request = build_discover_protectable_item_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_discover_protectable_item( - self, - fabric_name: str, - protection_container_name: str, - discover_protectable_item_request: _models.DiscoverProtectableItemRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ProtectionContainer]: - """Adds a protectable item to the replication protection container. - - The operation to a add a protectable item to a protection container(Add physical server). - - :param fabric_name: The name of the fabric. Required. - :type fabric_name: str - :param protection_container_name: The name of the protection container. Required. - :type protection_container_name: str - :param discover_protectable_item_request: The request object to add a protectable item. - Required. - :type discover_protectable_item_request: - ~azure.mgmt.recoveryservicessiterecovery.models.DiscoverProtectableItemRequest - :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 ProtectionContainer or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_discover_protectable_item( - self, - fabric_name: str, - protection_container_name: str, - discover_protectable_item_request: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ProtectionContainer]: - """Adds a protectable item to the replication protection container. - - The operation to a add a protectable item to a protection container(Add physical server). - - :param fabric_name: The name of the fabric. Required. - :type fabric_name: str - :param protection_container_name: The name of the protection container. Required. - :type protection_container_name: str - :param discover_protectable_item_request: The request object to add a protectable item. - Required. - :type discover_protectable_item_request: 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 ProtectionContainer or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_discover_protectable_item( - self, - fabric_name: str, - protection_container_name: str, - discover_protectable_item_request: Union[_models.DiscoverProtectableItemRequest, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.ProtectionContainer]: - """Adds a protectable item to the replication protection container. - - The operation to a add a protectable item to a protection container(Add physical server). - - :param fabric_name: The name of the fabric. Required. - :type fabric_name: str - :param protection_container_name: The name of the protection container. Required. - :type protection_container_name: str - :param discover_protectable_item_request: The request object to add a protectable item. Is - either a DiscoverProtectableItemRequest type or a IO[bytes] type. Required. - :type discover_protectable_item_request: - ~azure.mgmt.recoveryservicessiterecovery.models.DiscoverProtectableItemRequest or IO[bytes] - :return: An instance of LROPoller that returns either ProtectionContainer or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] - :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.ProtectionContainer] = 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._discover_protectable_item_initial( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - discover_protectable_item_request=discover_protectable_item_request, - 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("ProtectionContainer", 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.ProtectionContainer].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ProtectionContainer]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial(self, fabric_name: str, protection_container_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( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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 [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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete(self, fabric_name: str, protection_container_name: str, **kwargs: Any) -> LROPoller[None]: - """Removes a protection container. - - Operation to remove a protection container. - - :param fabric_name: Unique fabric ARM name. Required. - :type fabric_name: str - :param protection_container_name: Unique protection container ARM name. Required. - :type protection_container_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( - fabric_name=fabric_name, - protection_container_name=protection_container_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 - - def _switch_cluster_protection_initial( - self, - resource_name: str, - fabric_name: str, - protection_container_name: str, - switch_input: Union[_models.SwitchClusterProtectionInput, 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(switch_input, (IOBase, bytes)): - _content = switch_input - else: - _json = self._serialize.body(switch_input, "SwitchClusterProtectionInput") - - _request = build_switch_cluster_protection_request( - resource_name=resource_name, - fabric_name=fabric_name, - protection_container_name=protection_container_name, - resource_group_name=self._config.resource_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) - - _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.ErrorResponse, 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["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("str", response.headers.get("Retry-After")) - - 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_switch_cluster_protection( - self, - resource_name: str, - fabric_name: str, - protection_container_name: str, - switch_input: _models.SwitchClusterProtectionInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ProtectionContainer]: - """Switches protection from one container to another. - - Operation to switch protection from one container to another. - - :param resource_name: The name of the recovery services vault. Required. - :type resource_name: str - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param switch_input: Switch protection input. Required. - :type switch_input: - ~azure.mgmt.recoveryservicessiterecovery.models.SwitchClusterProtectionInput - :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 ProtectionContainer or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_switch_cluster_protection( - self, - resource_name: str, - fabric_name: str, - protection_container_name: str, - switch_input: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ProtectionContainer]: - """Switches protection from one container to another. - - Operation to switch protection from one container to another. - - :param resource_name: The name of the recovery services vault. Required. - :type resource_name: str - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param switch_input: Switch protection input. Required. - :type switch_input: 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 ProtectionContainer or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_switch_cluster_protection( - self, - resource_name: str, - fabric_name: str, - protection_container_name: str, - switch_input: Union[_models.SwitchClusterProtectionInput, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.ProtectionContainer]: - """Switches protection from one container to another. - - Operation to switch protection from one container to another. - - :param resource_name: The name of the recovery services vault. Required. - :type resource_name: str - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param switch_input: Switch protection input. Is either a SwitchClusterProtectionInput type or - a IO[bytes] type. Required. - :type switch_input: - ~azure.mgmt.recoveryservicessiterecovery.models.SwitchClusterProtectionInput or IO[bytes] - :return: An instance of LROPoller that returns either ProtectionContainer or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] - :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.ProtectionContainer] = 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._switch_cluster_protection_initial( - resource_name=resource_name, - fabric_name=fabric_name, - protection_container_name=protection_container_name, - switch_input=switch_input, - 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("ProtectionContainer", 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, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ProtectionContainer].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ProtectionContainer]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _switch_protection_initial( - self, - fabric_name: str, - protection_container_name: str, - switch_input: Union[_models.SwitchProtectionInput, 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(switch_input, (IOBase, bytes)): - _content = switch_input - else: - _json = self._serialize.body(switch_input, "SwitchProtectionInput") - - _request = build_switch_protection_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("str", response.headers.get("Retry-After")) - - 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_switch_protection( - self, - fabric_name: str, - protection_container_name: str, - switch_input: _models.SwitchProtectionInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ProtectionContainer]: - """Switches protection from one container to another or one replication provider to another. - - Operation to switch protection from one container to another or one replication provider to - another. - - :param fabric_name: Unique fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param switch_input: Switch protection input. Required. - :type switch_input: ~azure.mgmt.recoveryservicessiterecovery.models.SwitchProtectionInput - :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 ProtectionContainer or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_switch_protection( - self, - fabric_name: str, - protection_container_name: str, - switch_input: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ProtectionContainer]: - """Switches protection from one container to another or one replication provider to another. - - Operation to switch protection from one container to another or one replication provider to - another. - - :param fabric_name: Unique fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param switch_input: Switch protection input. Required. - :type switch_input: 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 ProtectionContainer or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_switch_protection( - self, - fabric_name: str, - protection_container_name: str, - switch_input: Union[_models.SwitchProtectionInput, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.ProtectionContainer]: - """Switches protection from one container to another or one replication provider to another. - - Operation to switch protection from one container to another or one replication provider to - another. - - :param fabric_name: Unique fabric name. Required. - :type fabric_name: str - :param protection_container_name: Protection container name. Required. - :type protection_container_name: str - :param switch_input: Switch protection input. Is either a SwitchProtectionInput type or a - IO[bytes] type. Required. - :type switch_input: ~azure.mgmt.recoveryservicessiterecovery.models.SwitchProtectionInput or - IO[bytes] - :return: An instance of LROPoller that returns either ProtectionContainer or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] - :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.ProtectionContainer] = 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._switch_protection_initial( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - switch_input=switch_input, - 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("ProtectionContainer", 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.ProtectionContainer].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ProtectionContainer]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.ProtectionContainer"]: - """Gets the list of all protection containers in a vault. - - Lists the protection containers in a vault. - - :return: An iterator like instance of either ProtectionContainer or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.ProtectionContainer] - :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.ProtectionContainerCollection] = 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_request( - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("ProtectionContainerCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_protection_intents_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_protection_intents_operations.py deleted file mode 100644 index 744bd2dcf1ba..000000000000 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_protection_intents_operations.py +++ /dev/null @@ -1,429 +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, Dict, IO, Iterable, 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 SiteRecoveryManagementClientConfiguration -from .._serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request( - resource_group_name: str, - resource_name: str, - subscription_id: str, - *, - skip_token: Optional[str] = None, - take_token: Optional[str] = None, - **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", "2025-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationProtectionIntents", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "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") - if skip_token is not None: - _params["skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") - if take_token is not None: - _params["takeToken"] = _SERIALIZER.query("take_token", take_token, "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( - intent_object_name: str, resource_group_name: str, resource_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", "2025-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationProtectionIntents/{intentObjectName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "intentObjectName": _SERIALIZER.url("intent_object_name", intent_object_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( - intent_object_name: str, resource_group_name: str, resource_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", "2025-01-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.RecoveryServices/vaults/{resourceName}/replicationProtectionIntents/{intentObjectName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "intentObjectName": _SERIALIZER.url("intent_object_name", intent_object_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) - - -class ReplicationProtectionIntentsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicessiterecovery.SiteRecoveryManagementClient`'s - :attr:`replication_protection_intents` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: SiteRecoveryManagementClientConfiguration = ( - 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, skip_token: Optional[str] = None, take_token: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.ReplicationProtectionIntent"]: - """Gets the list of replication protection intent objects. - - Gets the list of ASR replication protection intent objects in the vault. - - :param skip_token: The pagination token. Default value is None. - :type skip_token: str - :param take_token: The page size. Default value is None. - :type take_token: str - :return: An iterator like instance of either ReplicationProtectionIntent or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionIntent] - :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.ReplicationProtectionIntentCollection] = 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_request( - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_name, - subscription_id=self._config.subscription_id, - skip_token=skip_token, - take_token=take_token, - 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("ReplicationProtectionIntentCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get(self, intent_object_name: str, **kwargs: Any) -> _models.ReplicationProtectionIntent: - """Gets the details of a Replication protection intent item. - - Gets the details of an ASR replication protection intent. - - :param intent_object_name: Replication protection intent name. Required. - :type intent_object_name: str - :return: ReplicationProtectionIntent or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionIntent - :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.ReplicationProtectionIntent] = kwargs.pop("cls", None) - - _request = build_get_request( - intent_object_name=intent_object_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("ReplicationProtectionIntent", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def create( - self, - intent_object_name: str, - input: _models.CreateProtectionIntentInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ReplicationProtectionIntent: - """Create protection intent Resource. - - The operation to create an ASR replication protection intent item. - - :param intent_object_name: A name for the replication protection item. Required. - :type intent_object_name: str - :param input: Create Protection Intent Input. Required. - :type input: ~azure.mgmt.recoveryservicessiterecovery.models.CreateProtectionIntentInput - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ReplicationProtectionIntent or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionIntent - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create( - self, intent_object_name: str, input: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.ReplicationProtectionIntent: - """Create protection intent Resource. - - The operation to create an ASR replication protection intent item. - - :param intent_object_name: A name for the replication protection item. Required. - :type intent_object_name: str - :param input: Create Protection Intent Input. Required. - :type input: 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: ReplicationProtectionIntent or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionIntent - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create( - self, intent_object_name: str, input: Union[_models.CreateProtectionIntentInput, IO[bytes]], **kwargs: Any - ) -> _models.ReplicationProtectionIntent: - """Create protection intent Resource. - - The operation to create an ASR replication protection intent item. - - :param intent_object_name: A name for the replication protection item. Required. - :type intent_object_name: str - :param input: Create Protection Intent Input. Is either a CreateProtectionIntentInput type or a - IO[bytes] type. Required. - :type input: ~azure.mgmt.recoveryservicessiterecovery.models.CreateProtectionIntentInput or - IO[bytes] - :return: ReplicationProtectionIntent or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.ReplicationProtectionIntent - :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.ReplicationProtectionIntent] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(input, (IOBase, bytes)): - _content = input - else: - _json = self._serialize.body(input, "CreateProtectionIntentInput") - - _request = build_create_request( - intent_object_name=intent_object_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("ReplicationProtectionIntent", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_recovery_plans_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_recovery_plans_operations.py deleted file mode 100644 index d402c1307673..000000000000 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_recovery_plans_operations.py +++ /dev/null @@ -1,2094 +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, Dict, IO, Iterable, 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 SiteRecoveryManagementClientConfiguration -from .._serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request( - resource_group_name: str, resource_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", "2025-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "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_get_request( - recovery_plan_name: str, resource_group_name: str, resource_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", "2025-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "recoveryPlanName": _SERIALIZER.url("recovery_plan_name", recovery_plan_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( - recovery_plan_name: str, resource_group_name: str, resource_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", "2025-01-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.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "recoveryPlanName": _SERIALIZER.url("recovery_plan_name", recovery_plan_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( - recovery_plan_name: str, resource_group_name: str, resource_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", "2025-01-01")) - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "recoveryPlanName": _SERIALIZER.url("recovery_plan_name", recovery_plan_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_update_request( - recovery_plan_name: str, resource_group_name: str, resource_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", "2025-01-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.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "recoveryPlanName": _SERIALIZER.url("recovery_plan_name", recovery_plan_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_failover_cancel_request( - recovery_plan_name: str, resource_group_name: str, resource_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", "2025-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/failoverCancel", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "recoveryPlanName": _SERIALIZER.url("recovery_plan_name", recovery_plan_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_failover_commit_request( - recovery_plan_name: str, resource_group_name: str, resource_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", "2025-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/failoverCommit", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "recoveryPlanName": _SERIALIZER.url("recovery_plan_name", recovery_plan_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_planned_failover_request( - recovery_plan_name: str, resource_group_name: str, resource_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", "2025-01-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.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/plannedFailover", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "recoveryPlanName": _SERIALIZER.url("recovery_plan_name", recovery_plan_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_reprotect_request( - recovery_plan_name: str, resource_group_name: str, resource_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", "2025-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/reProtect", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "recoveryPlanName": _SERIALIZER.url("recovery_plan_name", recovery_plan_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_test_failover_request( - recovery_plan_name: str, resource_group_name: str, resource_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", "2025-01-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.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/testFailover", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "recoveryPlanName": _SERIALIZER.url("recovery_plan_name", recovery_plan_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_test_failover_cleanup_request( - recovery_plan_name: str, resource_group_name: str, resource_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", "2025-01-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.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/testFailoverCleanup", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "recoveryPlanName": _SERIALIZER.url("recovery_plan_name", recovery_plan_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_unplanned_failover_request( - recovery_plan_name: str, resource_group_name: str, resource_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", "2025-01-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.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/unplannedFailover", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "recoveryPlanName": _SERIALIZER.url("recovery_plan_name", recovery_plan_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 ReplicationRecoveryPlansOperations: # pylint: disable=too-many-public-methods - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicessiterecovery.SiteRecoveryManagementClient`'s - :attr:`replication_recovery_plans` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: SiteRecoveryManagementClientConfiguration = ( - 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) -> Iterable["_models.RecoveryPlan"]: - """Gets the list of recovery plans. - - Lists the recovery plans in the vault. - - :return: An iterator like instance of either RecoveryPlan or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] - :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.RecoveryPlanCollection] = 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_request( - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("RecoveryPlanCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get(self, recovery_plan_name: str, **kwargs: Any) -> _models.RecoveryPlan: - """Gets the requested recovery plan. - - Gets the details of the recovery plan. - - :param recovery_plan_name: Name of the recovery plan. Required. - :type recovery_plan_name: str - :return: RecoveryPlan or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan - :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.RecoveryPlan] = kwargs.pop("cls", None) - - _request = build_get_request( - recovery_plan_name=recovery_plan_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("RecoveryPlan", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_initial( - self, recovery_plan_name: str, input: Union[_models.CreateRecoveryPlanInput, 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(input, (IOBase, bytes)): - _content = input - else: - _json = self._serialize.body(input, "CreateRecoveryPlanInput") - - _request = build_create_request( - recovery_plan_name=recovery_plan_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create( - self, - recovery_plan_name: str, - input: _models.CreateRecoveryPlanInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.RecoveryPlan]: - """Creates a recovery plan with the given details. - - The operation to create a recovery plan. - - :param recovery_plan_name: Recovery plan name. Required. - :type recovery_plan_name: str - :param input: Recovery Plan creation input. Required. - :type input: ~azure.mgmt.recoveryservicessiterecovery.models.CreateRecoveryPlanInput - :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 RecoveryPlan or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create( - self, recovery_plan_name: str, input: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.RecoveryPlan]: - """Creates a recovery plan with the given details. - - The operation to create a recovery plan. - - :param recovery_plan_name: Recovery plan name. Required. - :type recovery_plan_name: str - :param input: Recovery Plan creation input. Required. - :type input: 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 RecoveryPlan or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create( - self, recovery_plan_name: str, input: Union[_models.CreateRecoveryPlanInput, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.RecoveryPlan]: - """Creates a recovery plan with the given details. - - The operation to create a recovery plan. - - :param recovery_plan_name: Recovery plan name. Required. - :type recovery_plan_name: str - :param input: Recovery Plan creation input. Is either a CreateRecoveryPlanInput type or a - IO[bytes] type. Required. - :type input: ~azure.mgmt.recoveryservicessiterecovery.models.CreateRecoveryPlanInput or - IO[bytes] - :return: An instance of LROPoller that returns either RecoveryPlan or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] - :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.RecoveryPlan] = 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( - recovery_plan_name=recovery_plan_name, - input=input, - 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("RecoveryPlan", 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.RecoveryPlan].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.RecoveryPlan]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial(self, recovery_plan_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( - recovery_plan_name=recovery_plan_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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 [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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete(self, recovery_plan_name: str, **kwargs: Any) -> LROPoller[None]: - """Deletes the specified recovery plan. - - Delete a recovery plan. - - :param recovery_plan_name: Recovery plan name. Required. - :type recovery_plan_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( - recovery_plan_name=recovery_plan_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 - - def _update_initial( - self, recovery_plan_name: str, input: Union[_models.UpdateRecoveryPlanInput, 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(input, (IOBase, bytes)): - _content = input - else: - _json = self._serialize.body(input, "UpdateRecoveryPlanInput") - - _request = build_update_request( - recovery_plan_name=recovery_plan_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - recovery_plan_name: str, - input: _models.UpdateRecoveryPlanInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.RecoveryPlan]: - """Updates the given recovery plan. - - The operation to update a recovery plan. - - :param recovery_plan_name: Recovery plan name. Required. - :type recovery_plan_name: str - :param input: Update recovery plan input. Required. - :type input: ~azure.mgmt.recoveryservicessiterecovery.models.UpdateRecoveryPlanInput - :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 RecoveryPlan or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, recovery_plan_name: str, input: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.RecoveryPlan]: - """Updates the given recovery plan. - - The operation to update a recovery plan. - - :param recovery_plan_name: Recovery plan name. Required. - :type recovery_plan_name: str - :param input: Update recovery plan input. Required. - :type input: 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 RecoveryPlan or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, recovery_plan_name: str, input: Union[_models.UpdateRecoveryPlanInput, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.RecoveryPlan]: - """Updates the given recovery plan. - - The operation to update a recovery plan. - - :param recovery_plan_name: Recovery plan name. Required. - :type recovery_plan_name: str - :param input: Update recovery plan input. Is either a UpdateRecoveryPlanInput type or a - IO[bytes] type. Required. - :type input: ~azure.mgmt.recoveryservicessiterecovery.models.UpdateRecoveryPlanInput or - IO[bytes] - :return: An instance of LROPoller that returns either RecoveryPlan or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] - :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.RecoveryPlan] = 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( - recovery_plan_name=recovery_plan_name, - input=input, - 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("RecoveryPlan", 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.RecoveryPlan].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.RecoveryPlan]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _failover_cancel_initial(self, recovery_plan_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_failover_cancel_request( - recovery_plan_name=recovery_plan_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_failover_cancel(self, recovery_plan_name: str, **kwargs: Any) -> LROPoller[_models.RecoveryPlan]: - """Execute cancel failover of the recovery plan. - - The operation to cancel the failover of a recovery plan. - - :param recovery_plan_name: Recovery plan name. Required. - :type recovery_plan_name: str - :return: An instance of LROPoller that returns either RecoveryPlan or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] - :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.RecoveryPlan] = 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._failover_cancel_initial( - recovery_plan_name=recovery_plan_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): - deserialized = self._deserialize("RecoveryPlan", 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.RecoveryPlan].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.RecoveryPlan]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _failover_commit_initial(self, recovery_plan_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_failover_commit_request( - recovery_plan_name=recovery_plan_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_failover_commit(self, recovery_plan_name: str, **kwargs: Any) -> LROPoller[_models.RecoveryPlan]: - """Execute commit failover of the recovery plan. - - The operation to commit the failover of a recovery plan. - - :param recovery_plan_name: Recovery plan name. Required. - :type recovery_plan_name: str - :return: An instance of LROPoller that returns either RecoveryPlan or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] - :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.RecoveryPlan] = 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._failover_commit_initial( - recovery_plan_name=recovery_plan_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): - deserialized = self._deserialize("RecoveryPlan", 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.RecoveryPlan].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.RecoveryPlan]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _planned_failover_initial( - self, recovery_plan_name: str, input: Union[_models.RecoveryPlanPlannedFailoverInput, 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(input, (IOBase, bytes)): - _content = input - else: - _json = self._serialize.body(input, "RecoveryPlanPlannedFailoverInput") - - _request = build_planned_failover_request( - recovery_plan_name=recovery_plan_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_planned_failover( - self, - recovery_plan_name: str, - input: _models.RecoveryPlanPlannedFailoverInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.RecoveryPlan]: - """Execute planned failover of the recovery plan. - - The operation to start the planned failover of a recovery plan. - - :param recovery_plan_name: Recovery plan name. Required. - :type recovery_plan_name: str - :param input: Failover input. Required. - :type input: ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanPlannedFailoverInput - :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 RecoveryPlan or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_planned_failover( - self, recovery_plan_name: str, input: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.RecoveryPlan]: - """Execute planned failover of the recovery plan. - - The operation to start the planned failover of a recovery plan. - - :param recovery_plan_name: Recovery plan name. Required. - :type recovery_plan_name: str - :param input: Failover input. Required. - :type input: 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 RecoveryPlan or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_planned_failover( - self, recovery_plan_name: str, input: Union[_models.RecoveryPlanPlannedFailoverInput, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.RecoveryPlan]: - """Execute planned failover of the recovery plan. - - The operation to start the planned failover of a recovery plan. - - :param recovery_plan_name: Recovery plan name. Required. - :type recovery_plan_name: str - :param input: Failover input. Is either a RecoveryPlanPlannedFailoverInput type or a IO[bytes] - type. Required. - :type input: ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanPlannedFailoverInput - or IO[bytes] - :return: An instance of LROPoller that returns either RecoveryPlan or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] - :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.RecoveryPlan] = 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._planned_failover_initial( - recovery_plan_name=recovery_plan_name, - input=input, - 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("RecoveryPlan", 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.RecoveryPlan].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.RecoveryPlan]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _reprotect_initial(self, recovery_plan_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_reprotect_request( - recovery_plan_name=recovery_plan_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_reprotect(self, recovery_plan_name: str, **kwargs: Any) -> LROPoller[_models.RecoveryPlan]: - """Execute reprotect of the recovery plan. - - The operation to reprotect(reverse replicate) a recovery plan. This api is for deprecated - scenarios and no longer works. - - :param recovery_plan_name: Recovery plan name. Required. - :type recovery_plan_name: str - :return: An instance of LROPoller that returns either RecoveryPlan or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] - :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.RecoveryPlan] = 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._reprotect_initial( - recovery_plan_name=recovery_plan_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): - deserialized = self._deserialize("RecoveryPlan", 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.RecoveryPlan].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.RecoveryPlan]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _test_failover_initial( - self, recovery_plan_name: str, input: Union[_models.RecoveryPlanTestFailoverInput, 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(input, (IOBase, bytes)): - _content = input - else: - _json = self._serialize.body(input, "RecoveryPlanTestFailoverInput") - - _request = build_test_failover_request( - recovery_plan_name=recovery_plan_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_test_failover( - self, - recovery_plan_name: str, - input: _models.RecoveryPlanTestFailoverInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.RecoveryPlan]: - """Execute test failover of the recovery plan. - - The operation to start the test failover of a recovery plan. - - :param recovery_plan_name: Recovery plan name. Required. - :type recovery_plan_name: str - :param input: Recovery plan test failover input. Required. - :type input: ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanTestFailoverInput - :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 RecoveryPlan or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_test_failover( - self, recovery_plan_name: str, input: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.RecoveryPlan]: - """Execute test failover of the recovery plan. - - The operation to start the test failover of a recovery plan. - - :param recovery_plan_name: Recovery plan name. Required. - :type recovery_plan_name: str - :param input: Recovery plan test failover input. Required. - :type input: 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 RecoveryPlan or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_test_failover( - self, recovery_plan_name: str, input: Union[_models.RecoveryPlanTestFailoverInput, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.RecoveryPlan]: - """Execute test failover of the recovery plan. - - The operation to start the test failover of a recovery plan. - - :param recovery_plan_name: Recovery plan name. Required. - :type recovery_plan_name: str - :param input: Recovery plan test failover input. Is either a RecoveryPlanTestFailoverInput type - or a IO[bytes] type. Required. - :type input: ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanTestFailoverInput or - IO[bytes] - :return: An instance of LROPoller that returns either RecoveryPlan or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] - :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.RecoveryPlan] = 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._test_failover_initial( - recovery_plan_name=recovery_plan_name, - input=input, - 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("RecoveryPlan", 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.RecoveryPlan].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.RecoveryPlan]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _test_failover_cleanup_initial( - self, - recovery_plan_name: str, - input: Union[_models.RecoveryPlanTestFailoverCleanupInput, 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(input, (IOBase, bytes)): - _content = input - else: - _json = self._serialize.body(input, "RecoveryPlanTestFailoverCleanupInput") - - _request = build_test_failover_cleanup_request( - recovery_plan_name=recovery_plan_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_test_failover_cleanup( - self, - recovery_plan_name: str, - input: _models.RecoveryPlanTestFailoverCleanupInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.RecoveryPlan]: - """Execute test failover cleanup of the recovery plan. - - The operation to cleanup test failover of a recovery plan. - - :param recovery_plan_name: Recovery plan name. Required. - :type recovery_plan_name: str - :param input: Recovery plan test failover cleanup input. Required. - :type input: - ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanTestFailoverCleanupInput - :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 RecoveryPlan or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_test_failover_cleanup( - self, recovery_plan_name: str, input: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.RecoveryPlan]: - """Execute test failover cleanup of the recovery plan. - - The operation to cleanup test failover of a recovery plan. - - :param recovery_plan_name: Recovery plan name. Required. - :type recovery_plan_name: str - :param input: Recovery plan test failover cleanup input. Required. - :type input: 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 RecoveryPlan or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_test_failover_cleanup( - self, - recovery_plan_name: str, - input: Union[_models.RecoveryPlanTestFailoverCleanupInput, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.RecoveryPlan]: - """Execute test failover cleanup of the recovery plan. - - The operation to cleanup test failover of a recovery plan. - - :param recovery_plan_name: Recovery plan name. Required. - :type recovery_plan_name: str - :param input: Recovery plan test failover cleanup input. Is either a - RecoveryPlanTestFailoverCleanupInput type or a IO[bytes] type. Required. - :type input: - ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanTestFailoverCleanupInput or - IO[bytes] - :return: An instance of LROPoller that returns either RecoveryPlan or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] - :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.RecoveryPlan] = 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._test_failover_cleanup_initial( - recovery_plan_name=recovery_plan_name, - input=input, - 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("RecoveryPlan", 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.RecoveryPlan].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.RecoveryPlan]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _unplanned_failover_initial( - self, - recovery_plan_name: str, - input: Union[_models.RecoveryPlanUnplannedFailoverInput, 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(input, (IOBase, bytes)): - _content = input - else: - _json = self._serialize.body(input, "RecoveryPlanUnplannedFailoverInput") - - _request = build_unplanned_failover_request( - recovery_plan_name=recovery_plan_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_unplanned_failover( - self, - recovery_plan_name: str, - input: _models.RecoveryPlanUnplannedFailoverInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.RecoveryPlan]: - """Execute unplanned failover of the recovery plan. - - The operation to start the unplanned failover of a recovery plan. - - :param recovery_plan_name: Recovery plan name. Required. - :type recovery_plan_name: str - :param input: Recovery plan unplanned failover input. Required. - :type input: ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanUnplannedFailoverInput - :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 RecoveryPlan or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_unplanned_failover( - self, recovery_plan_name: str, input: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.RecoveryPlan]: - """Execute unplanned failover of the recovery plan. - - The operation to start the unplanned failover of a recovery plan. - - :param recovery_plan_name: Recovery plan name. Required. - :type recovery_plan_name: str - :param input: Recovery plan unplanned failover input. Required. - :type input: 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 RecoveryPlan or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_unplanned_failover( - self, - recovery_plan_name: str, - input: Union[_models.RecoveryPlanUnplannedFailoverInput, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.RecoveryPlan]: - """Execute unplanned failover of the recovery plan. - - The operation to start the unplanned failover of a recovery plan. - - :param recovery_plan_name: Recovery plan name. Required. - :type recovery_plan_name: str - :param input: Recovery plan unplanned failover input. Is either a - RecoveryPlanUnplannedFailoverInput type or a IO[bytes] type. Required. - :type input: ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlanUnplannedFailoverInput - or IO[bytes] - :return: An instance of LROPoller that returns either RecoveryPlan or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryPlan] - :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.RecoveryPlan] = 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._unplanned_failover_initial( - recovery_plan_name=recovery_plan_name, - input=input, - 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("RecoveryPlan", 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.RecoveryPlan].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.RecoveryPlan]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_recovery_services_providers_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_recovery_services_providers_operations.py deleted file mode 100644 index 6c9e4248a12a..000000000000 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_recovery_services_providers_operations.py +++ /dev/null @@ -1,1056 +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, Dict, IO, Iterable, 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 SiteRecoveryManagementClientConfiguration -from .._serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_replication_fabrics_request( # pylint: disable=name-too-long - fabric_name: str, resource_group_name: str, resource_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", "2025-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url("fabric_name", fabric_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( - fabric_name: str, - provider_name: str, - resource_group_name: str, - resource_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", "2025-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders/{providerName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), - "providerName": _SERIALIZER.url("provider_name", provider_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( - fabric_name: str, - provider_name: str, - resource_group_name: str, - resource_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", "2025-01-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders/{providerName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), - "providerName": _SERIALIZER.url("provider_name", provider_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_purge_request( - fabric_name: str, - provider_name: str, - resource_group_name: str, - resource_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", "2025-01-01")) - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders/{providerName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), - "providerName": _SERIALIZER.url("provider_name", provider_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_refresh_provider_request( - fabric_name: str, - provider_name: str, - resource_group_name: str, - resource_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", "2025-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders/{providerName}/refreshProvider", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), - "providerName": _SERIALIZER.url("provider_name", provider_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_delete_request( - fabric_name: str, - provider_name: str, - resource_group_name: str, - resource_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", "2025-01-01")) - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders/{providerName}/remove", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), - "providerName": _SERIALIZER.url("provider_name", provider_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_list_request( - resource_group_name: str, resource_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", "2025-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryServicesProviders", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "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) - - -class ReplicationRecoveryServicesProvidersOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicessiterecovery.SiteRecoveryManagementClient`'s - :attr:`replication_recovery_services_providers` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: SiteRecoveryManagementClientConfiguration = ( - 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_replication_fabrics( - self, fabric_name: str, **kwargs: Any - ) -> Iterable["_models.RecoveryServicesProvider"]: - """Gets the list of registered recovery services providers for the fabric. - - Lists the registered recovery services providers for the specified fabric. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :return: An iterator like instance of either RecoveryServicesProvider or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryServicesProvider] - :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.RecoveryServicesProviderCollection] = 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_replication_fabrics_request( - fabric_name=fabric_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("RecoveryServicesProviderCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get(self, fabric_name: str, provider_name: str, **kwargs: Any) -> _models.RecoveryServicesProvider: - """Gets the details of a recovery services provider. - - Gets the details of registered recovery services provider. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param provider_name: Recovery services provider name. Required. - :type provider_name: str - :return: RecoveryServicesProvider or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.RecoveryServicesProvider - :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.RecoveryServicesProvider] = kwargs.pop("cls", None) - - _request = build_get_request( - fabric_name=fabric_name, - provider_name=provider_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("RecoveryServicesProvider", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_initial( - self, - fabric_name: str, - provider_name: str, - add_provider_input: Union[_models.AddRecoveryServicesProviderInput, 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(add_provider_input, (IOBase, bytes)): - _content = add_provider_input - else: - _json = self._serialize.body(add_provider_input, "AddRecoveryServicesProviderInput") - - _request = build_create_request( - fabric_name=fabric_name, - provider_name=provider_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create( - self, - fabric_name: str, - provider_name: str, - add_provider_input: _models.AddRecoveryServicesProviderInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.RecoveryServicesProvider]: - """Adds a recovery services provider. - - The operation to add a recovery services provider. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param provider_name: Recovery services provider name. Required. - :type provider_name: str - :param add_provider_input: Add provider input. Required. - :type add_provider_input: - ~azure.mgmt.recoveryservicessiterecovery.models.AddRecoveryServicesProviderInput - :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 RecoveryServicesProvider or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryServicesProvider] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create( - self, - fabric_name: str, - provider_name: str, - add_provider_input: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.RecoveryServicesProvider]: - """Adds a recovery services provider. - - The operation to add a recovery services provider. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param provider_name: Recovery services provider name. Required. - :type provider_name: str - :param add_provider_input: Add provider input. Required. - :type add_provider_input: 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 RecoveryServicesProvider or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryServicesProvider] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create( - self, - fabric_name: str, - provider_name: str, - add_provider_input: Union[_models.AddRecoveryServicesProviderInput, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.RecoveryServicesProvider]: - """Adds a recovery services provider. - - The operation to add a recovery services provider. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param provider_name: Recovery services provider name. Required. - :type provider_name: str - :param add_provider_input: Add provider input. Is either a AddRecoveryServicesProviderInput - type or a IO[bytes] type. Required. - :type add_provider_input: - ~azure.mgmt.recoveryservicessiterecovery.models.AddRecoveryServicesProviderInput or IO[bytes] - :return: An instance of LROPoller that returns either RecoveryServicesProvider or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryServicesProvider] - :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.RecoveryServicesProvider] = 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( - fabric_name=fabric_name, - provider_name=provider_name, - add_provider_input=add_provider_input, - 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("RecoveryServicesProvider", 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.RecoveryServicesProvider].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.RecoveryServicesProvider]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _purge_initial(self, fabric_name: str, provider_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_purge_request( - fabric_name=fabric_name, - provider_name=provider_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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 [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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_purge(self, fabric_name: str, provider_name: str, **kwargs: Any) -> LROPoller[None]: - """Purges recovery service provider from fabric. - - The operation to purge(force delete) a recovery services provider from the vault. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param provider_name: Recovery services provider name. Required. - :type provider_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._purge_initial( - fabric_name=fabric_name, - provider_name=provider_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 - - def _refresh_provider_initial(self, fabric_name: str, provider_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_refresh_provider_request( - fabric_name=fabric_name, - provider_name=provider_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_refresh_provider( - self, fabric_name: str, provider_name: str, **kwargs: Any - ) -> LROPoller[_models.RecoveryServicesProvider]: - """Refresh details from the recovery services provider. - - The operation to refresh the information from the recovery services provider. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param provider_name: Recovery services provider name. Required. - :type provider_name: str - :return: An instance of LROPoller that returns either RecoveryServicesProvider or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryServicesProvider] - :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.RecoveryServicesProvider] = 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._refresh_provider_initial( - fabric_name=fabric_name, - provider_name=provider_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): - deserialized = self._deserialize("RecoveryServicesProvider", 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.RecoveryServicesProvider].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.RecoveryServicesProvider]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial(self, fabric_name: str, provider_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( - fabric_name=fabric_name, - provider_name=provider_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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 [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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete(self, fabric_name: str, provider_name: str, **kwargs: Any) -> LROPoller[None]: - """Deletes provider from fabric. Note: Deleting provider for any fabric other than SingleHost is - unsupported. To maintain backward compatibility for released clients the object - "deleteRspInput" is used (if the object is empty we assume that it is old client and continue - the old behavior). - - The operation to removes/delete(unregister) a recovery services provider from the vault. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param provider_name: Recovery services provider name. Required. - :type provider_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( - fabric_name=fabric_name, - provider_name=provider_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(self, **kwargs: Any) -> Iterable["_models.RecoveryServicesProvider"]: - """Gets the list of registered recovery services providers in the vault. This is a view only api. - - Lists the registered recovery services providers in the vault. - - :return: An iterator like instance of either RecoveryServicesProvider or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.RecoveryServicesProvider] - :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.RecoveryServicesProviderCollection] = 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_request( - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("RecoveryServicesProviderCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_storage_classification_mappings_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_storage_classification_mappings_operations.py deleted file mode 100644 index bab89a5567eb..000000000000 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_storage_classification_mappings_operations.py +++ /dev/null @@ -1,825 +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, Dict, IO, Iterable, 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 SiteRecoveryManagementClientConfiguration -from .._serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_replication_storage_classifications_request( # pylint: disable=name-too-long - fabric_name: str, - storage_classification_name: str, - resource_group_name: str, - resource_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", "2025-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications/{storageClassificationName}/replicationStorageClassificationMappings", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), - "storageClassificationName": _SERIALIZER.url("storage_classification_name", storage_classification_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( - fabric_name: str, - storage_classification_name: str, - storage_classification_mapping_name: str, - resource_group_name: str, - resource_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", "2025-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications/{storageClassificationName}/replicationStorageClassificationMappings/{storageClassificationMappingName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), - "storageClassificationName": _SERIALIZER.url("storage_classification_name", storage_classification_name, "str"), - "storageClassificationMappingName": _SERIALIZER.url( - "storage_classification_mapping_name", storage_classification_mapping_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( - fabric_name: str, - storage_classification_name: str, - storage_classification_mapping_name: str, - resource_group_name: str, - resource_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", "2025-01-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications/{storageClassificationName}/replicationStorageClassificationMappings/{storageClassificationMappingName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), - "storageClassificationName": _SERIALIZER.url("storage_classification_name", storage_classification_name, "str"), - "storageClassificationMappingName": _SERIALIZER.url( - "storage_classification_mapping_name", storage_classification_mapping_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( - fabric_name: str, - storage_classification_name: str, - storage_classification_mapping_name: str, - resource_group_name: str, - resource_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", "2025-01-01")) - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications/{storageClassificationName}/replicationStorageClassificationMappings/{storageClassificationMappingName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), - "storageClassificationName": _SERIALIZER.url("storage_classification_name", storage_classification_name, "str"), - "storageClassificationMappingName": _SERIALIZER.url( - "storage_classification_mapping_name", storage_classification_mapping_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_list_request( - resource_group_name: str, resource_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", "2025-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationStorageClassificationMappings", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "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) - - -class ReplicationStorageClassificationMappingsOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicessiterecovery.SiteRecoveryManagementClient`'s - :attr:`replication_storage_classification_mappings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: SiteRecoveryManagementClientConfiguration = ( - 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_replication_storage_classifications( # pylint: disable=name-too-long - self, fabric_name: str, storage_classification_name: str, **kwargs: Any - ) -> Iterable["_models.StorageClassificationMapping"]: - """Gets the list of storage classification mappings objects under a storage. - - Lists the storage classification mappings for the fabric. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param storage_classification_name: Storage classification name. Required. - :type storage_classification_name: str - :return: An iterator like instance of either StorageClassificationMapping or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.StorageClassificationMapping] - :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.StorageClassificationMappingCollection] = 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_replication_storage_classifications_request( - fabric_name=fabric_name, - storage_classification_name=storage_classification_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("StorageClassificationMappingCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get( - self, - fabric_name: str, - storage_classification_name: str, - storage_classification_mapping_name: str, - **kwargs: Any - ) -> _models.StorageClassificationMapping: - """Gets the details of a storage classification mapping. - - Gets the details of the specified storage classification mapping. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param storage_classification_name: Storage classification name. Required. - :type storage_classification_name: str - :param storage_classification_mapping_name: Storage classification mapping name. Required. - :type storage_classification_mapping_name: str - :return: StorageClassificationMapping or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.StorageClassificationMapping - :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.StorageClassificationMapping] = kwargs.pop("cls", None) - - _request = build_get_request( - fabric_name=fabric_name, - storage_classification_name=storage_classification_name, - storage_classification_mapping_name=storage_classification_mapping_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("StorageClassificationMapping", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_initial( - self, - fabric_name: str, - storage_classification_name: str, - storage_classification_mapping_name: str, - pairing_input: Union[_models.StorageClassificationMappingInput, 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(pairing_input, (IOBase, bytes)): - _content = pairing_input - else: - _json = self._serialize.body(pairing_input, "StorageClassificationMappingInput") - - _request = build_create_request( - fabric_name=fabric_name, - storage_classification_name=storage_classification_name, - storage_classification_mapping_name=storage_classification_mapping_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create( - self, - fabric_name: str, - storage_classification_name: str, - storage_classification_mapping_name: str, - pairing_input: _models.StorageClassificationMappingInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.StorageClassificationMapping]: - """Create storage classification mapping. - - The operation to create a storage classification mapping. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param storage_classification_name: Storage classification name. Required. - :type storage_classification_name: str - :param storage_classification_mapping_name: Storage classification mapping name. Required. - :type storage_classification_mapping_name: str - :param pairing_input: Pairing input. Required. - :type pairing_input: - ~azure.mgmt.recoveryservicessiterecovery.models.StorageClassificationMappingInput - :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 StorageClassificationMapping or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.StorageClassificationMapping] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create( - self, - fabric_name: str, - storage_classification_name: str, - storage_classification_mapping_name: str, - pairing_input: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.StorageClassificationMapping]: - """Create storage classification mapping. - - The operation to create a storage classification mapping. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param storage_classification_name: Storage classification name. Required. - :type storage_classification_name: str - :param storage_classification_mapping_name: Storage classification mapping name. Required. - :type storage_classification_mapping_name: str - :param pairing_input: Pairing input. Required. - :type pairing_input: 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 StorageClassificationMapping or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.StorageClassificationMapping] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create( - self, - fabric_name: str, - storage_classification_name: str, - storage_classification_mapping_name: str, - pairing_input: Union[_models.StorageClassificationMappingInput, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.StorageClassificationMapping]: - """Create storage classification mapping. - - The operation to create a storage classification mapping. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param storage_classification_name: Storage classification name. Required. - :type storage_classification_name: str - :param storage_classification_mapping_name: Storage classification mapping name. Required. - :type storage_classification_mapping_name: str - :param pairing_input: Pairing input. Is either a StorageClassificationMappingInput type or a - IO[bytes] type. Required. - :type pairing_input: - ~azure.mgmt.recoveryservicessiterecovery.models.StorageClassificationMappingInput or IO[bytes] - :return: An instance of LROPoller that returns either StorageClassificationMapping or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.StorageClassificationMapping] - :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.StorageClassificationMapping] = 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( - fabric_name=fabric_name, - storage_classification_name=storage_classification_name, - storage_classification_mapping_name=storage_classification_mapping_name, - pairing_input=pairing_input, - 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("StorageClassificationMapping", 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.StorageClassificationMapping].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.StorageClassificationMapping]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, - fabric_name: str, - storage_classification_name: str, - storage_classification_mapping_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( - fabric_name=fabric_name, - storage_classification_name=storage_classification_name, - storage_classification_mapping_name=storage_classification_mapping_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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 [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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, - fabric_name: str, - storage_classification_name: str, - storage_classification_mapping_name: str, - **kwargs: Any - ) -> LROPoller[None]: - """Delete a storage classification mapping. - - The operation to delete a storage classification mapping. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param storage_classification_name: Storage classification name. Required. - :type storage_classification_name: str - :param storage_classification_mapping_name: Storage classification mapping name. Required. - :type storage_classification_mapping_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( - fabric_name=fabric_name, - storage_classification_name=storage_classification_name, - storage_classification_mapping_name=storage_classification_mapping_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(self, **kwargs: Any) -> Iterable["_models.StorageClassificationMapping"]: - """Gets the list of storage classification mappings objects under a vault. - - Lists the storage classification mappings in the vault. - - :return: An iterator like instance of either StorageClassificationMapping or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.StorageClassificationMapping] - :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.StorageClassificationMappingCollection] = 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_request( - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("StorageClassificationMappingCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_storage_classifications_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_storage_classifications_operations.py deleted file mode 100644 index ede83b5a2b55..000000000000 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_storage_classifications_operations.py +++ /dev/null @@ -1,381 +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, Dict, Iterable, 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 SiteRecoveryManagementClientConfiguration -from .._serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_replication_fabrics_request( # pylint: disable=name-too-long - fabric_name: str, resource_group_name: str, resource_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", "2025-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url("fabric_name", fabric_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( - fabric_name: str, - storage_classification_name: str, - resource_group_name: str, - resource_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", "2025-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications/{storageClassificationName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), - "storageClassificationName": _SERIALIZER.url("storage_classification_name", storage_classification_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_list_request( - resource_group_name: str, resource_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", "2025-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationStorageClassifications", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "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) - - -class ReplicationStorageClassificationsOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicessiterecovery.SiteRecoveryManagementClient`'s - :attr:`replication_storage_classifications` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: SiteRecoveryManagementClientConfiguration = ( - 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_replication_fabrics(self, fabric_name: str, **kwargs: Any) -> Iterable["_models.StorageClassification"]: - """Gets the list of storage classification objects under a fabric. - - Lists the storage classifications available in the specified fabric. - - :param fabric_name: Site name of interest. Required. - :type fabric_name: str - :return: An iterator like instance of either StorageClassification or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.StorageClassification] - :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.StorageClassificationCollection] = 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_replication_fabrics_request( - fabric_name=fabric_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("StorageClassificationCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get(self, fabric_name: str, storage_classification_name: str, **kwargs: Any) -> _models.StorageClassification: - """Gets the details of a storage classification. - - Gets the details of the specified storage classification. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param storage_classification_name: Storage classification name. Required. - :type storage_classification_name: str - :return: StorageClassification or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.StorageClassification - :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.StorageClassification] = kwargs.pop("cls", None) - - _request = build_get_request( - fabric_name=fabric_name, - storage_classification_name=storage_classification_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("StorageClassification", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.StorageClassification"]: - """Gets the list of storage classification objects under a vault. - - Lists the storage classifications in the vault. - - :return: An iterator like instance of either StorageClassification or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.StorageClassification] - :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.StorageClassificationCollection] = 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_request( - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("StorageClassificationCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_vault_health_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_vault_health_operations.py deleted file mode 100644 index 7220b4d3f92e..000000000000 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_vault_health_operations.py +++ /dev/null @@ -1,271 +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, Dict, Iterator, Optional, TypeVar, Union, cast - -from azure.core import PipelineClient -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 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 SiteRecoveryManagementClientConfiguration -from .._serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_request(resource_group_name: str, resource_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", "2025-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationVaultHealth", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "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_refresh_request( - resource_group_name: str, resource_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", "2025-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationVaultHealth/default/refresh", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "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="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class ReplicationVaultHealthOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicessiterecovery.SiteRecoveryManagementClient`'s - :attr:`replication_vault_health` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: SiteRecoveryManagementClientConfiguration = ( - 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, **kwargs: Any) -> _models.VaultHealthDetails: - """Gets the health summary for the vault. - - Gets the health details of the vault. - - :return: VaultHealthDetails or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.VaultHealthDetails - :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.VaultHealthDetails] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("VaultHealthDetails", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _refresh_initial(self, **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_refresh_request( - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_refresh(self, **kwargs: Any) -> LROPoller[_models.VaultHealthDetails]: - """Refreshes health summary of the vault. - - Refreshes health summary of the vault. - - :return: An instance of LROPoller that returns either VaultHealthDetails or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.VaultHealthDetails] - :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.VaultHealthDetails] = 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._refresh_initial( - 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): - deserialized = self._deserialize("VaultHealthDetails", 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.VaultHealthDetails].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.VaultHealthDetails]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_vault_setting_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_vault_setting_operations.py deleted file mode 100644 index 404e4a781483..000000000000 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_vault_setting_operations.py +++ /dev/null @@ -1,477 +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, Dict, IO, Iterable, 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 SiteRecoveryManagementClientConfiguration -from .._serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request( - resource_group_name: str, resource_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", "2025-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationVaultSettings", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "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_get_request( - vault_setting_name: str, resource_group_name: str, resource_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", "2025-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationVaultSettings/{vaultSettingName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "vaultSettingName": _SERIALIZER.url("vault_setting_name", vault_setting_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( - vault_setting_name: str, resource_group_name: str, resource_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", "2025-01-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.RecoveryServices/vaults/{resourceName}/replicationVaultSettings/{vaultSettingName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "vaultSettingName": _SERIALIZER.url("vault_setting_name", vault_setting_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) - - -class ReplicationVaultSettingOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicessiterecovery.SiteRecoveryManagementClient`'s - :attr:`replication_vault_setting` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: SiteRecoveryManagementClientConfiguration = ( - 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) -> Iterable["_models.VaultSetting"]: - """Gets the list of vault setting. - - Gets the list of vault setting. This includes the Migration Hub connection settings. - - :return: An iterator like instance of either VaultSetting or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.VaultSetting] - :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.VaultSettingCollection] = 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_request( - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("VaultSettingCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get(self, vault_setting_name: str, **kwargs: Any) -> _models.VaultSetting: - """Gets the vault setting. - - Gets the vault setting. This includes the Migration Hub connection settings. - - :param vault_setting_name: Vault setting name. Required. - :type vault_setting_name: str - :return: VaultSetting or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.VaultSetting - :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.VaultSetting] = kwargs.pop("cls", None) - - _request = build_get_request( - vault_setting_name=vault_setting_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("VaultSetting", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_initial( - self, vault_setting_name: str, input: Union[_models.VaultSettingCreationInput, 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(input, (IOBase, bytes)): - _content = input - else: - _json = self._serialize.body(input, "VaultSettingCreationInput") - - _request = build_create_request( - vault_setting_name=vault_setting_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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]: - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create( - self, - vault_setting_name: str, - input: _models.VaultSettingCreationInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.VaultSetting]: - """Updates vault setting. A vault setting object is a singleton per vault and it is always present - by default. - - The operation to configure vault setting. - - :param vault_setting_name: Vault setting name. Required. - :type vault_setting_name: str - :param input: Vault setting creation input. Required. - :type input: ~azure.mgmt.recoveryservicessiterecovery.models.VaultSettingCreationInput - :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 VaultSetting or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.VaultSetting] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create( - self, vault_setting_name: str, input: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.VaultSetting]: - """Updates vault setting. A vault setting object is a singleton per vault and it is always present - by default. - - The operation to configure vault setting. - - :param vault_setting_name: Vault setting name. Required. - :type vault_setting_name: str - :param input: Vault setting creation input. Required. - :type input: 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 VaultSetting or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.VaultSetting] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create( - self, vault_setting_name: str, input: Union[_models.VaultSettingCreationInput, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.VaultSetting]: - """Updates vault setting. A vault setting object is a singleton per vault and it is always present - by default. - - The operation to configure vault setting. - - :param vault_setting_name: Vault setting name. Required. - :type vault_setting_name: str - :param input: Vault setting creation input. Is either a VaultSettingCreationInput type or a - IO[bytes] type. Required. - :type input: ~azure.mgmt.recoveryservicessiterecovery.models.VaultSettingCreationInput or - IO[bytes] - :return: An instance of LROPoller that returns either VaultSetting or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.VaultSetting] - :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.VaultSetting] = 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( - vault_setting_name=vault_setting_name, - input=input, - 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("VaultSetting", 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.VaultSetting].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.VaultSetting]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replicationv_centers_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replicationv_centers_operations.py deleted file mode 100644 index e8f7bf8f98f8..000000000000 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replicationv_centers_operations.py +++ /dev/null @@ -1,991 +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, Dict, IO, Iterable, 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 SiteRecoveryManagementClientConfiguration -from .._serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_replication_fabrics_request( # pylint: disable=name-too-long - fabric_name: str, resource_group_name: str, resource_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", "2025-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationvCenters", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url("fabric_name", fabric_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( - fabric_name: str, - vcenter_name: str, - resource_group_name: str, - resource_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", "2025-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationvCenters/{vcenterName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), - "vcenterName": _SERIALIZER.url("vcenter_name", vcenter_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( - fabric_name: str, - vcenter_name: str, - resource_group_name: str, - resource_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", "2025-01-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationvCenters/{vcenterName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), - "vcenterName": _SERIALIZER.url("vcenter_name", vcenter_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( - fabric_name: str, - vcenter_name: str, - resource_group_name: str, - resource_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", "2025-01-01")) - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationvCenters/{vcenterName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), - "vcenterName": _SERIALIZER.url("vcenter_name", vcenter_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_update_request( - fabric_name: str, - vcenter_name: str, - resource_group_name: str, - resource_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", "2025-01-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.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationvCenters/{vcenterName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), - "vcenterName": _SERIALIZER.url("vcenter_name", vcenter_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_list_request( - resource_group_name: str, resource_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", "2025-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationvCenters", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "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) - - -class ReplicationvCentersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicessiterecovery.SiteRecoveryManagementClient`'s - :attr:`replicationv_centers` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: SiteRecoveryManagementClientConfiguration = ( - 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_replication_fabrics(self, fabric_name: str, **kwargs: Any) -> Iterable["_models.VCenter"]: - """Gets the list of vCenter registered under a fabric. - - Lists the vCenter servers registered in a fabric. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :return: An iterator like instance of either VCenter or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.VCenter] - :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.VCenterCollection] = 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_replication_fabrics_request( - fabric_name=fabric_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("VCenterCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get(self, fabric_name: str, vcenter_name: str, **kwargs: Any) -> _models.VCenter: - """Gets the details of a vCenter. - - Gets the details of a registered vCenter server(Add vCenter server). - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param vcenter_name: vcenter name. Required. - :type vcenter_name: str - :return: VCenter or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.VCenter - :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.VCenter] = kwargs.pop("cls", None) - - _request = build_get_request( - fabric_name=fabric_name, - vcenter_name=vcenter_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("VCenter", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_initial( - self, - fabric_name: str, - vcenter_name: str, - add_v_center_request: Union[_models.AddVCenterRequest, 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(add_v_center_request, (IOBase, bytes)): - _content = add_v_center_request - else: - _json = self._serialize.body(add_v_center_request, "AddVCenterRequest") - - _request = build_create_request( - fabric_name=fabric_name, - vcenter_name=vcenter_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create( - self, - fabric_name: str, - vcenter_name: str, - add_v_center_request: _models.AddVCenterRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.VCenter]: - """Add vCenter. - - The operation to create a vCenter object.. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param vcenter_name: vcenter name. Required. - :type vcenter_name: str - :param add_v_center_request: The input to the add vCenter operation. Required. - :type add_v_center_request: ~azure.mgmt.recoveryservicessiterecovery.models.AddVCenterRequest - :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 VCenter or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.VCenter] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create( - self, - fabric_name: str, - vcenter_name: str, - add_v_center_request: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.VCenter]: - """Add vCenter. - - The operation to create a vCenter object.. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param vcenter_name: vcenter name. Required. - :type vcenter_name: str - :param add_v_center_request: The input to the add vCenter operation. Required. - :type add_v_center_request: 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 VCenter or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.VCenter] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create( - self, - fabric_name: str, - vcenter_name: str, - add_v_center_request: Union[_models.AddVCenterRequest, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.VCenter]: - """Add vCenter. - - The operation to create a vCenter object.. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param vcenter_name: vcenter name. Required. - :type vcenter_name: str - :param add_v_center_request: The input to the add vCenter operation. Is either a - AddVCenterRequest type or a IO[bytes] type. Required. - :type add_v_center_request: ~azure.mgmt.recoveryservicessiterecovery.models.AddVCenterRequest - or IO[bytes] - :return: An instance of LROPoller that returns either VCenter or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.VCenter] - :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.VCenter] = 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( - fabric_name=fabric_name, - vcenter_name=vcenter_name, - add_v_center_request=add_v_center_request, - 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("VCenter", 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.VCenter].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.VCenter]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial(self, fabric_name: str, vcenter_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( - fabric_name=fabric_name, - vcenter_name=vcenter_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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 [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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete(self, fabric_name: str, vcenter_name: str, **kwargs: Any) -> LROPoller[None]: - """Remove vcenter operation. - - The operation to remove(unregister) a registered vCenter server from the vault. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param vcenter_name: vcenter name. Required. - :type vcenter_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( - fabric_name=fabric_name, - vcenter_name=vcenter_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 - - def _update_initial( - self, - fabric_name: str, - vcenter_name: str, - update_v_center_request: Union[_models.UpdateVCenterRequest, 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(update_v_center_request, (IOBase, bytes)): - _content = update_v_center_request - else: - _json = self._serialize.body(update_v_center_request, "UpdateVCenterRequest") - - _request = build_update_request( - fabric_name=fabric_name, - vcenter_name=vcenter_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - fabric_name: str, - vcenter_name: str, - update_v_center_request: _models.UpdateVCenterRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.VCenter]: - """Update vCenter operation. - - The operation to update a registered vCenter. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param vcenter_name: vcenter name. Required. - :type vcenter_name: str - :param update_v_center_request: The input to the update vCenter operation. Required. - :type update_v_center_request: - ~azure.mgmt.recoveryservicessiterecovery.models.UpdateVCenterRequest - :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 VCenter or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.VCenter] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - fabric_name: str, - vcenter_name: str, - update_v_center_request: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.VCenter]: - """Update vCenter operation. - - The operation to update a registered vCenter. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param vcenter_name: vcenter name. Required. - :type vcenter_name: str - :param update_v_center_request: The input to the update vCenter operation. Required. - :type update_v_center_request: 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 VCenter or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.VCenter] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - fabric_name: str, - vcenter_name: str, - update_v_center_request: Union[_models.UpdateVCenterRequest, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.VCenter]: - """Update vCenter operation. - - The operation to update a registered vCenter. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param vcenter_name: vcenter name. Required. - :type vcenter_name: str - :param update_v_center_request: The input to the update vCenter operation. Is either a - UpdateVCenterRequest type or a IO[bytes] type. Required. - :type update_v_center_request: - ~azure.mgmt.recoveryservicessiterecovery.models.UpdateVCenterRequest or IO[bytes] - :return: An instance of LROPoller that returns either VCenter or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicessiterecovery.models.VCenter] - :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.VCenter] = 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( - fabric_name=fabric_name, - vcenter_name=vcenter_name, - update_v_center_request=update_v_center_request, - 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("VCenter", 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.VCenter].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.VCenter]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.VCenter"]: - """Gets the list of vCenter registered under the vault. - - Lists the vCenter servers registered in the vault. - - :return: An iterator like instance of either VCenter or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.VCenter] - :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.VCenterCollection] = 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_request( - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("VCenterCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_supported_operating_systems_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_supported_operating_systems_operations.py deleted file mode 100644 index b8051d23000c..000000000000 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_supported_operating_systems_operations.py +++ /dev/null @@ -1,150 +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, Dict, 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 SiteRecoveryManagementClientConfiguration -from .._serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_request( - resource_group_name: str, - resource_name: str, - subscription_id: str, - *, - instance_type: Optional[str] = None, - **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", "2025-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationSupportedOperatingSystems", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "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") - if instance_type is not None: - _params["instanceType"] = _SERIALIZER.query("instance_type", instance_type, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class SupportedOperatingSystemsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicessiterecovery.SiteRecoveryManagementClient`'s - :attr:`supported_operating_systems` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: SiteRecoveryManagementClientConfiguration = ( - 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, instance_type: Optional[str] = None, **kwargs: Any) -> _models.SupportedOperatingSystems: - """Gets the data of supported operating systems by SRS. - - Gets the data of supported operating systems by SRS. - - :param instance_type: The instance type. Default value is None. - :type instance_type: str - :return: SupportedOperatingSystems or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservicessiterecovery.models.SupportedOperatingSystems - :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.SupportedOperatingSystems] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_name, - subscription_id=self._config.subscription_id, - instance_type=instance_type, - 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("SupportedOperatingSystems", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_target_compute_sizes_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_target_compute_sizes_operations.py deleted file mode 100644 index d708f1cb78a2..000000000000 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_target_compute_sizes_operations.py +++ /dev/null @@ -1,191 +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, Dict, Iterable, 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 SiteRecoveryManagementClientConfiguration -from .._serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_replication_protected_items_request( # pylint: disable=name-too-long - fabric_name: str, - protection_container_name: str, - replicated_protected_item_name: str, - resource_group_name: str, - resource_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", "2025-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/targetComputeSizes", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), - "protectionContainerName": _SERIALIZER.url("protection_container_name", protection_container_name, "str"), - "replicatedProtectedItemName": _SERIALIZER.url( - "replicated_protected_item_name", replicated_protected_item_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 TargetComputeSizesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.recoveryservicessiterecovery.SiteRecoveryManagementClient`'s - :attr:`target_compute_sizes` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: SiteRecoveryManagementClientConfiguration = ( - 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_replication_protected_items( - self, fabric_name: str, protection_container_name: str, replicated_protected_item_name: str, **kwargs: Any - ) -> Iterable["_models.TargetComputeSize"]: - """Gets the list of target compute sizes for the replication protected item. - - Lists the available target compute sizes for a replication protected item. - - :param fabric_name: Fabric name. Required. - :type fabric_name: str - :param protection_container_name: protection container name. Required. - :type protection_container_name: str - :param replicated_protected_item_name: Replication protected item name. Required. - :type replicated_protected_item_name: str - :return: An iterator like instance of either TargetComputeSize or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicessiterecovery.models.TargetComputeSize] - :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.TargetComputeSizeCollection] = 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_replication_protected_items_request( - fabric_name=fabric_name, - protection_container_name=protection_container_name, - replicated_protected_item_name=replicated_protected_item_name, - resource_group_name=self._config.resource_group_name, - resource_name=self._config.resource_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("TargetComputeSizeCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/cluster_recovery_point_get.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/cluster_recovery_point_get.py index 69c7d2659664..9773c2104bc9 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/cluster_recovery_point_get.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/cluster_recovery_point_get.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. # -------------------------------------------------------------------------- @@ -28,12 +27,11 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="7c943c1b-5122-4097-90c8-861411bdd574", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) response = client.cluster_recovery_point.get( + resource_group_name="resourceGroupPS1", resource_name="vault1", fabric_name="fabric-pri-eastus", protection_container_name="pri-cloud-eastus", @@ -43,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ClusterRecoveryPoint_Get.json +# x-ms-original-file: 2025-08-01/ClusterRecoveryPoint_Get.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/cluster_recovery_points_list_by_replication_protection_cluster.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/cluster_recovery_points_list_by_replication_protection_cluster.py index 063c5d5f7148..2a3a2256e64d 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/cluster_recovery_points_list_by_replication_protection_cluster.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/cluster_recovery_points_list_by_replication_protection_cluster.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. # -------------------------------------------------------------------------- @@ -28,12 +27,11 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="7c943c1b-5122-4097-90c8-861411bdd574", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) response = client.cluster_recovery_points.list_by_replication_protection_cluster( + resource_group_name="resourceGroupPS1", resource_name="vault1", fabric_name="fabric-pri-eastus", protection_container_name="pri-cloud-eastus", @@ -43,6 +41,6 @@ def main(): print(item) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ClusterRecoveryPoints_ListByReplicationProtectionCluster.json +# x-ms-original-file: 2025-08-01/ClusterRecoveryPoints_ListByReplicationProtectionCluster.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/migration_recovery_points_get.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/migration_recovery_points_get.py index a48393395852..d716ce85c046 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/migration_recovery_points_get.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/migration_recovery_points_get.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. # -------------------------------------------------------------------------- @@ -28,12 +27,12 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="cb53d0c3-bd59-4721-89bc-06916a9147ef", - resource_group_name="resourcegroup1", - resource_name="migrationvault", + subscription_id="SUBSCRIPTION_ID", ) response = client.migration_recovery_points.get( + resource_group_name="resourcegroup1", + resource_name="migrationvault", fabric_name="vmwarefabric1", protection_container_name="vmwareContainer1", migration_item_name="virtualmachine1", @@ -42,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/MigrationRecoveryPoints_Get.json +# x-ms-original-file: 2025-08-01/MigrationRecoveryPoints_Get.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/migration_recovery_points_list_by_replication_migration_items.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/migration_recovery_points_list_by_replication_migration_items.py index d8e8cea44746..e72d8f6e782b 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/migration_recovery_points_list_by_replication_migration_items.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/migration_recovery_points_list_by_replication_migration_items.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. # -------------------------------------------------------------------------- @@ -28,12 +27,12 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="cb53d0c3-bd59-4721-89bc-06916a9147ef", - resource_group_name="resourcegroup1", - resource_name="migrationvault", + subscription_id="SUBSCRIPTION_ID", ) response = client.migration_recovery_points.list_by_replication_migration_items( + resource_group_name="resourcegroup1", + resource_name="migrationvault", fabric_name="vmwarefabric1", protection_container_name="vmwareContainer1", migration_item_name="virtualmachine1", @@ -42,6 +41,6 @@ def main(): print(item) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/MigrationRecoveryPoints_ListByReplicationMigrationItems.json +# x-ms-original-file: 2025-08-01/MigrationRecoveryPoints_ListByReplicationMigrationItems.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/operations_list.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/operations_list.py index dc25ed457eba..27ed28582801 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/operations_list.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/operations_list.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. # -------------------------------------------------------------------------- @@ -28,16 +27,16 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", - resource_group_name="resourceGroupPS1", - resource_name="RESOURCE_NAME", + subscription_id="SUBSCRIPTION_ID", ) - response = client.operations.list() + response = client.operations.list( + resource_group_name="resourceGroupPS1", + ) for item in response: print(item) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/Operations_List.json +# x-ms-original-file: 2025-08-01/Operations_List.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/recovery_points_get.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/recovery_points_get.py index e9f8003dc9d9..0f5a6d8c800e 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/recovery_points_get.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/recovery_points_get.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. # -------------------------------------------------------------------------- @@ -28,12 +27,12 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) response = client.recovery_points.get( + resource_group_name="resourceGroupPS1", + resource_name="vault1", fabric_name="cloud1", protection_container_name="cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", replicated_protected_item_name="f8491e4f-817a-40dd-a90c-af773978c75b", @@ -42,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/RecoveryPoints_Get.json +# x-ms-original-file: 2025-08-01/RecoveryPoints_Get.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/recovery_points_list_by_replication_protected_items.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/recovery_points_list_by_replication_protected_items.py index fcc8d962623c..87d40d922f93 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/recovery_points_list_by_replication_protected_items.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/recovery_points_list_by_replication_protected_items.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. # -------------------------------------------------------------------------- @@ -28,12 +27,12 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) response = client.recovery_points.list_by_replication_protected_items( + resource_group_name="resourceGroupPS1", + resource_name="vault1", fabric_name="cloud1", protection_container_name="cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", replicated_protected_item_name="f8491e4f-817a-40dd-a90c-af773978c75b", @@ -42,6 +41,6 @@ def main(): print(item) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/RecoveryPoints_ListByReplicationProtectedItems.json +# x-ms-original-file: 2025-08-01/RecoveryPoints_ListByReplicationProtectedItems.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_alert_settings_create.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_alert_settings_create.py index c535d096b01a..5648730b0ff2 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_alert_settings_create.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_alert_settings_create.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. # -------------------------------------------------------------------------- @@ -28,12 +27,12 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_alert_settings.create( + resource_group_name="resourceGroupPS1", + resource_name="vault1", alert_setting_name="defaultAlertSetting", request={ "properties": {"customEmailAddresses": ["ronehr@microsoft.com"], "locale": "", "sendToOwners": "false"} @@ -42,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationAlertSettings_Create.json +# x-ms-original-file: 2025-08-01/ReplicationAlertSettings_Create.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_alert_settings_get.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_alert_settings_get.py index 9b3d11dae494..4852946cf19a 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_alert_settings_get.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_alert_settings_get.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. # -------------------------------------------------------------------------- @@ -28,17 +27,17 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_alert_settings.get( + resource_group_name="resourceGroupPS1", + resource_name="vault1", alert_setting_name="defaultAlertSetting", ) print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationAlertSettings_Get.json +# x-ms-original-file: 2025-08-01/ReplicationAlertSettings_Get.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_alert_settings_list.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_alert_settings_list.py index f7ee14851ef4..aaa9e9f02308 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_alert_settings_list.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_alert_settings_list.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. # -------------------------------------------------------------------------- @@ -28,16 +27,17 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.replication_alert_settings.list( resource_group_name="resourceGroupPS1", resource_name="vault1", ) - - response = client.replication_alert_settings.list() for item in response: print(item) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationAlertSettings_List.json +# x-ms-original-file: 2025-08-01/ReplicationAlertSettings_List.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_appliances_list.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_appliances_list.py index 1bf9af35f74b..5b84d2ff6624 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_appliances_list.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_appliances_list.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. # -------------------------------------------------------------------------- @@ -28,16 +27,17 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.replication_appliances.list( resource_group_name="resourceGroupPS1", resource_name="vault1", ) - - response = client.replication_appliances.list() for item in response: print(item) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationAppliances_List.json +# x-ms-original-file: 2025-08-01/ReplicationAppliances_List.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_eligibility_results_get.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_eligibility_results_get.py index ff1d9780eaa1..57085068caa1 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_eligibility_results_get.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_eligibility_results_get.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. # -------------------------------------------------------------------------- @@ -28,17 +27,16 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="d90d145a-4cdd-45a3-b2c4-971d69775278", - resource_group_name="testRg1", - resource_name="RESOURCE_NAME", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_eligibility_results.get( + resource_group_name="testRg1", virtual_machine_name="testVm1", ) print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationEligibilityResults_Get.json +# x-ms-original-file: 2025-08-01/ReplicationEligibilityResults_Get.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_eligibility_results_list.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_eligibility_results_list.py index ae1ff54c1dab..8339358c6e1a 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_eligibility_results_list.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_eligibility_results_list.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. # -------------------------------------------------------------------------- @@ -28,17 +27,16 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="d90d145a-4cdd-45a3-b2c4-971d69775278", - resource_group_name="testRg1", - resource_name="RESOURCE_NAME", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_eligibility_results.list( + resource_group_name="testRg1", virtual_machine_name="testVm2", ) print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationEligibilityResults_List.json +# x-ms-original-file: 2025-08-01/ReplicationEligibilityResults_List.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_events_get.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_events_get.py index 026e787a1d84..690e9fc52911 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_events_get.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_events_get.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. # -------------------------------------------------------------------------- @@ -28,17 +27,17 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_events.get( + resource_group_name="resourceGroupPS1", + resource_name="vault1", event_name="654b71d0-b2ce-4e6e-a861-98528d4bd375", ) print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationEvents_Get.json +# x-ms-original-file: 2025-08-01/ReplicationEvents_Get.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_events_list.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_events_list.py index f5ede5b142bc..6607a7104f84 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_events_list.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_events_list.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. # -------------------------------------------------------------------------- @@ -28,16 +27,17 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.replication_events.list( resource_group_name="resourceGroupPS1", resource_name="vault1", ) - - response = client.replication_events.list() for item in response: print(item) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationEvents_List.json +# x-ms-original-file: 2025-08-01/ReplicationEvents_List.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_fabrics_check_consistency.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_fabrics_check_consistency.py index c448d3e4517f..3ea3159cf4a7 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_fabrics_check_consistency.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_fabrics_check_consistency.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. # -------------------------------------------------------------------------- @@ -28,17 +27,17 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_fabrics.begin_check_consistency( + resource_group_name="resourceGroupPS1", + resource_name="vault1", fabric_name="cloud1", ).result() print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationFabrics_CheckConsistency.json +# x-ms-original-file: 2025-08-01/ReplicationFabrics_CheckConsistency.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_fabrics_create.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_fabrics_create.py index 8d21ffd22bb5..a4fe437a32bb 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_fabrics_create.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_fabrics_create.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. # -------------------------------------------------------------------------- @@ -28,18 +27,18 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_fabrics.begin_create( + resource_group_name="resourceGroupPS1", + resource_name="vault1", fabric_name="cloud1", input={"properties": {"customDetails": {"instanceType": "FabricSpecificCreationInput"}}}, ).result() print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationFabrics_Create.json +# x-ms-original-file: 2025-08-01/ReplicationFabrics_Create.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_fabrics_delete.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_fabrics_delete.py index e2e5a8f81c72..798c6067e2c5 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_fabrics_delete.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_fabrics_delete.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. # -------------------------------------------------------------------------- @@ -28,16 +27,16 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) client.replication_fabrics.begin_delete( + resource_group_name="resourceGroupPS1", + resource_name="vault1", fabric_name="cloud1", ).result() -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationFabrics_Delete.json +# x-ms-original-file: 2025-08-01/ReplicationFabrics_Delete.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_fabrics_get.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_fabrics_get.py index fbec35a2df70..7161e887311a 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_fabrics_get.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_fabrics_get.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. # -------------------------------------------------------------------------- @@ -28,17 +27,17 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_fabrics.get( + resource_group_name="resourceGroupPS1", + resource_name="vault1", fabric_name="cloud1", ) print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationFabrics_Get.json +# x-ms-original-file: 2025-08-01/ReplicationFabrics_Get.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_fabrics_list.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_fabrics_list.py index e58e12aa2da0..4a0c2479370a 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_fabrics_list.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_fabrics_list.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. # -------------------------------------------------------------------------- @@ -28,16 +27,17 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.replication_fabrics.list( resource_group_name="resourceGroupPS1", resource_name="vault1", ) - - response = client.replication_fabrics.list() for item in response: print(item) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationFabrics_List.json +# x-ms-original-file: 2025-08-01/ReplicationFabrics_List.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_fabrics_migrate_to_aad.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_fabrics_migrate_to_aad.py index 1ee15b570115..0c726947e920 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_fabrics_migrate_to_aad.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_fabrics_migrate_to_aad.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. # -------------------------------------------------------------------------- @@ -28,16 +27,16 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) client.replication_fabrics.begin_migrate_to_aad( + resource_group_name="resourceGroupPS1", + resource_name="vault1", fabric_name="cloud1", ).result() -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationFabrics_MigrateToAad.json +# x-ms-original-file: 2025-08-01/ReplicationFabrics_MigrateToAad.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_fabrics_purge.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_fabrics_purge.py index dcd51fe1c8ea..a3aa55723450 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_fabrics_purge.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_fabrics_purge.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. # -------------------------------------------------------------------------- @@ -28,16 +27,16 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) client.replication_fabrics.begin_purge( + resource_group_name="resourceGroupPS1", + resource_name="vault1", fabric_name="cloud1", ).result() -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationFabrics_Purge.json +# x-ms-original-file: 2025-08-01/ReplicationFabrics_Purge.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_fabrics_reassociate_gateway.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_fabrics_reassociate_gateway.py index 231366e646fb..a0cc09808ab1 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_fabrics_reassociate_gateway.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_fabrics_reassociate_gateway.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. # -------------------------------------------------------------------------- @@ -28,12 +27,12 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="7c943c1b-5122-4097-90c8-861411bdd574", - resource_group_name="MadhaviVRG", - resource_name="MadhaviVault", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_fabrics.begin_reassociate_gateway( + resource_group_name="MadhaviVRG", + resource_name="MadhaviVault", fabric_name="GRACE-V2A-1", failover_process_server_request={ "properties": { @@ -48,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationFabrics_ReassociateGateway.json +# x-ms-original-file: 2025-08-01/ReplicationFabrics_ReassociateGateway.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_fabrics_renew_certificate.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_fabrics_renew_certificate.py index ec32644b2b67..324c3b85ca64 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_fabrics_renew_certificate.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_fabrics_renew_certificate.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. # -------------------------------------------------------------------------- @@ -28,18 +27,18 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_fabrics.begin_renew_certificate( + resource_group_name="resourceGroupPS1", + resource_name="vault1", fabric_name="cloud1", renew_certificate={"properties": {"renewCertificateType": "Cloud"}}, ).result() print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationFabrics_RenewCertificate.json +# x-ms-original-file: 2025-08-01/ReplicationFabrics_RenewCertificate.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_infrastructure_delete.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_infrastructure_delete.py index cfd52b49ec57..95de691675ce 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_infrastructure_delete.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_infrastructure_delete.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. # -------------------------------------------------------------------------- @@ -28,17 +27,16 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) client.replication_fabrics.begin_remove_infra( + resource_group_name="resourceGroupPS1", resource_name="vault1", fabric_name="cloud1", ).result() -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationInfrastructure_Delete.json +# x-ms-original-file: 2025-08-01/ReplicationInfrastructure_Delete.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_jobs_cancel.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_jobs_cancel.py index 8b4ea00b9d94..c05c8cfc2372 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_jobs_cancel.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_jobs_cancel.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. # -------------------------------------------------------------------------- @@ -28,17 +27,17 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_jobs.begin_cancel( + resource_group_name="resourceGroupPS1", + resource_name="vault1", job_name="2653c648-fc72-4316-86f3-fdf8eaa0066b", ).result() print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationJobs_Cancel.json +# x-ms-original-file: 2025-08-01/ReplicationJobs_Cancel.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_jobs_export.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_jobs_export.py index 442f04bc8baa..0cd57834c29f 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_jobs_export.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_jobs_export.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. # -------------------------------------------------------------------------- @@ -28,12 +27,12 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_jobs.begin_export( + resource_group_name="resourceGroupPS1", + resource_name="vault1", job_query_parameter={ "affectedObjectTypes": "", "endTime": "2017-05-04T14:26:51.9161395Z", @@ -44,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationJobs_Export.json +# x-ms-original-file: 2025-08-01/ReplicationJobs_Export.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_jobs_get.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_jobs_get.py index 194dae8db8c8..51fa5d70bbd9 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_jobs_get.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_jobs_get.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. # -------------------------------------------------------------------------- @@ -28,17 +27,17 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_jobs.get( + resource_group_name="resourceGroupPS1", + resource_name="vault1", job_name="58776d0b-3141-48b2-a377-9ad863eb160d", ) print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationJobs_Get.json +# x-ms-original-file: 2025-08-01/ReplicationJobs_Get.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_jobs_list.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_jobs_list.py index a9c204cfa39d..9004007e4075 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_jobs_list.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_jobs_list.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. # -------------------------------------------------------------------------- @@ -28,16 +27,17 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.replication_jobs.list( resource_group_name="resourceGroupPS1", resource_name="vault1", ) - - response = client.replication_jobs.list() for item in response: print(item) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationJobs_List.json +# x-ms-original-file: 2025-08-01/ReplicationJobs_List.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_jobs_restart.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_jobs_restart.py index 79f36fda20af..cda381ae1704 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_jobs_restart.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_jobs_restart.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. # -------------------------------------------------------------------------- @@ -28,17 +27,17 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_jobs.begin_restart( + resource_group_name="resourceGroupPS1", + resource_name="vault1", job_name="0664564c-353e-401a-ab0c-722257c10e25", ).result() print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationJobs_Restart.json +# x-ms-original-file: 2025-08-01/ReplicationJobs_Restart.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_jobs_resume.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_jobs_resume.py index d1e5825a167d..38b3e5e2697f 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_jobs_resume.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_jobs_resume.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. # -------------------------------------------------------------------------- @@ -28,18 +27,18 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_jobs.begin_resume( + resource_group_name="resourceGroupPS1", + resource_name="vault1", job_name="58776d0b-3141-48b2-a377-9ad863eb160d", resume_job_params={"properties": {"comments": " "}}, ).result() print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationJobs_Resume.json +# x-ms-original-file: 2025-08-01/ReplicationJobs_Resume.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_logical_networks_get.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_logical_networks_get.py index 655b239a3a75..3e2beffb8f18 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_logical_networks_get.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_logical_networks_get.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. # -------------------------------------------------------------------------- @@ -28,18 +27,18 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_logical_networks.get( + resource_group_name="resourceGroupPS1", + resource_name="vault1", fabric_name="cloud1", logical_network_name="87ab394f-165f-4aa9-bd84-b018500b4509", ) print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationLogicalNetworks_Get.json +# x-ms-original-file: 2025-08-01/ReplicationLogicalNetworks_Get.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_logical_networks_list_by_replication_fabrics.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_logical_networks_list_by_replication_fabrics.py index d1024470bf8c..cba0b7de188a 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_logical_networks_list_by_replication_fabrics.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_logical_networks_list_by_replication_fabrics.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. # -------------------------------------------------------------------------- @@ -28,18 +27,18 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_logical_networks.list_by_replication_fabrics( + resource_group_name="resourceGroupPS1", + resource_name="vault1", fabric_name="cloud1", ) for item in response: print(item) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationLogicalNetworks_ListByReplicationFabrics.json +# x-ms-original-file: 2025-08-01/ReplicationLogicalNetworks_ListByReplicationFabrics.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_create.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_create.py index 91ae77960c4e..1537170ed1ad 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_create.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_create.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. # -------------------------------------------------------------------------- @@ -28,12 +28,12 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="cb53d0c3-bd59-4721-89bc-06916a9147ef", - resource_group_name="resourcegroup1", - resource_name="migrationvault", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_migration_items.begin_create( + resource_group_name="resourcegroup1", + resource_name="migrationvault", fabric_name="vmwarefabric1", protection_container_name="vmwareContainer1", migration_item_name="virtualmachine1", @@ -45,9 +45,12 @@ def main(): "disksToInclude": [ { "diskId": "disk1", + "diskSizeInGB": 60, + "iops": 3000, "isOSDisk": "true", "logStorageAccountId": "/Subscriptions/cb53d0c3-bd59-4721-89bc-06916a9147ef/resourceGroups/resourcegroup1/providers/Microsoft.Storage/storageAccounts/logStorageAccount1", "logStorageAccountSasSecretName": "logStorageSas", + "throughputInMbps": 5000, } ], "instanceType": "VMwareCbt", @@ -62,6 +65,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationMigrationItems_Create.json +# x-ms-original-file: 2025-08-01/ReplicationMigrationItems_Create.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_delete.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_delete.py index ba3cc01ec0ad..e30cc69e4989 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_delete.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_delete.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. # -------------------------------------------------------------------------- @@ -28,18 +27,18 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="cb53d0c3-bd59-4721-89bc-06916a9147ef", - resource_group_name="resourcegroup1", - resource_name="migrationvault", + subscription_id="SUBSCRIPTION_ID", ) client.replication_migration_items.begin_delete( + resource_group_name="resourcegroup1", + resource_name="migrationvault", fabric_name="vmwarefabric1", protection_container_name="vmwareContainer1", migration_item_name="virtualmachine1", ).result() -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationMigrationItems_Delete.json +# x-ms-original-file: 2025-08-01/ReplicationMigrationItems_Delete.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_get.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_get.py index 9998fcc87ca5..446e959673f8 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_get.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_get.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. # -------------------------------------------------------------------------- @@ -28,12 +27,12 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="cb53d0c3-bd59-4721-89bc-06916a9147ef", - resource_group_name="resourcegroup1", - resource_name="migrationvault", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_migration_items.get( + resource_group_name="resourcegroup1", + resource_name="migrationvault", fabric_name="vmwarefabric1", protection_container_name="vmwareContainer1", migration_item_name="virtualmachine1", @@ -41,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationMigrationItems_Get.json +# x-ms-original-file: 2025-08-01/ReplicationMigrationItems_Get.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_list.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_list.py index 75ef15cc833a..a1256b83830d 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_list.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_list.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. # -------------------------------------------------------------------------- @@ -28,16 +27,17 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="cb53d0c3-bd59-4721-89bc-06916a9147ef", + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.replication_migration_items.list( resource_group_name="resourcegroup1", resource_name="migrationvault", ) - - response = client.replication_migration_items.list() for item in response: print(item) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationMigrationItems_List.json +# x-ms-original-file: 2025-08-01/ReplicationMigrationItems_List.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_list_by_replication_protection_containers.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_list_by_replication_protection_containers.py index 8423d1223c61..82283da849cd 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_list_by_replication_protection_containers.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_list_by_replication_protection_containers.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. # -------------------------------------------------------------------------- @@ -28,12 +27,12 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="cb53d0c3-bd59-4721-89bc-06916a9147ef", - resource_group_name="resourcegroup1", - resource_name="migrationvault", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_migration_items.list_by_replication_protection_containers( + resource_group_name="resourcegroup1", + resource_name="migrationvault", fabric_name="vmwarefabric1", protection_container_name="vmwareContainer1", ) @@ -41,6 +40,6 @@ def main(): print(item) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationMigrationItems_ListByReplicationProtectionContainers.json +# x-ms-original-file: 2025-08-01/ReplicationMigrationItems_ListByReplicationProtectionContainers.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_migrate.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_migrate.py index f5000d13038d..8f47453dcf28 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_migrate.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_migrate.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. # -------------------------------------------------------------------------- @@ -28,12 +27,12 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="cb53d0c3-bd59-4721-89bc-06916a9147ef", - resource_group_name="resourcegroup1", - resource_name="migrationvault", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_migration_items.begin_migrate( + resource_group_name="resourcegroup1", + resource_name="migrationvault", fabric_name="vmwarefabric1", protection_container_name="vmwareContainer1", migration_item_name="virtualmachine1", @@ -44,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationMigrationItems_Migrate.json +# x-ms-original-file: 2025-08-01/ReplicationMigrationItems_Migrate.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_pause_replication.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_pause_replication.py index 5e15b44ab98a..f2e5b855c139 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_pause_replication.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_pause_replication.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. # -------------------------------------------------------------------------- @@ -28,12 +27,12 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="cb53d0c3-bd59-4721-89bc-06916a9147ef", - resource_group_name="resourcegroup1", - resource_name="migrationvault", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_migration_items.begin_pause_replication( + resource_group_name="resourcegroup1", + resource_name="migrationvault", fabric_name="vmwarefabric1", protection_container_name="vmwareContainer1", migration_item_name="virtualmachine1", @@ -42,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationMigrationItems_PauseReplication.json +# x-ms-original-file: 2025-08-01/ReplicationMigrationItems_PauseReplication.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_resume_replication.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_resume_replication.py index cc172e6cbc06..fb8ac9f4647b 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_resume_replication.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_resume_replication.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. # -------------------------------------------------------------------------- @@ -28,12 +27,12 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="cb53d0c3-bd59-4721-89bc-06916a9147ef", - resource_group_name="resourcegroup1", - resource_name="migrationvault", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_migration_items.begin_resume_replication( + resource_group_name="resourcegroup1", + resource_name="migrationvault", fabric_name="vmwarefabric1", protection_container_name="vmwareContainer1", migration_item_name="virtualmachine1", @@ -46,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationMigrationItems_ResumeReplication.json +# x-ms-original-file: 2025-08-01/ReplicationMigrationItems_ResumeReplication.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_resync.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_resync.py index 450e16a41dbd..6a803f96f77b 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_resync.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_resync.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. # -------------------------------------------------------------------------- @@ -28,12 +27,12 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="cb53d0c3-bd59-4721-89bc-06916a9147ef", - resource_group_name="resourcegroup1", - resource_name="migrationvault", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_migration_items.begin_resync( + resource_group_name="resourcegroup1", + resource_name="migrationvault", fabric_name="vmwarefabric1", protection_container_name="vmwareContainer1", migration_item_name="virtualmachine1", @@ -42,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationMigrationItems_Resync.json +# x-ms-original-file: 2025-08-01/ReplicationMigrationItems_Resync.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_test_migrate.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_test_migrate.py index d0bda6e16522..37290a0e5dc7 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_test_migrate.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_test_migrate.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. # -------------------------------------------------------------------------- @@ -28,12 +28,12 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="cb53d0c3-bd59-4721-89bc-06916a9147ef", - resource_group_name="resourcegroup1", - resource_name="migrationvault", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_migration_items.begin_test_migrate( + resource_group_name="resourcegroup1", + resource_name="migrationvault", fabric_name="vmwarefabric1", protection_container_name="vmwareContainer1", migration_item_name="virtualmachine1", @@ -51,6 +51,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationMigrationItems_TestMigrate.json +# x-ms-original-file: 2025-08-01/ReplicationMigrationItems_TestMigrate.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_test_migrate_cleanup.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_test_migrate_cleanup.py index f7bd9ed92e32..9ce3bb5f86a8 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_test_migrate_cleanup.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_test_migrate_cleanup.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. # -------------------------------------------------------------------------- @@ -28,12 +27,12 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="cb53d0c3-bd59-4721-89bc-06916a9147ef", - resource_group_name="resourcegroup1", - resource_name="migrationvault", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_migration_items.begin_test_migrate_cleanup( + resource_group_name="resourcegroup1", + resource_name="migrationvault", fabric_name="vmwarefabric1", protection_container_name="vmwareContainer1", migration_item_name="virtualmachine1", @@ -42,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationMigrationItems_TestMigrateCleanup.json +# x-ms-original-file: 2025-08-01/ReplicationMigrationItems_TestMigrateCleanup.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_update.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_update.py index 4c0e2600b80a..e27444c10bf4 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_update.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_update.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. # -------------------------------------------------------------------------- @@ -28,12 +27,12 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="cb53d0c3-bd59-4721-89bc-06916a9147ef", - resource_group_name="resourcegroup1", - resource_name="migrationvault", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_migration_items.begin_update( + resource_group_name="resourcegroup1", + resource_name="migrationvault", fabric_name="vmwarefabric1", protection_container_name="vmwareContainer1", migration_item_name="virtualmachine1", @@ -42,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationMigrationItems_Update.json +# x-ms-original-file: 2025-08-01/ReplicationMigrationItems_Update.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_network_mappings_create.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_network_mappings_create.py index 397c50c126ea..d329bb008182 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_network_mappings_create.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_network_mappings_create.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. # -------------------------------------------------------------------------- @@ -28,12 +28,12 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="9112a37f-0f3e-46ec-9c00-060c6edca071", - resource_group_name="srcBvte2a14C27", - resource_name="srce2avaultbvtaC27", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_network_mappings.begin_create( + resource_group_name="srcBvte2a14C27", + resource_name="srce2avaultbvtaC27", fabric_name="b0cef6e9a4437b81803d0b55ada4f700ab66caae59c35d62723a1589c0cd13ac", network_name="e2267b5c-2650-49bd-ab3f-d66aae694c06", network_mapping_name="corpe2amap", @@ -48,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationNetworkMappings_Create.json +# x-ms-original-file: 2025-08-01/ReplicationNetworkMappings_Create.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_network_mappings_delete.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_network_mappings_delete.py index e472c775fad2..6d52adafff60 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_network_mappings_delete.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_network_mappings_delete.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. # -------------------------------------------------------------------------- @@ -28,18 +27,18 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="9112a37f-0f3e-46ec-9c00-060c6edca071", - resource_group_name="srcBvte2a14C27", - resource_name="srce2avaultbvtaC27", + subscription_id="SUBSCRIPTION_ID", ) client.replication_network_mappings.begin_delete( + resource_group_name="srcBvte2a14C27", + resource_name="srce2avaultbvtaC27", fabric_name="b0cef6e9a4437b81803d0b55ada4f700ab66caae59c35d62723a1589c0cd13ac", network_name="e2267b5c-2650-49bd-ab3f-d66aae694c06", network_mapping_name="corpe2amap", ).result() -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationNetworkMappings_Delete.json +# x-ms-original-file: 2025-08-01/ReplicationNetworkMappings_Delete.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_network_mappings_get.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_network_mappings_get.py index 04f9eaad3b49..aafa2e7bc328 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_network_mappings_get.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_network_mappings_get.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. # -------------------------------------------------------------------------- @@ -28,12 +27,12 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="9112a37f-0f3e-46ec-9c00-060c6edca071", - resource_group_name="srcBvte2a14C27", - resource_name="srce2avaultbvtaC27", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_network_mappings.get( + resource_group_name="srcBvte2a14C27", + resource_name="srce2avaultbvtaC27", fabric_name="b0cef6e9a4437b81803d0b55ada4f700ab66caae59c35d62723a1589c0cd13ac", network_name="e2267b5c-2650-49bd-ab3f-d66aae694c06", network_mapping_name="corpe2amap", @@ -41,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationNetworkMappings_Get.json +# x-ms-original-file: 2025-08-01/ReplicationNetworkMappings_Get.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_network_mappings_list.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_network_mappings_list.py index 848ad7f1569d..eab7c7ffb9e8 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_network_mappings_list.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_network_mappings_list.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. # -------------------------------------------------------------------------- @@ -28,16 +27,17 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="9112a37f-0f3e-46ec-9c00-060c6edca071", + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.replication_network_mappings.list( resource_group_name="srcBvte2a14C27", resource_name="srce2avaultbvtaC27", ) - - response = client.replication_network_mappings.list() for item in response: print(item) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationNetworkMappings_List.json +# x-ms-original-file: 2025-08-01/ReplicationNetworkMappings_List.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_network_mappings_list_by_replication_networks.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_network_mappings_list_by_replication_networks.py index 58030d237296..9fe17d69aa46 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_network_mappings_list_by_replication_networks.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_network_mappings_list_by_replication_networks.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. # -------------------------------------------------------------------------- @@ -28,12 +27,12 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="9112a37f-0f3e-46ec-9c00-060c6edca071", - resource_group_name="srcBvte2a14C27", - resource_name="srce2avaultbvtaC27", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_network_mappings.list_by_replication_networks( + resource_group_name="srcBvte2a14C27", + resource_name="srce2avaultbvtaC27", fabric_name="b0cef6e9a4437b81803d0b55ada4f700ab66caae59c35d62723a1589c0cd13ac", network_name="e2267b5c-2650-49bd-ab3f-d66aae694c06", ) @@ -41,6 +40,6 @@ def main(): print(item) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationNetworkMappings_ListByReplicationNetworks.json +# x-ms-original-file: 2025-08-01/ReplicationNetworkMappings_ListByReplicationNetworks.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_network_mappings_update.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_network_mappings_update.py index 87ee88a935b8..15868ab05103 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_network_mappings_update.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_network_mappings_update.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. # -------------------------------------------------------------------------- @@ -28,12 +28,12 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="9112a37f-0f3e-46ec-9c00-060c6edca071", - resource_group_name="srcBvte2a14C27", - resource_name="srce2avaultbvtaC27", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_network_mappings.begin_update( + resource_group_name="srcBvte2a14C27", + resource_name="srce2avaultbvtaC27", fabric_name="b0cef6e9a4437b81803d0b55ada4f700ab66caae59c35d62723a1589c0cd13ac", network_name="e2267b5c-2650-49bd-ab3f-d66aae694c06", network_mapping_name="corpe2amap", @@ -48,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationNetworkMappings_Update.json +# x-ms-original-file: 2025-08-01/ReplicationNetworkMappings_Update.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_networks_get.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_networks_get.py index 1a3f49e624af..ee91fa976b04 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_networks_get.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_networks_get.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. # -------------------------------------------------------------------------- @@ -28,18 +27,18 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="9112a37f-0f3e-46ec-9c00-060c6edca071", - resource_group_name="srcBvte2a14C27", - resource_name="srce2avaultbvtaC27", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_networks.get( + resource_group_name="srcBvte2a14C27", + resource_name="srce2avaultbvtaC27", fabric_name="b0cef6e9a4437b81803d0b55ada4f700ab66caae59c35d62723a1589c0cd13ac", network_name="93ce99d7-1219-4914-aa61-73fe5023988e", ) print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationNetworks_Get.json +# x-ms-original-file: 2025-08-01/ReplicationNetworks_Get.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_networks_list.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_networks_list.py index ed932f27d8be..c8bb49c72342 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_networks_list.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_networks_list.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. # -------------------------------------------------------------------------- @@ -28,16 +27,17 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="9112a37f-0f3e-46ec-9c00-060c6edca071", + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.replication_networks.list( resource_group_name="srcBvte2a14C27", resource_name="srce2avaultbvtaC27", ) - - response = client.replication_networks.list() for item in response: print(item) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationNetworks_List.json +# x-ms-original-file: 2025-08-01/ReplicationNetworks_List.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_networks_list_by_replication_fabrics.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_networks_list_by_replication_fabrics.py index 60c80fea3ce7..78728a7dd76a 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_networks_list_by_replication_fabrics.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_networks_list_by_replication_fabrics.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. # -------------------------------------------------------------------------- @@ -28,18 +27,18 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="9112a37f-0f3e-46ec-9c00-060c6edca071", - resource_group_name="srcBvte2a14C27", - resource_name="srce2avaultbvtaC27", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_networks.list_by_replication_fabrics( + resource_group_name="srcBvte2a14C27", + resource_name="srce2avaultbvtaC27", fabric_name="b0cef6e9a4437b81803d0b55ada4f700ab66caae59c35d62723a1589c0cd13ac", ) for item in response: print(item) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationNetworks_ListByReplicationFabrics.json +# x-ms-original-file: 2025-08-01/ReplicationNetworks_ListByReplicationFabrics.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_policies_create.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_policies_create.py index 7b8922933c21..e5ba8d70cb95 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_policies_create.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_policies_create.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. # -------------------------------------------------------------------------- @@ -28,18 +27,18 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_policies.begin_create( + resource_group_name="resourceGroupPS1", + resource_name="vault1", policy_name="protectionprofile1", input={"properties": {"providerSpecificInput": {"instanceType": "HyperVReplicaAzure"}}}, ).result() print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationPolicies_Create.json +# x-ms-original-file: 2025-08-01/ReplicationPolicies_Create.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_policies_delete.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_policies_delete.py index 9e37bd5a2320..86c93c3bd7b6 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_policies_delete.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_policies_delete.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. # -------------------------------------------------------------------------- @@ -28,16 +27,16 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) client.replication_policies.begin_delete( + resource_group_name="resourceGroupPS1", + resource_name="vault1", policy_name="protectionprofile1", ).result() -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationPolicies_Delete.json +# x-ms-original-file: 2025-08-01/ReplicationPolicies_Delete.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_policies_get.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_policies_get.py index 8bf27383da16..67a8142dcac8 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_policies_get.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_policies_get.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. # -------------------------------------------------------------------------- @@ -28,17 +27,17 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_policies.get( + resource_group_name="resourceGroupPS1", + resource_name="vault1", policy_name="protectionprofile1", ) print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationPolicies_Get.json +# x-ms-original-file: 2025-08-01/ReplicationPolicies_Get.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_policies_list.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_policies_list.py index 64d7a5a3d45e..1b7d4eaabaf1 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_policies_list.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_policies_list.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. # -------------------------------------------------------------------------- @@ -28,16 +27,17 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.replication_policies.list( resource_group_name="resourceGroupPS1", resource_name="vault1", ) - - response = client.replication_policies.list() for item in response: print(item) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationPolicies_List.json +# x-ms-original-file: 2025-08-01/ReplicationPolicies_List.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_policies_update.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_policies_update.py index fb14ec50bc43..0ee1e9264260 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_policies_update.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_policies_update.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. # -------------------------------------------------------------------------- @@ -28,18 +27,18 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_policies.begin_update( + resource_group_name="resourceGroupPS1", + resource_name="vault1", policy_name="protectionprofile1", input={"properties": {"replicationProviderSettings": {"instanceType": "HyperVReplicaAzure"}}}, ).result() print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationPolicies_Update.json +# x-ms-original-file: 2025-08-01/ReplicationPolicies_Update.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protectable_items_get.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protectable_items_get.py index a4f7c4042a36..631495aa2154 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protectable_items_get.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protectable_items_get.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. # -------------------------------------------------------------------------- @@ -28,12 +27,12 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_protectable_items.get( + resource_group_name="resourceGroupPS1", + resource_name="vault1", fabric_name="cloud1", protection_container_name="cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", protectable_item_name="c0c14913-3d7a-48ea-9531-cc99e0e686e6", @@ -41,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationProtectableItems_Get.json +# x-ms-original-file: 2025-08-01/ReplicationProtectableItems_Get.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protectable_items_list_by_replication_protection_containers.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protectable_items_list_by_replication_protection_containers.py index 7c0be9ecf49d..d4f73de8a5e1 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protectable_items_list_by_replication_protection_containers.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protectable_items_list_by_replication_protection_containers.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. # -------------------------------------------------------------------------- @@ -28,12 +27,12 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_protectable_items.list_by_replication_protection_containers( + resource_group_name="resourceGroupPS1", + resource_name="vault1", fabric_name="cloud1", protection_container_name="cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", ) @@ -41,6 +40,6 @@ def main(): print(item) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationProtectableItems_ListByReplicationProtectionContainers.json +# x-ms-original-file: 2025-08-01/ReplicationProtectableItems_ListByReplicationProtectionContainers.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_add_disks.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_add_disks.py index c7ea3708e254..d2e7e0f1dd01 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_add_disks.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_add_disks.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. # -------------------------------------------------------------------------- @@ -28,12 +28,12 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_protected_items.begin_add_disks( + resource_group_name="resourceGroupPS1", + resource_name="vault1", fabric_name="cloud1", protection_container_name="cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", replicated_protected_item_name="f8491e4f-817a-40dd-a90c-af773978c75b", @@ -55,6 +55,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationProtectedItems_AddDisks.json +# x-ms-original-file: 2025-08-01/ReplicationProtectedItems_AddDisks.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_apply_recovery_point.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_apply_recovery_point.py index 1fd8f4165109..eaded51b34fe 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_apply_recovery_point.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_apply_recovery_point.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. # -------------------------------------------------------------------------- @@ -28,12 +28,12 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_protected_items.begin_apply_recovery_point( + resource_group_name="resourceGroupPS1", + resource_name="vault1", fabric_name="cloud1", protection_container_name="cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", replicated_protected_item_name="f8491e4f-817a-40dd-a90c-af773978c75b", @@ -47,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationProtectedItems_ApplyRecoveryPoint.json +# x-ms-original-file: 2025-08-01/ReplicationProtectedItems_ApplyRecoveryPoint.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_create.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_create.py index e0dcf4895501..6ae71ec86d49 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_create.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_create.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. # -------------------------------------------------------------------------- @@ -28,12 +28,12 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_protected_items.begin_create( + resource_group_name="resourceGroupPS1", + resource_name="vault1", fabric_name="cloud1", protection_container_name="cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", replicated_protected_item_name="f8491e4f-817a-40dd-a90c-af773978c75b", @@ -48,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationProtectedItems_Create.json +# x-ms-original-file: 2025-08-01/ReplicationProtectedItems_Create.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_delete.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_delete.py index 5332060e091d..68c5a1f39335 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_delete.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_delete.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. # -------------------------------------------------------------------------- @@ -28,12 +27,12 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) client.replication_protected_items.begin_delete( + resource_group_name="resourceGroupPS1", + resource_name="vault1", fabric_name="cloud1", protection_container_name="cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", replicated_protected_item_name="c0c14913-3d7a-48ea-9531-cc99e0e686e6", @@ -43,6 +42,6 @@ def main(): ).result() -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationProtectedItems_Delete.json +# x-ms-original-file: 2025-08-01/ReplicationProtectedItems_Delete.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_failover_cancel.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_failover_cancel.py index 13a516f74cac..72635ba834ad 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_failover_cancel.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_failover_cancel.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. # -------------------------------------------------------------------------- @@ -28,12 +27,12 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_protected_items.begin_failover_cancel( + resource_group_name="resourceGroupPS1", + resource_name="vault1", fabric_name="cloud1", protection_container_name="cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", replicated_protected_item_name="f8491e4f-817a-40dd-a90c-af773978c75b", @@ -41,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationProtectedItems_FailoverCancel.json +# x-ms-original-file: 2025-08-01/ReplicationProtectedItems_FailoverCancel.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_failover_commit.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_failover_commit.py index 74e496350b1b..6251e7b314cf 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_failover_commit.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_failover_commit.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. # -------------------------------------------------------------------------- @@ -28,12 +27,12 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_protected_items.begin_failover_commit( + resource_group_name="resourceGroupPS1", + resource_name="vault1", fabric_name="cloud1", protection_container_name="cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", replicated_protected_item_name="f8491e4f-817a-40dd-a90c-af773978c75b", @@ -41,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationProtectedItems_FailoverCommit.json +# x-ms-original-file: 2025-08-01/ReplicationProtectedItems_FailoverCommit.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_get.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_get.py index 7fc4d195b7fa..8a8b727d8525 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_get.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_get.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. # -------------------------------------------------------------------------- @@ -28,12 +27,12 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_protected_items.get( + resource_group_name="resourceGroupPS1", + resource_name="vault1", fabric_name="cloud1", protection_container_name="cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", replicated_protected_item_name="f8491e4f-817a-40dd-a90c-af773978c75b", @@ -41,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationProtectedItems_Get.json +# x-ms-original-file: 2025-08-01/ReplicationProtectedItems_Get.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_list.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_list.py index bbd9ab594d28..8014d5b071b5 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_list.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_list.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. # -------------------------------------------------------------------------- @@ -28,16 +27,17 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.replication_protected_items.list( resource_group_name="resourceGroupPS1", resource_name="vault1", ) - - response = client.replication_protected_items.list() for item in response: print(item) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationProtectedItems_List.json +# x-ms-original-file: 2025-08-01/ReplicationProtectedItems_List.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_list_by_replication_protection_containers.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_list_by_replication_protection_containers.py index 40819d5e4418..1af3759c23aa 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_list_by_replication_protection_containers.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_list_by_replication_protection_containers.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. # -------------------------------------------------------------------------- @@ -28,12 +27,12 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_protected_items.list_by_replication_protection_containers( + resource_group_name="resourceGroupPS1", + resource_name="vault1", fabric_name="cloud1", protection_container_name="cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", ) @@ -41,6 +40,6 @@ def main(): print(item) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationProtectedItems_ListByReplicationProtectionContainers.json +# x-ms-original-file: 2025-08-01/ReplicationProtectedItems_ListByReplicationProtectionContainers.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_planned_failover.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_planned_failover.py index 365790b0c7eb..4afb6aa766a6 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_planned_failover.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_planned_failover.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. # -------------------------------------------------------------------------- @@ -28,12 +27,12 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_protected_items.begin_planned_failover( + resource_group_name="resourceGroupPS1", + resource_name="vault1", fabric_name="cloud1", protection_container_name="cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", replicated_protected_item_name="f8491e4f-817a-40dd-a90c-af773978c75b", @@ -47,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationProtectedItems_PlannedFailover.json +# x-ms-original-file: 2025-08-01/ReplicationProtectedItems_PlannedFailover.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_purge.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_purge.py index 041245965762..6276f9d5d7d1 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_purge.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_purge.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. # -------------------------------------------------------------------------- @@ -28,18 +27,18 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) client.replication_protected_items.begin_purge( + resource_group_name="resourceGroupPS1", + resource_name="vault1", fabric_name="cloud1", protection_container_name="cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", replicated_protected_item_name="c0c14913-3d7a-48ea-9531-cc99e0e686e6", ).result() -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationProtectedItems_Purge.json +# x-ms-original-file: 2025-08-01/ReplicationProtectedItems_Purge.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_reinstall_mobility_service.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_reinstall_mobility_service.py new file mode 100644 index 000000000000..e353c222fbc7 --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_reinstall_mobility_service.py @@ -0,0 +1,46 @@ +# 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.recoveryservicessiterecovery import SiteRecoveryManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicessiterecovery +# USAGE + python replication_protected_items_reinstall_mobility_service.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 = SiteRecoveryManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.replication_protected_items.begin_reinstall_mobility_service( + resource_group_name="wcusValidations", + resource_name="WCUSVault", + fabric_name="WIN-JKKJ31QI8U2", + protection_container_name="cloud_c6780228-83bd-4f3e-a70e-cb46b7da33a0", + replicated_protected_item_name="79dd20ab-2b40-11e7-9791-0050568f387e", + update_mobility_service_request={"properties": {"runAsAccountId": "2"}}, + ).result() + print(response) + + +# x-ms-original-file: 2025-08-01/ReplicationProtectedItems_ReinstallMobilityService.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_remove_disks.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_remove_disks.py index 60d1f03d9b6e..1a2a51bc66f0 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_remove_disks.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_remove_disks.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. # -------------------------------------------------------------------------- @@ -28,12 +27,12 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_protected_items.begin_remove_disks( + resource_group_name="resourceGroupPS1", + resource_name="vault1", fabric_name="cloud1", protection_container_name="cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", replicated_protected_item_name="f8491e4f-817a-40dd-a90c-af773978c75b", @@ -49,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationProtectedItems_RemoveDisks.json +# x-ms-original-file: 2025-08-01/ReplicationProtectedItems_RemoveDisks.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_repair_replication.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_repair_replication.py index 06095fb2a8c5..2a6300c629c9 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_repair_replication.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_repair_replication.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. # -------------------------------------------------------------------------- @@ -28,12 +27,12 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_protected_items.begin_repair_replication( + resource_group_name="resourceGroupPS1", + resource_name="vault1", fabric_name="cloud1", protection_container_name="cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", replicated_protected_item_name="f8491e4f-817a-40dd-a90c-af773978c75b", @@ -41,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationProtectedItems_RepairReplication.json +# x-ms-original-file: 2025-08-01/ReplicationProtectedItems_RepairReplication.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_reprotect.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_reprotect.py index 05220eb99229..9e74861702a8 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_reprotect.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_reprotect.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. # -------------------------------------------------------------------------- @@ -28,12 +27,12 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_protected_items.begin_reprotect( + resource_group_name="resourceGroupPS1", + resource_name="vault1", fabric_name="cloud1", protection_container_name="cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", replicated_protected_item_name="f8491e4f-817a-40dd-a90c-af773978c75b", @@ -47,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationProtectedItems_Reprotect.json +# x-ms-original-file: 2025-08-01/ReplicationProtectedItems_Reprotect.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_resolve_health_errors.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_resolve_health_errors.py index 41d1511920f5..b239698a414f 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_resolve_health_errors.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_resolve_health_errors.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. # -------------------------------------------------------------------------- @@ -28,12 +27,12 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_protected_items.begin_resolve_health_errors( + resource_group_name="resourceGroupPS1", + resource_name="vault1", fabric_name="cloud1", protection_container_name="cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", replicated_protected_item_name="f8491e4f-817a-40dd-a90c-af773978c75b", @@ -42,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationProtectedItems_ResolveHealthErrors.json +# x-ms-original-file: 2025-08-01/ReplicationProtectedItems_ResolveHealthErrors.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_switch_provider.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_switch_provider.py index edcbe7566083..d54bd5b1b9b7 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_switch_provider.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_switch_provider.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. # -------------------------------------------------------------------------- @@ -28,12 +28,12 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_protected_items.begin_switch_provider( + resource_group_name="resourceGroupPS1", + resource_name="vault1", fabric_name="cloud1", protection_container_name="cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", replicated_protected_item_name="f8491e4f-817a-40dd-a90c-af773978c75b", @@ -52,6 +52,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationProtectedItems_SwitchProvider.json +# x-ms-original-file: 2025-08-01/ReplicationProtectedItems_SwitchProvider.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_test_failover.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_test_failover.py index 4e0fb526fefd..a1a912088dcf 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_test_failover.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_test_failover.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. # -------------------------------------------------------------------------- @@ -28,12 +28,12 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_protected_items.begin_test_failover( + resource_group_name="resourceGroupPS1", + resource_name="vault1", fabric_name="cloud1", protection_container_name="cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", replicated_protected_item_name="f8491e4f-817a-40dd-a90c-af773978c75b", @@ -49,6 +49,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationProtectedItems_TestFailover.json +# x-ms-original-file: 2025-08-01/ReplicationProtectedItems_TestFailover.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_test_failover_cleanup.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_test_failover_cleanup.py index 9a246e84f95d..9dac546b3344 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_test_failover_cleanup.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_test_failover_cleanup.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. # -------------------------------------------------------------------------- @@ -28,12 +27,12 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_protected_items.begin_test_failover_cleanup( + resource_group_name="resourceGroupPS1", + resource_name="vault1", fabric_name="cloud1", protection_container_name="cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", replicated_protected_item_name="f8491e4f-817a-40dd-a90c-af773978c75b", @@ -42,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationProtectedItems_TestFailoverCleanup.json +# x-ms-original-file: 2025-08-01/ReplicationProtectedItems_TestFailoverCleanup.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_unplanned_failover.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_unplanned_failover.py index 72cbcf889693..018d265a9551 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_unplanned_failover.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_unplanned_failover.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. # -------------------------------------------------------------------------- @@ -28,12 +27,12 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_protected_items.begin_unplanned_failover( + resource_group_name="resourceGroupPS1", + resource_name="vault1", fabric_name="cloud1", protection_container_name="cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", replicated_protected_item_name="f8491e4f-817a-40dd-a90c-af773978c75b", @@ -48,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationProtectedItems_UnplannedFailover.json +# x-ms-original-file: 2025-08-01/ReplicationProtectedItems_UnplannedFailover.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_update.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_update.py index 38dd8bc95625..c579838135aa 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_update.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_update.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. # -------------------------------------------------------------------------- @@ -28,12 +28,12 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_protected_items.begin_update( + resource_group_name="resourceGroupPS1", + resource_name="vault1", fabric_name="cloud1", protection_container_name="cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", replicated_protected_item_name="f8491e4f-817a-40dd-a90c-af773978c75b", @@ -64,6 +64,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationProtectedItems_Update.json +# x-ms-original-file: 2025-08-01/ReplicationProtectedItems_Update.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_update_appliance.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_update_appliance.py index 493d526ecafd..75730530b546 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_update_appliance.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_update_appliance.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. # -------------------------------------------------------------------------- @@ -28,12 +27,12 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="7c943c1b-5122-4097-90c8-861411bdd574", - resource_group_name="Ayan-0106-SA-RG", - resource_name="Ayan-0106-SA-Vault", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_protected_items.begin_update_appliance( + resource_group_name="Ayan-0106-SA-RG", + resource_name="Ayan-0106-SA-Vault", fabric_name="Ayan-0106-SA-Vaultreplicationfabric", protection_container_name="Ayan-0106-SA-Vaultreplicationcontainer", replicated_protected_item_name="idclab-vcen67_50158124-8857-3e08-0893-2ddf8ebb8c1f", @@ -47,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationProtectedItems_UpdateAppliance.json +# x-ms-original-file: 2025-08-01/ReplicationProtectedItems_UpdateAppliance.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_update_mobility_service.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_update_mobility_service.py index 32e3d2eb2c00..9bb90aba97ea 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_update_mobility_service.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_update_mobility_service.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. # -------------------------------------------------------------------------- @@ -28,12 +27,12 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="b364ed8d-4279-4bf8-8fd1-56f8fa0ae05c", - resource_group_name="wcusValidations", - resource_name="WCUSVault", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_protected_items.begin_update_mobility_service( + resource_group_name="wcusValidations", + resource_name="WCUSVault", fabric_name="WIN-JKKJ31QI8U2", protection_container_name="cloud_c6780228-83bd-4f3e-a70e-cb46b7da33a0", replicated_protected_item_name="79dd20ab-2b40-11e7-9791-0050568f387e", @@ -42,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationProtectedItems_UpdateMobilityService.json +# x-ms-original-file: 2025-08-01/ReplicationProtectedItems_UpdateMobilityService.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_clusters_apply_recovery_point.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_clusters_apply_recovery_point.py index bdd7def3c22c..58f8dfb48061 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_clusters_apply_recovery_point.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_clusters_apply_recovery_point.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. # -------------------------------------------------------------------------- @@ -28,12 +28,11 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="7c943c1b-5122-4097-90c8-861411bdd574", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_protection_clusters.begin_apply_recovery_point( + resource_group_name="resourceGroupPS1", resource_name="vault1", fabric_name="fabric-pri-eastus", protection_container_name="pri-cloud-eastus", @@ -51,6 +50,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationProtectionClusters_ApplyRecoveryPoint.json +# x-ms-original-file: 2025-08-01/ReplicationProtectionClusters_ApplyRecoveryPoint.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_clusters_create.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_clusters_create.py index 28dee8684a11..f87bb450e1bc 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_clusters_create.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_clusters_create.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. # -------------------------------------------------------------------------- @@ -28,12 +28,12 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_protection_clusters.begin_create( + resource_group_name="resourceGroupPS1", + resource_name="vault1", fabric_name="eastus", protection_container_name="eastus-container", replication_protection_cluster_name="cluster12", @@ -48,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationProtectionClusters_Create.json +# x-ms-original-file: 2025-08-01/ReplicationProtectionClusters_Create.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_clusters_failover_commit.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_clusters_failover_commit.py index 821c94550a09..bae50b87c47b 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_clusters_failover_commit.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_clusters_failover_commit.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. # -------------------------------------------------------------------------- @@ -28,12 +27,11 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="7c943c1b-5122-4097-90c8-861411bdd574", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_protection_clusters.begin_failover_commit( + resource_group_name="resourceGroupPS1", resource_name="vault1", fabric_name="fabric-pri-eastus", protection_container_name="pri-cloud-eastus", @@ -42,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationProtectionClusters_FailoverCommit.json +# x-ms-original-file: 2025-08-01/ReplicationProtectionClusters_FailoverCommit.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_clusters_get.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_clusters_get.py index 344a04e6bf30..29b1869befad 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_clusters_get.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_clusters_get.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. # -------------------------------------------------------------------------- @@ -28,12 +27,11 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_protection_clusters.get( + resource_group_name="resourceGroupPS1", resource_name="vault1", fabric_name="eastus", protection_container_name="eastus-container", @@ -42,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationProtectionClusters_Get.json +# x-ms-original-file: 2025-08-01/ReplicationProtectionClusters_Get.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_clusters_get_operation_results.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_clusters_get_operation_results.py index 9cceab5ca957..bd46f62e1739 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_clusters_get_operation_results.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_clusters_get_operation_results.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. # -------------------------------------------------------------------------- @@ -28,12 +27,11 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_protection_clusters.get_operation_results( + resource_group_name="resourceGroupPS1", resource_name="vault1", fabric_name="eastus", protection_container_name="eastus-container", @@ -43,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationProtectionClusters_GetOperationResults.json +# x-ms-original-file: 2025-08-01/ReplicationProtectionClusters_GetOperationResults.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_clusters_list.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_clusters_list.py index cf42a1b21e4a..aa685ed9168b 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_clusters_list.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_clusters_list.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. # -------------------------------------------------------------------------- @@ -28,18 +27,17 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_protection_clusters.list( + resource_group_name="resourceGroupPS1", resource_name="vault1", ) for item in response: print(item) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationProtectionClusters_List.json +# x-ms-original-file: 2025-08-01/ReplicationProtectionClusters_List.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_clusters_list_by_replication_protection_containers.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_clusters_list_by_replication_protection_containers.py index 2bc8625a4f6b..f2d398c0d762 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_clusters_list_by_replication_protection_containers.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_clusters_list_by_replication_protection_containers.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. # -------------------------------------------------------------------------- @@ -28,12 +27,11 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_protection_clusters.list_by_replication_protection_containers( + resource_group_name="resourceGroupPS1", resource_name="vault1", fabric_name="eastus", protection_container_name="eastus-container", @@ -42,6 +40,6 @@ def main(): print(item) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationProtectionClusters_ListByReplicationProtectionContainers.json +# x-ms-original-file: 2025-08-01/ReplicationProtectionClusters_ListByReplicationProtectionContainers.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_clusters_purge.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_clusters_purge.py index 3cd44c111354..b7f526a7d19f 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_clusters_purge.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_clusters_purge.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. # -------------------------------------------------------------------------- @@ -28,18 +27,18 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) client.replication_protection_clusters.begin_purge( + resource_group_name="resourceGroupPS1", + resource_name="vault1", fabric_name="eastus", protection_container_name="eastus-container", replication_protection_cluster_name="cluster1", ).result() -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationProtectionClusters_Purge.json +# x-ms-original-file: 2025-08-01/ReplicationProtectionClusters_Purge.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_clusters_repair_replication.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_clusters_repair_replication.py index bd3871ab2dcb..4d04f7f1d5fd 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_clusters_repair_replication.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_clusters_repair_replication.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. # -------------------------------------------------------------------------- @@ -28,12 +27,11 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_protection_clusters.begin_repair_replication( + resource_group_name="resourceGroupPS1", resource_name="vault1", fabric_name="eastus", protection_container_name="eastus-container", @@ -42,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationProtectionClusters_RepairReplication.json +# x-ms-original-file: 2025-08-01/ReplicationProtectionClusters_RepairReplication.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_clusters_test_failover.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_clusters_test_failover.py index 6a93a97ea72b..48fdf394dd7d 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_clusters_test_failover.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_clusters_test_failover.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. # -------------------------------------------------------------------------- @@ -28,12 +28,11 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="7c943c1b-5122-4097-90c8-861411bdd574", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_protection_clusters.begin_test_failover( + resource_group_name="resourceGroupPS1", resource_name="vault1", fabric_name="fabric-pri-eastus", protection_container_name="pri-cloud-eastus", @@ -56,6 +55,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationProtectionClusters_TestFailover.json +# x-ms-original-file: 2025-08-01/ReplicationProtectionClusters_TestFailover.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_clusters_test_failover_cleanup.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_clusters_test_failover_cleanup.py index ad18303acd1e..8a82e4c983fa 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_clusters_test_failover_cleanup.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_clusters_test_failover_cleanup.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. # -------------------------------------------------------------------------- @@ -28,12 +27,11 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="7c943c1b-5122-4097-90c8-861411bdd574", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_protection_clusters.begin_test_failover_cleanup( + resource_group_name="resourceGroupPS1", resource_name="vault1", fabric_name="fabric-pri-eastus", protection_container_name="pri-cloud-eastus", @@ -43,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationProtectionClusters_TestFailoverCleanup.json +# x-ms-original-file: 2025-08-01/ReplicationProtectionClusters_TestFailoverCleanup.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_clusters_unplanned_failover.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_clusters_unplanned_failover.py index 13a0a8783db3..a2ce5a309a9e 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_clusters_unplanned_failover.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_clusters_unplanned_failover.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. # -------------------------------------------------------------------------- @@ -28,12 +28,11 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="7c943c1b-5122-4097-90c8-861411bdd574", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_protection_clusters.begin_unplanned_failover( + resource_group_name="resourceGroupPS1", resource_name="vault1", fabric_name="fabric-pri-eastus", protection_container_name="pri-cloud-eastus", @@ -55,6 +54,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationProtectionClusters_UnplannedFailover.json +# x-ms-original-file: 2025-08-01/ReplicationProtectionClusters_UnplannedFailover.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_container_mappings_create.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_container_mappings_create.py index a35cb7d3982d..2334738bba30 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_container_mappings_create.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_container_mappings_create.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. # -------------------------------------------------------------------------- @@ -28,12 +28,12 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_protection_container_mappings.begin_create( + resource_group_name="resourceGroupPS1", + resource_name="vault1", fabric_name="cloud1", protection_container_name="cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", mapping_name="cloud1protectionprofile1", @@ -48,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationProtectionContainerMappings_Create.json +# x-ms-original-file: 2025-08-01/ReplicationProtectionContainerMappings_Create.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_container_mappings_delete.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_container_mappings_delete.py index 46c37bc83eeb..6946221b6b9c 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_container_mappings_delete.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_container_mappings_delete.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. # -------------------------------------------------------------------------- @@ -28,12 +27,12 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) client.replication_protection_container_mappings.begin_delete( + resource_group_name="resourceGroupPS1", + resource_name="vault1", fabric_name="cloud1", protection_container_name="cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", mapping_name="cloud1protectionprofile1", @@ -41,6 +40,6 @@ def main(): ).result() -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationProtectionContainerMappings_Delete.json +# x-ms-original-file: 2025-08-01/ReplicationProtectionContainerMappings_Delete.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_container_mappings_get.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_container_mappings_get.py index 864b36f5d233..5f22ae141362 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_container_mappings_get.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_container_mappings_get.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. # -------------------------------------------------------------------------- @@ -28,12 +27,12 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_protection_container_mappings.get( + resource_group_name="resourceGroupPS1", + resource_name="vault1", fabric_name="cloud1", protection_container_name="cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", mapping_name="cloud1protectionprofile1", @@ -41,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationProtectionContainerMappings_Get.json +# x-ms-original-file: 2025-08-01/ReplicationProtectionContainerMappings_Get.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_container_mappings_list.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_container_mappings_list.py index 931886e934b3..893a89be3590 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_container_mappings_list.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_container_mappings_list.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. # -------------------------------------------------------------------------- @@ -28,16 +27,17 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.replication_protection_container_mappings.list( resource_group_name="resourceGroupPS1", resource_name="vault1", ) - - response = client.replication_protection_container_mappings.list() for item in response: print(item) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationProtectionContainerMappings_List.json +# x-ms-original-file: 2025-08-01/ReplicationProtectionContainerMappings_List.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_container_mappings_list_by_replication_protection_containers.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_container_mappings_list_by_replication_protection_containers.py index 23a2e49771a4..a06d231c7a73 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_container_mappings_list_by_replication_protection_containers.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_container_mappings_list_by_replication_protection_containers.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. # -------------------------------------------------------------------------- @@ -28,12 +27,12 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_protection_container_mappings.list_by_replication_protection_containers( + resource_group_name="resourceGroupPS1", + resource_name="vault1", fabric_name="cloud1", protection_container_name="cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", ) @@ -41,6 +40,6 @@ def main(): print(item) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationProtectionContainerMappings_ListByReplicationProtectionContainers.json +# x-ms-original-file: 2025-08-01/ReplicationProtectionContainerMappings_ListByReplicationProtectionContainers.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_container_mappings_purge.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_container_mappings_purge.py index 8e5d5e594dfb..55a54afdc0dd 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_container_mappings_purge.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_container_mappings_purge.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. # -------------------------------------------------------------------------- @@ -28,18 +27,18 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) client.replication_protection_container_mappings.begin_purge( + resource_group_name="resourceGroupPS1", + resource_name="vault1", fabric_name="cloud1", protection_container_name="cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", mapping_name="cloud1protectionprofile1", ).result() -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationProtectionContainerMappings_Purge.json +# x-ms-original-file: 2025-08-01/ReplicationProtectionContainerMappings_Purge.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_container_mappings_update.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_container_mappings_update.py index 0264315ac9f7..4e2ffefe910a 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_container_mappings_update.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_container_mappings_update.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. # -------------------------------------------------------------------------- @@ -28,12 +28,12 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_protection_container_mappings.begin_update( + resource_group_name="resourceGroupPS1", + resource_name="vault1", fabric_name="cloud1", protection_container_name="cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", mapping_name="cloud1protectionprofile1", @@ -50,6 +50,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationProtectionContainerMappings_Update.json +# x-ms-original-file: 2025-08-01/ReplicationProtectionContainerMappings_Update.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_containers_create.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_containers_create.py index 4b8b33d6deb9..9b6212890f19 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_containers_create.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_containers_create.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. # -------------------------------------------------------------------------- @@ -28,12 +27,12 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_protection_containers.begin_create( + resource_group_name="resourceGroupPS1", + resource_name="vault1", fabric_name="cloud1", protection_container_name="cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", creation_input={ @@ -45,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationProtectionContainers_Create.json +# x-ms-original-file: 2025-08-01/ReplicationProtectionContainers_Create.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_containers_delete.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_containers_delete.py index d5756edc1463..cb60a2efe364 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_containers_delete.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_containers_delete.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. # -------------------------------------------------------------------------- @@ -28,17 +27,17 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) client.replication_protection_containers.begin_delete( + resource_group_name="resourceGroupPS1", + resource_name="vault1", fabric_name="cloud1", protection_container_name="cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", ).result() -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationProtectionContainers_Delete.json +# x-ms-original-file: 2025-08-01/ReplicationProtectionContainers_Delete.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_containers_discover_protectable_item.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_containers_discover_protectable_item.py index 688745e4c42d..26109ba01625 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_containers_discover_protectable_item.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_containers_discover_protectable_item.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. # -------------------------------------------------------------------------- @@ -28,12 +27,12 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="7c943c1b-5122-4097-90c8-861411bdd574", - resource_group_name="MadhaviVRG", - resource_name="MadhaviVault", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_protection_containers.begin_discover_protectable_item( + resource_group_name="MadhaviVRG", + resource_name="MadhaviVault", fabric_name="V2A-W2K12-660", protection_container_name="cloud_7328549c-5c37-4459-a3c2-e35f9ef6893c", discover_protectable_item_request={ @@ -43,6 +42,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationProtectionContainers_DiscoverProtectableItem.json +# x-ms-original-file: 2025-08-01/ReplicationProtectionContainers_DiscoverProtectableItem.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_containers_get.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_containers_get.py index 1d39442588b2..f78d72bf9e02 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_containers_get.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_containers_get.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. # -------------------------------------------------------------------------- @@ -28,18 +27,18 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_protection_containers.get( + resource_group_name="resourceGroupPS1", + resource_name="vault1", fabric_name="cloud1", protection_container_name="cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", ) print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationProtectionContainers_Get.json +# x-ms-original-file: 2025-08-01/ReplicationProtectionContainers_Get.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_containers_list.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_containers_list.py index b568bb386350..0f70844d8550 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_containers_list.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_containers_list.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. # -------------------------------------------------------------------------- @@ -28,16 +27,17 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.replication_protection_containers.list( resource_group_name="resourceGroupPS1", resource_name="vault1", ) - - response = client.replication_protection_containers.list() for item in response: print(item) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationProtectionContainers_List.json +# x-ms-original-file: 2025-08-01/ReplicationProtectionContainers_List.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_containers_list_by_replication_fabrics.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_containers_list_by_replication_fabrics.py index 542b2ca09828..0eb46eacb7ef 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_containers_list_by_replication_fabrics.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_containers_list_by_replication_fabrics.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. # -------------------------------------------------------------------------- @@ -28,18 +27,18 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_protection_containers.list_by_replication_fabrics( + resource_group_name="resourceGroupPS1", + resource_name="vault1", fabric_name="cloud1", ) for item in response: print(item) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationProtectionContainers_ListByReplicationFabrics.json +# x-ms-original-file: 2025-08-01/ReplicationProtectionContainers_ListByReplicationFabrics.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_containers_switch_cluster_protection.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_containers_switch_cluster_protection.py index a8581ab91889..de1adb51f0d1 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_containers_switch_cluster_protection.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_containers_switch_cluster_protection.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. # -------------------------------------------------------------------------- @@ -28,12 +28,11 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="7c943c1b-5122-4097-90c8-861411bdd574", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_protection_containers.begin_switch_cluster_protection( + resource_group_name="resourceGroupPS1", resource_name="vault1", fabric_name="fabric-pri-eastus", protection_container_name="pri-cloud-eastus", @@ -75,6 +74,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationProtectionContainers_SwitchClusterProtection.json +# x-ms-original-file: 2025-08-01/ReplicationProtectionContainers_SwitchClusterProtection.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_containers_switch_protection.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_containers_switch_protection.py index 6f23a5caa8aa..ae5bf44f3d4b 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_containers_switch_protection.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_containers_switch_protection.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. # -------------------------------------------------------------------------- @@ -28,12 +27,12 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="42195872-7e70-4f8a-837f-84b28ecbb78b", - resource_group_name="priyanprg", - resource_name="priyanponeboxvault", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_protection_containers.begin_switch_protection( + resource_group_name="priyanprg", + resource_name="priyanponeboxvault", fabric_name="CentralUSCanSite", protection_container_name="CentralUSCancloud", switch_input={ @@ -46,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationProtectionContainers_SwitchProtection.json +# x-ms-original-file: 2025-08-01/ReplicationProtectionContainers_SwitchProtection.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_intents_create.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_intents_create.py index 58ae80be57bc..5e3d5728f186 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_intents_create.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_intents_create.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. # -------------------------------------------------------------------------- @@ -28,12 +28,12 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="509099b2-9d2c-4636-b43e-bd5cafb6be69", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_protection_intents.create( + resource_group_name="resourceGroupPS1", + resource_name="vault1", intent_object_name="vm1", input={ "properties": { @@ -52,6 +52,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationProtectionIntents_Create.json +# x-ms-original-file: 2025-08-01/ReplicationProtectionIntents_Create.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_intents_get.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_intents_get.py index f58c627c0fe4..d787df08e358 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_intents_get.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_intents_get.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. # -------------------------------------------------------------------------- @@ -28,17 +27,17 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="509099b2-9d2c-4636-b43e-bd5cafb6be69", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_protection_intents.get( + resource_group_name="resourceGroupPS1", + resource_name="vault1", intent_object_name="vm1", ) print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationProtectionIntents_Get.json +# x-ms-original-file: 2025-08-01/ReplicationProtectionIntents_Get.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_intents_list.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_intents_list.py index ca7453ad2b0d..33160a648723 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_intents_list.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_intents_list.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. # -------------------------------------------------------------------------- @@ -28,16 +27,17 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="509099b2-9d2c-4636-b43e-bd5cafb6be69", + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.replication_protection_intents.list( resource_group_name="resourceGroupPS1", resource_name="2007vttp", ) - - response = client.replication_protection_intents.list() for item in response: print(item) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationProtectionIntents_List.json +# x-ms-original-file: 2025-08-01/ReplicationProtectionIntents_List.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_create.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_create.py index 3241b5ea7123..9c4a7c8a8320 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_create.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_create.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. # -------------------------------------------------------------------------- @@ -28,12 +28,12 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_recovery_plans.begin_create( + resource_group_name="resourceGroupPS1", + resource_name="vault1", recovery_plan_name="RPtest1", input={ "properties": { @@ -59,6 +59,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationRecoveryPlans_Create.json +# x-ms-original-file: 2025-08-01/ReplicationRecoveryPlans_Create.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_delete.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_delete.py index 065dcf34fe50..6e32a997eede 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_delete.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_delete.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. # -------------------------------------------------------------------------- @@ -28,16 +27,16 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) client.replication_recovery_plans.begin_delete( + resource_group_name="resourceGroupPS1", + resource_name="vault1", recovery_plan_name="RPtest1", ).result() -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationRecoveryPlans_Delete.json +# x-ms-original-file: 2025-08-01/ReplicationRecoveryPlans_Delete.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_failover_cancel.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_failover_cancel.py index d1d794ae43b5..b187a20ae19b 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_failover_cancel.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_failover_cancel.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. # -------------------------------------------------------------------------- @@ -28,17 +27,17 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_recovery_plans.begin_failover_cancel( + resource_group_name="resourceGroupPS1", + resource_name="vault1", recovery_plan_name="RPtest1", ).result() print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationRecoveryPlans_FailoverCancel.json +# x-ms-original-file: 2025-08-01/ReplicationRecoveryPlans_FailoverCancel.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_failover_commit.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_failover_commit.py index 8899deb56dfd..b29cc2283f3b 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_failover_commit.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_failover_commit.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. # -------------------------------------------------------------------------- @@ -28,17 +27,17 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_recovery_plans.begin_failover_commit( + resource_group_name="resourceGroupPS1", + resource_name="vault1", recovery_plan_name="RPtest1", ).result() print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationRecoveryPlans_FailoverCommit.json +# x-ms-original-file: 2025-08-01/ReplicationRecoveryPlans_FailoverCommit.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_get.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_get.py index 09768034615c..b9686a53e723 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_get.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_get.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. # -------------------------------------------------------------------------- @@ -28,17 +27,17 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_recovery_plans.get( + resource_group_name="resourceGroupPS1", + resource_name="vault1", recovery_plan_name="RPtest1", ) print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationRecoveryPlans_Get.json +# x-ms-original-file: 2025-08-01/ReplicationRecoveryPlans_Get.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_list.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_list.py index 459c1459f4de..2ec28337836b 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_list.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_list.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. # -------------------------------------------------------------------------- @@ -28,16 +27,17 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.replication_recovery_plans.list( resource_group_name="resourceGroupPS1", resource_name="vault1", ) - - response = client.replication_recovery_plans.list() for item in response: print(item) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationRecoveryPlans_List.json +# x-ms-original-file: 2025-08-01/ReplicationRecoveryPlans_List.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_planned_failover.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_planned_failover.py index d0c6445f8453..7b5d9f59cf92 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_planned_failover.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_planned_failover.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. # -------------------------------------------------------------------------- @@ -28,12 +27,12 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_recovery_plans.begin_planned_failover( + resource_group_name="resourceGroupPS1", + resource_name="vault1", recovery_plan_name="RPtest1", input={ "properties": { @@ -45,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationRecoveryPlans_PlannedFailover.json +# x-ms-original-file: 2025-08-01/ReplicationRecoveryPlans_PlannedFailover.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_reprotect.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_reprotect.py index 0369c750f6c6..d56e61604f46 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_reprotect.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_reprotect.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. # -------------------------------------------------------------------------- @@ -28,17 +27,17 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_recovery_plans.begin_reprotect( + resource_group_name="resourceGroupPS1", + resource_name="vault1", recovery_plan_name="RPtest1", ).result() print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationRecoveryPlans_Reprotect.json +# x-ms-original-file: 2025-08-01/ReplicationRecoveryPlans_Reprotect.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_test_failover.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_test_failover.py index 900b987a23e4..47760ccffc4c 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_test_failover.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_test_failover.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. # -------------------------------------------------------------------------- @@ -28,12 +28,12 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_recovery_plans.begin_test_failover( + resource_group_name="resourceGroupPS1", + resource_name="vault1", recovery_plan_name="RPtest1", input={ "properties": { @@ -47,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationRecoveryPlans_TestFailover.json +# x-ms-original-file: 2025-08-01/ReplicationRecoveryPlans_TestFailover.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_test_failover_cleanup.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_test_failover_cleanup.py index 12e6ceeaebc8..bf060b44ccfa 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_test_failover_cleanup.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_test_failover_cleanup.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. # -------------------------------------------------------------------------- @@ -28,18 +27,18 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_recovery_plans.begin_test_failover_cleanup( + resource_group_name="resourceGroupPS1", + resource_name="vault1", recovery_plan_name="RPtest1", input={"properties": {"comments": "Test Failover Cleanup"}}, ).result() print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationRecoveryPlans_TestFailoverCleanup.json +# x-ms-original-file: 2025-08-01/ReplicationRecoveryPlans_TestFailoverCleanup.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_unplanned_failover.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_unplanned_failover.py index 64100528ac87..4e94fe825a19 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_unplanned_failover.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_unplanned_failover.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. # -------------------------------------------------------------------------- @@ -28,12 +27,12 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_recovery_plans.begin_unplanned_failover( + resource_group_name="resourceGroupPS1", + resource_name="vault1", recovery_plan_name="RPtest1", input={ "properties": { @@ -46,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationRecoveryPlans_UnplannedFailover.json +# x-ms-original-file: 2025-08-01/ReplicationRecoveryPlans_UnplannedFailover.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_update.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_update.py index b912840db990..011eb268611e 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_update.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_update.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. # -------------------------------------------------------------------------- @@ -28,12 +28,12 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_recovery_plans.begin_update( + resource_group_name="resourceGroupPS1", + resource_name="vault1", recovery_plan_name="RPtest1", input={ "properties": { @@ -79,6 +79,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationRecoveryPlans_Update.json +# x-ms-original-file: 2025-08-01/ReplicationRecoveryPlans_Update.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_services_providers_create.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_services_providers_create.py index bc1224ce5a7d..81ceedc6ceab 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_services_providers_create.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_services_providers_create.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. # -------------------------------------------------------------------------- @@ -28,12 +27,12 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="cb53d0c3-bd59-4721-89bc-06916a9147ef", - resource_group_name="resourcegroup1", - resource_name="migrationvault", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_recovery_services_providers.begin_create( + resource_group_name="resourcegroup1", + resource_name="migrationvault", fabric_name="vmwarefabric1", provider_name="vmwareprovider1", add_provider_input={ @@ -59,6 +58,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationRecoveryServicesProviders_Create.json +# x-ms-original-file: 2025-08-01/ReplicationRecoveryServicesProviders_Create.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_services_providers_delete.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_services_providers_delete.py index 8fd99079c360..597118015323 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_services_providers_delete.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_services_providers_delete.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. # -------------------------------------------------------------------------- @@ -28,17 +27,17 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) client.replication_recovery_services_providers.begin_delete( + resource_group_name="resourceGroupPS1", + resource_name="vault1", fabric_name="cloud1", provider_name="241641e6-ee7b-4ee4-8141-821fadda43fa", ).result() -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationRecoveryServicesProviders_Delete.json +# x-ms-original-file: 2025-08-01/ReplicationRecoveryServicesProviders_Delete.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_services_providers_get.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_services_providers_get.py index 55c1090e9115..775bd92ebccf 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_services_providers_get.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_services_providers_get.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. # -------------------------------------------------------------------------- @@ -28,18 +27,18 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_recovery_services_providers.get( + resource_group_name="resourceGroupPS1", + resource_name="vault1", fabric_name="cloud1", provider_name="241641e6-ee7b-4ee4-8141-821fadda43fa", ) print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationRecoveryServicesProviders_Get.json +# x-ms-original-file: 2025-08-01/ReplicationRecoveryServicesProviders_Get.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_services_providers_list.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_services_providers_list.py index e4df44157fdd..3b4cf51e35a5 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_services_providers_list.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_services_providers_list.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. # -------------------------------------------------------------------------- @@ -28,16 +27,17 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.replication_recovery_services_providers.list( resource_group_name="resourceGroupPS1", resource_name="vault1", ) - - response = client.replication_recovery_services_providers.list() for item in response: print(item) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationRecoveryServicesProviders_List.json +# x-ms-original-file: 2025-08-01/ReplicationRecoveryServicesProviders_List.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_services_providers_list_by_replication_fabrics.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_services_providers_list_by_replication_fabrics.py index 685c6839cf9a..1b5097164285 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_services_providers_list_by_replication_fabrics.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_services_providers_list_by_replication_fabrics.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. # -------------------------------------------------------------------------- @@ -28,18 +27,18 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_recovery_services_providers.list_by_replication_fabrics( + resource_group_name="resourceGroupPS1", + resource_name="vault1", fabric_name="cloud1", ) for item in response: print(item) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationRecoveryServicesProviders_ListByReplicationFabrics.json +# x-ms-original-file: 2025-08-01/ReplicationRecoveryServicesProviders_ListByReplicationFabrics.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_services_providers_purge.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_services_providers_purge.py index ff6269c47b21..b9ddbaa4415d 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_services_providers_purge.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_services_providers_purge.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. # -------------------------------------------------------------------------- @@ -28,17 +27,17 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) client.replication_recovery_services_providers.begin_purge( + resource_group_name="resourceGroupPS1", + resource_name="vault1", fabric_name="cloud1", provider_name="241641e6-ee7b-4ee4-8141-821fadda43fa", ).result() -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationRecoveryServicesProviders_Purge.json +# x-ms-original-file: 2025-08-01/ReplicationRecoveryServicesProviders_Purge.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_services_providers_refresh_provider.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_services_providers_refresh_provider.py index 1924c9af7ae3..ca115a426c01 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_services_providers_refresh_provider.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_services_providers_refresh_provider.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. # -------------------------------------------------------------------------- @@ -28,18 +27,18 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_recovery_services_providers.begin_refresh_provider( + resource_group_name="resourceGroupPS1", + resource_name="vault1", fabric_name="cloud1", provider_name="241641e6-ee7b-4ee4-8141-821fadda43fa", ).result() print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationRecoveryServicesProviders_RefreshProvider.json +# x-ms-original-file: 2025-08-01/ReplicationRecoveryServicesProviders_RefreshProvider.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_storage_classification_mappings_create.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_storage_classification_mappings_create.py index 65b366e6893a..833f46ad5ab9 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_storage_classification_mappings_create.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_storage_classification_mappings_create.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. # -------------------------------------------------------------------------- @@ -28,12 +28,12 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="9112a37f-0f3e-46ec-9c00-060c6edca071", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_storage_classification_mappings.begin_create( + resource_group_name="resourceGroupPS1", + resource_name="vault1", fabric_name="2a48e3770ac08aa2be8bfbd94fcfb1cbf2dcc487b78fb9d3bd778304441b06a0", storage_classification_name="8891569e-aaef-4a46-a4a0-78c14f2d7b09", storage_classification_mapping_name="testStorageMapping", @@ -46,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationStorageClassificationMappings_Create.json +# x-ms-original-file: 2025-08-01/ReplicationStorageClassificationMappings_Create.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_storage_classification_mappings_delete.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_storage_classification_mappings_delete.py index 3a6b45d8fbdc..833a226fab7f 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_storage_classification_mappings_delete.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_storage_classification_mappings_delete.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. # -------------------------------------------------------------------------- @@ -28,18 +27,18 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="9112a37f-0f3e-46ec-9c00-060c6edca071", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) client.replication_storage_classification_mappings.begin_delete( + resource_group_name="resourceGroupPS1", + resource_name="vault1", fabric_name="2a48e3770ac08aa2be8bfbd94fcfb1cbf2dcc487b78fb9d3bd778304441b06a0", storage_classification_name="8891569e-aaef-4a46-a4a0-78c14f2d7b09", storage_classification_mapping_name="testStorageMapping", ).result() -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationStorageClassificationMappings_Delete.json +# x-ms-original-file: 2025-08-01/ReplicationStorageClassificationMappings_Delete.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_storage_classification_mappings_get.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_storage_classification_mappings_get.py index 5f33c80db86a..2fd966e9fc00 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_storage_classification_mappings_get.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_storage_classification_mappings_get.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. # -------------------------------------------------------------------------- @@ -28,12 +27,12 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="9112a37f-0f3e-46ec-9c00-060c6edca071", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_storage_classification_mappings.get( + resource_group_name="resourceGroupPS1", + resource_name="vault1", fabric_name="2a48e3770ac08aa2be8bfbd94fcfb1cbf2dcc487b78fb9d3bd778304441b06a0", storage_classification_name="8891569e-aaef-4a46-a4a0-78c14f2d7b09", storage_classification_mapping_name="testStorageMapping", @@ -41,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationStorageClassificationMappings_Get.json +# x-ms-original-file: 2025-08-01/ReplicationStorageClassificationMappings_Get.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_storage_classification_mappings_list.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_storage_classification_mappings_list.py index da0cdb9cf8ac..31824b6708d9 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_storage_classification_mappings_list.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_storage_classification_mappings_list.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. # -------------------------------------------------------------------------- @@ -28,16 +27,17 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="9112a37f-0f3e-46ec-9c00-060c6edca071", + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.replication_storage_classification_mappings.list( resource_group_name="resourceGroupPS1", resource_name="vault1", ) - - response = client.replication_storage_classification_mappings.list() for item in response: print(item) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationStorageClassificationMappings_List.json +# x-ms-original-file: 2025-08-01/ReplicationStorageClassificationMappings_List.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_storage_classification_mappings_list_by_replication_storage_classifications.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_storage_classification_mappings_list_by_replication_storage_classifications.py index ea48e5fc456e..ceb601078e1b 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_storage_classification_mappings_list_by_replication_storage_classifications.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_storage_classification_mappings_list_by_replication_storage_classifications.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. # -------------------------------------------------------------------------- @@ -28,12 +27,12 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="9112a37f-0f3e-46ec-9c00-060c6edca071", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_storage_classification_mappings.list_by_replication_storage_classifications( + resource_group_name="resourceGroupPS1", + resource_name="vault1", fabric_name="2a48e3770ac08aa2be8bfbd94fcfb1cbf2dcc487b78fb9d3bd778304441b06a0", storage_classification_name="8891569e-aaef-4a46-a4a0-78c14f2d7b09", ) @@ -41,6 +40,6 @@ def main(): print(item) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationStorageClassificationMappings_ListByReplicationStorageClassifications.json +# x-ms-original-file: 2025-08-01/ReplicationStorageClassificationMappings_ListByReplicationStorageClassifications.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_storage_classifications_get.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_storage_classifications_get.py index 5937eed80393..a4210d4803ae 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_storage_classifications_get.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_storage_classifications_get.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. # -------------------------------------------------------------------------- @@ -28,18 +27,18 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="9112a37f-0f3e-46ec-9c00-060c6edca071", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_storage_classifications.get( + resource_group_name="resourceGroupPS1", + resource_name="vault1", fabric_name="2a48e3770ac08aa2be8bfbd94fcfb1cbf2dcc487b78fb9d3bd778304441b06a0", storage_classification_name="8891569e-aaef-4a46-a4a0-78c14f2d7b09", ) print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationStorageClassifications_Get.json +# x-ms-original-file: 2025-08-01/ReplicationStorageClassifications_Get.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_storage_classifications_list.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_storage_classifications_list.py index 77260bdc7197..a82fe02956f9 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_storage_classifications_list.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_storage_classifications_list.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. # -------------------------------------------------------------------------- @@ -28,16 +27,17 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="9112a37f-0f3e-46ec-9c00-060c6edca071", + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.replication_storage_classifications.list( resource_group_name="resourceGroupPS1", resource_name="vault1", ) - - response = client.replication_storage_classifications.list() for item in response: print(item) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationStorageClassifications_List.json +# x-ms-original-file: 2025-08-01/ReplicationStorageClassifications_List.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_storage_classifications_list_by_replication_fabrics.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_storage_classifications_list_by_replication_fabrics.py index 3c468bb8e914..d2c858da3530 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_storage_classifications_list_by_replication_fabrics.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_storage_classifications_list_by_replication_fabrics.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. # -------------------------------------------------------------------------- @@ -28,18 +27,18 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="9112a37f-0f3e-46ec-9c00-060c6edca071", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_storage_classifications.list_by_replication_fabrics( + resource_group_name="resourceGroupPS1", + resource_name="vault1", fabric_name="2a48e3770ac08aa2be8bfbd94fcfb1cbf2dcc487b78fb9d3bd778304441b06a0", ) for item in response: print(item) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationStorageClassifications_ListByReplicationFabrics.json +# x-ms-original-file: 2025-08-01/ReplicationStorageClassifications_ListByReplicationFabrics.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_vault_health_get.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_vault_health_get.py index 22120d4825e9..3d310a2f4263 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_vault_health_get.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_vault_health_get.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. # -------------------------------------------------------------------------- @@ -28,15 +27,16 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.replication_vault_health.get( resource_group_name="resourceGroupPS1", resource_name="vault1", ) - - response = client.replication_vault_health.get() print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationVaultHealth_Get.json +# x-ms-original-file: 2025-08-01/ReplicationVaultHealth_Get.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_vault_health_refresh.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_vault_health_refresh.py index 228b37cc85e7..44e981599089 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_vault_health_refresh.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_vault_health_refresh.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. # -------------------------------------------------------------------------- @@ -28,15 +27,16 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) - response = client.replication_vault_health.begin_refresh().result() + response = client.replication_vault_health.begin_refresh( + resource_group_name="resourceGroupPS1", + resource_name="vault1", + ).result() print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationVaultHealth_Refresh.json +# x-ms-original-file: 2025-08-01/ReplicationVaultHealth_Refresh.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_vault_setting_create.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_vault_setting_create.py index 89c43c6be24b..8729a72fc3ea 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_vault_setting_create.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_vault_setting_create.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. # -------------------------------------------------------------------------- @@ -28,12 +28,12 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_vault_setting.begin_create( + resource_group_name="resourceGroupPS1", + resource_name="vault1", vault_setting_name="default", input={ "properties": { @@ -44,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationVaultSetting_Create.json +# x-ms-original-file: 2025-08-01/ReplicationVaultSetting_Create.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_vault_setting_get.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_vault_setting_get.py index c8f2cdbed473..18208a4f04f4 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_vault_setting_get.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_vault_setting_get.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. # -------------------------------------------------------------------------- @@ -28,17 +27,17 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", - resource_group_name="resourceGroupPS1", - resource_name="vault1", + subscription_id="SUBSCRIPTION_ID", ) response = client.replication_vault_setting.get( + resource_group_name="resourceGroupPS1", + resource_name="vault1", vault_setting_name="default", ) print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationVaultSetting_Get.json +# x-ms-original-file: 2025-08-01/ReplicationVaultSetting_Get.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_vault_setting_list.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_vault_setting_list.py index c4654b14d080..2a0c36f18d1c 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_vault_setting_list.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_vault_setting_list.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. # -------------------------------------------------------------------------- @@ -28,16 +27,17 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.replication_vault_setting.list( resource_group_name="resourceGroupPS1", resource_name="vault1", ) - - response = client.replication_vault_setting.list() for item in response: print(item) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationVaultSetting_List.json +# x-ms-original-file: 2025-08-01/ReplicationVaultSetting_List.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replicationv_centers_create.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replicationv_centers_create.py index bea96e768d87..daf0e1e4a03c 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replicationv_centers_create.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replicationv_centers_create.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. # -------------------------------------------------------------------------- @@ -28,12 +27,12 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="7c943c1b-5122-4097-90c8-861411bdd574", - resource_group_name="MadhaviVRG", - resource_name="MadhaviVault", + subscription_id="SUBSCRIPTION_ID", ) response = client.replicationv_centers.begin_create( + resource_group_name="MadhaviVRG", + resource_name="MadhaviVault", fabric_name="MadhaviFabric", vcenter_name="esx-78", add_v_center_request={ @@ -49,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationvCenters_Create.json +# x-ms-original-file: 2025-08-01/ReplicationvCenters_Create.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replicationv_centers_delete.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replicationv_centers_delete.py index 5d223e815350..6fd7db18274d 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replicationv_centers_delete.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replicationv_centers_delete.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. # -------------------------------------------------------------------------- @@ -28,17 +27,17 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="7c943c1b-5122-4097-90c8-861411bdd574", - resource_group_name="MadhaviVRG", - resource_name="MadhaviVault", + subscription_id="SUBSCRIPTION_ID", ) client.replicationv_centers.begin_delete( + resource_group_name="MadhaviVRG", + resource_name="MadhaviVault", fabric_name="MadhaviFabric", vcenter_name="esx-78", ).result() -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationvCenters_Delete.json +# x-ms-original-file: 2025-08-01/ReplicationvCenters_Delete.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replicationv_centers_get.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replicationv_centers_get.py index 6bb8e8ffd7ab..6104730042e9 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replicationv_centers_get.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replicationv_centers_get.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. # -------------------------------------------------------------------------- @@ -28,18 +27,18 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="7c943c1b-5122-4097-90c8-861411bdd574", - resource_group_name="MadhaviVRG", - resource_name="MadhaviVault", + subscription_id="SUBSCRIPTION_ID", ) response = client.replicationv_centers.get( + resource_group_name="MadhaviVRG", + resource_name="MadhaviVault", fabric_name="MadhaviFabric", vcenter_name="esx-78", ) print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationvCenters_Get.json +# x-ms-original-file: 2025-08-01/ReplicationvCenters_Get.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replicationv_centers_list.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replicationv_centers_list.py index 4f98a244d0fb..41d9c51f0b08 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replicationv_centers_list.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replicationv_centers_list.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. # -------------------------------------------------------------------------- @@ -28,16 +27,17 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="7c943c1b-5122-4097-90c8-861411bdd574", + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.replicationv_centers.list( resource_group_name="MadhaviVRG", resource_name="MadhaviVault", ) - - response = client.replicationv_centers.list() for item in response: print(item) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationvCenters_List.json +# x-ms-original-file: 2025-08-01/ReplicationvCenters_List.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replicationv_centers_list_by_replication_fabrics.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replicationv_centers_list_by_replication_fabrics.py index 152fc4c368f5..d746857b0b54 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replicationv_centers_list_by_replication_fabrics.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replicationv_centers_list_by_replication_fabrics.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. # -------------------------------------------------------------------------- @@ -28,18 +27,18 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="7c943c1b-5122-4097-90c8-861411bdd574", - resource_group_name="MadhaviVRG", - resource_name="MadhaviVault", + subscription_id="SUBSCRIPTION_ID", ) response = client.replicationv_centers.list_by_replication_fabrics( + resource_group_name="MadhaviVRG", + resource_name="MadhaviVault", fabric_name="MadhaviFabric", ) for item in response: print(item) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationvCenters_ListByReplicationFabrics.json +# x-ms-original-file: 2025-08-01/ReplicationvCenters_ListByReplicationFabrics.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replicationv_centers_update.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replicationv_centers_update.py index 67ae81d13741..6d09d74797dc 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replicationv_centers_update.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replicationv_centers_update.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. # -------------------------------------------------------------------------- @@ -28,12 +27,12 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="7c943c1b-5122-4097-90c8-861411bdd574", - resource_group_name="MadhaviVRG", - resource_name="MadhaviVault", + subscription_id="SUBSCRIPTION_ID", ) response = client.replicationv_centers.begin_update( + resource_group_name="MadhaviVRG", + resource_name="MadhaviVault", fabric_name="MadhaviFabric", vcenter_name="esx-78", update_v_center_request={"properties": {"ipAddress": "10.150.109.25"}}, @@ -41,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/ReplicationvCenters_Update.json +# x-ms-original-file: 2025-08-01/ReplicationvCenters_Update.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/supported_operating_systems_get.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/supported_operating_systems_get.py index 26c7cdf544f6..264c7e806a1a 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/supported_operating_systems_get.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/supported_operating_systems_get.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. # -------------------------------------------------------------------------- @@ -28,15 +27,16 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.supported_operating_systems.get( resource_group_name="resourceGroupPS1", resource_name="vault1", ) - - response = client.supported_operating_systems.get() print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/SupportedOperatingSystems_Get.json +# x-ms-original-file: 2025-08-01/SupportedOperatingSystems_Get.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/target_compute_sizes_list_by_replication_protected_items.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/target_compute_sizes_list_by_replication_protected_items.py index eeb18ef28582..29c6e2c7c47d 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/target_compute_sizes_list_by_replication_protected_items.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/target_compute_sizes_list_by_replication_protected_items.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. # -------------------------------------------------------------------------- @@ -28,12 +27,12 @@ def main(): client = SiteRecoveryManagementClient( credential=DefaultAzureCredential(), - subscription_id="6808dbbc-98c7-431f-a1b1-9580902423b7", - resource_group_name="avraiMgDiskVaultRG", - resource_name="avraiMgDiskVault", + subscription_id="SUBSCRIPTION_ID", ) response = client.target_compute_sizes.list_by_replication_protected_items( + resource_group_name="avraiMgDiskVaultRG", + resource_name="avraiMgDiskVault", fabric_name="asr-a2a-default-centraluseuap", protection_container_name="asr-a2a-default-centraluseuap-container", replicated_protected_item_name="468c912d-b1ab-4ea2-97eb-4b5095155db2", @@ -42,6 +41,6 @@ def main(): print(item) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2025-01-01/examples/TargetComputeSizes_ListByReplicationProtectedItems.json +# x-ms-original-file: 2025-08-01/TargetComputeSizes_ListByReplicationProtectedItems.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/conftest.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/conftest.py index 0b42791e7e20..07f6112ca76c 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/conftest.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/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 diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_cluster_recovery_point_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_cluster_recovery_point_operations.py index cdfd42b6509d..f5101d91e679 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_cluster_recovery_point_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_cluster_recovery_point_operations.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 pytest @@ -22,12 +22,12 @@ def setup_method(self, method): @recorded_by_proxy def test_cluster_recovery_point_get(self, resource_group): response = self.client.cluster_recovery_point.get( + resource_group_name=resource_group.name, resource_name="str", fabric_name="str", protection_container_name="str", replication_protection_cluster_name="str", recovery_point_name="str", - api_version="2025-01-01", ) # please add some check logic here by yourself diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_cluster_recovery_point_operations_async.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_cluster_recovery_point_operations_async.py index 4f43715ed4a8..a65630050803 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_cluster_recovery_point_operations_async.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_cluster_recovery_point_operations_async.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 pytest @@ -23,12 +23,12 @@ def setup_method(self, method): @recorded_by_proxy_async async def test_cluster_recovery_point_get(self, resource_group): response = await self.client.cluster_recovery_point.get( + resource_group_name=resource_group.name, resource_name="str", fabric_name="str", protection_container_name="str", replication_protection_cluster_name="str", recovery_point_name="str", - api_version="2025-01-01", ) # please add some check logic here by yourself diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_cluster_recovery_points_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_cluster_recovery_points_operations.py index 136f7aed2bd2..bd125427bedb 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_cluster_recovery_points_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_cluster_recovery_points_operations.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 pytest @@ -22,11 +22,11 @@ def setup_method(self, method): @recorded_by_proxy def test_cluster_recovery_points_list_by_replication_protection_cluster(self, resource_group): response = self.client.cluster_recovery_points.list_by_replication_protection_cluster( + resource_group_name=resource_group.name, resource_name="str", fabric_name="str", protection_container_name="str", replication_protection_cluster_name="str", - api_version="2025-01-01", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_cluster_recovery_points_operations_async.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_cluster_recovery_points_operations_async.py index 327ee38464d0..737c75781d68 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_cluster_recovery_points_operations_async.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_cluster_recovery_points_operations_async.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 pytest @@ -23,11 +23,11 @@ def setup_method(self, method): @recorded_by_proxy_async async def test_cluster_recovery_points_list_by_replication_protection_cluster(self, resource_group): response = self.client.cluster_recovery_points.list_by_replication_protection_cluster( + resource_group_name=resource_group.name, resource_name="str", fabric_name="str", protection_container_name="str", replication_protection_cluster_name="str", - api_version="2025-01-01", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_migration_recovery_points_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_migration_recovery_points_operations.py index b4b2fabed64d..55cfc14a75cf 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_migration_recovery_points_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_migration_recovery_points_operations.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 pytest @@ -20,27 +20,29 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_migration_recovery_points_list_by_replication_migration_items(self, resource_group): - response = self.client.migration_recovery_points.list_by_replication_migration_items( + def test_migration_recovery_points_get(self, resource_group): + response = self.client.migration_recovery_points.get( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", migration_item_name="str", - api_version="2025-01-01", + migration_recovery_point_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_migration_recovery_points_get(self, resource_group): - response = self.client.migration_recovery_points.get( + def test_migration_recovery_points_list_by_replication_migration_items(self, resource_group): + response = self.client.migration_recovery_points.list_by_replication_migration_items( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", migration_item_name="str", - migration_recovery_point_name="str", - api_version="2025-01-01", ) - + result = [r for r in response] # please add some check logic here by yourself # ... diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_migration_recovery_points_operations_async.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_migration_recovery_points_operations_async.py index 2ece24c2200a..106827c78551 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_migration_recovery_points_operations_async.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_migration_recovery_points_operations_async.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 pytest @@ -21,27 +21,29 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_migration_recovery_points_list_by_replication_migration_items(self, resource_group): - response = self.client.migration_recovery_points.list_by_replication_migration_items( + async def test_migration_recovery_points_get(self, resource_group): + response = await self.client.migration_recovery_points.get( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", migration_item_name="str", - api_version="2025-01-01", + migration_recovery_point_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_migration_recovery_points_get(self, resource_group): - response = await self.client.migration_recovery_points.get( + async def test_migration_recovery_points_list_by_replication_migration_items(self, resource_group): + response = self.client.migration_recovery_points.list_by_replication_migration_items( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", migration_item_name="str", - migration_recovery_point_name="str", - api_version="2025-01-01", ) - + result = [r async for r in response] # please add some check logic here by yourself # ... diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_operations.py index 096baab9a62e..cd5946fb5193 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_operations.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 pytest @@ -22,7 +22,7 @@ def setup_method(self, method): @recorded_by_proxy def test_operations_list(self, resource_group): response = self.client.operations.list( - api_version="2025-01-01", + resource_group_name=resource_group.name, ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_operations_async.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_operations_async.py index 89d1d39f542b..ff81f9387c9d 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_operations_async.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_operations_async.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 pytest @@ -23,7 +23,7 @@ def setup_method(self, method): @recorded_by_proxy_async async def test_operations_list(self, resource_group): response = self.client.operations.list( - api_version="2025-01-01", + resource_group_name=resource_group.name, ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_recovery_points_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_recovery_points_operations.py index a0b63caf2d79..fe48d37a9ded 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_recovery_points_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_recovery_points_operations.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 pytest @@ -20,27 +20,29 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_recovery_points_list_by_replication_protected_items(self, resource_group): - response = self.client.recovery_points.list_by_replication_protected_items( + def test_recovery_points_get(self, resource_group): + response = self.client.recovery_points.get( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", replicated_protected_item_name="str", - api_version="2025-01-01", + recovery_point_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_recovery_points_get(self, resource_group): - response = self.client.recovery_points.get( + def test_recovery_points_list_by_replication_protected_items(self, resource_group): + response = self.client.recovery_points.list_by_replication_protected_items( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", replicated_protected_item_name="str", - recovery_point_name="str", - api_version="2025-01-01", ) - + result = [r for r in response] # please add some check logic here by yourself # ... diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_recovery_points_operations_async.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_recovery_points_operations_async.py index 35e8479c7910..99cbabf09b68 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_recovery_points_operations_async.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_recovery_points_operations_async.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 pytest @@ -21,27 +21,29 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_recovery_points_list_by_replication_protected_items(self, resource_group): - response = self.client.recovery_points.list_by_replication_protected_items( + async def test_recovery_points_get(self, resource_group): + response = await self.client.recovery_points.get( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", replicated_protected_item_name="str", - api_version="2025-01-01", + recovery_point_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_recovery_points_get(self, resource_group): - response = await self.client.recovery_points.get( + async def test_recovery_points_list_by_replication_protected_items(self, resource_group): + response = self.client.recovery_points.list_by_replication_protected_items( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", replicated_protected_item_name="str", - recovery_point_name="str", - api_version="2025-01-01", ) - + result = [r async for r in response] # please add some check logic here by yourself # ... diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_alert_settings_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_alert_settings_operations.py index f9771dfedbbe..a3876c0798bd 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_alert_settings_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_alert_settings_operations.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 pytest @@ -18,22 +18,13 @@ class TestSiteRecoveryManagementReplicationAlertSettingsOperations(AzureMgmtReco def setup_method(self, method): self.client = self.create_mgmt_client(SiteRecoveryManagementClient) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_replication_alert_settings_list(self, resource_group): - response = self.client.replication_alert_settings.list( - api_version="2025-01-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_replication_alert_settings_get(self, resource_group): response = self.client.replication_alert_settings.get( + resource_group_name=resource_group.name, + resource_name="str", alert_setting_name="str", - api_version="2025-01-01", ) # please add some check logic here by yourself @@ -43,10 +34,22 @@ def test_replication_alert_settings_get(self, resource_group): @recorded_by_proxy def test_replication_alert_settings_create(self, resource_group): response = self.client.replication_alert_settings.create( + resource_group_name=resource_group.name, + resource_name="str", alert_setting_name="str", request={"properties": {"customEmailAddresses": ["str"], "locale": "str", "sendToOwners": "str"}}, - api_version="2025-01-01", ) # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_replication_alert_settings_list(self, resource_group): + response = self.client.replication_alert_settings.list( + resource_group_name=resource_group.name, + resource_name="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_alert_settings_operations_async.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_alert_settings_operations_async.py index 1fc2d667bec0..2c39de39c57a 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_alert_settings_operations_async.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_alert_settings_operations_async.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 pytest @@ -19,22 +19,13 @@ class TestSiteRecoveryManagementReplicationAlertSettingsOperationsAsync(AzureMgm def setup_method(self, method): self.client = self.create_mgmt_client(SiteRecoveryManagementClient, is_async=True) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_replication_alert_settings_list(self, resource_group): - response = self.client.replication_alert_settings.list( - api_version="2025-01-01", - ) - 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_replication_alert_settings_get(self, resource_group): response = await self.client.replication_alert_settings.get( + resource_group_name=resource_group.name, + resource_name="str", alert_setting_name="str", - api_version="2025-01-01", ) # please add some check logic here by yourself @@ -44,10 +35,22 @@ async def test_replication_alert_settings_get(self, resource_group): @recorded_by_proxy_async async def test_replication_alert_settings_create(self, resource_group): response = await self.client.replication_alert_settings.create( + resource_group_name=resource_group.name, + resource_name="str", alert_setting_name="str", request={"properties": {"customEmailAddresses": ["str"], "locale": "str", "sendToOwners": "str"}}, - api_version="2025-01-01", ) # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_replication_alert_settings_list(self, resource_group): + response = self.client.replication_alert_settings.list( + resource_group_name=resource_group.name, + resource_name="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_appliances_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_appliances_operations.py index a9044254151a..5133ce28319c 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_appliances_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_appliances_operations.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 pytest @@ -22,7 +22,8 @@ def setup_method(self, method): @recorded_by_proxy def test_replication_appliances_list(self, resource_group): response = self.client.replication_appliances.list( - api_version="2025-01-01", + resource_group_name=resource_group.name, + resource_name="str", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_appliances_operations_async.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_appliances_operations_async.py index 889f76bf44ae..c0f90e52b15f 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_appliances_operations_async.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_appliances_operations_async.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 pytest @@ -23,7 +23,8 @@ def setup_method(self, method): @recorded_by_proxy_async async def test_replication_appliances_list(self, resource_group): response = self.client.replication_appliances.list( - api_version="2025-01-01", + resource_group_name=resource_group.name, + resource_name="str", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_eligibility_results_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_eligibility_results_operations.py index 8a001c3c5e00..804e0c57659a 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_eligibility_results_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_eligibility_results_operations.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 pytest @@ -20,10 +20,10 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_replication_eligibility_results_list(self, resource_group): - response = self.client.replication_eligibility_results.list( + def test_replication_eligibility_results_get(self, resource_group): + response = self.client.replication_eligibility_results.get( + resource_group_name=resource_group.name, virtual_machine_name="str", - api_version="2025-01-01", ) # please add some check logic here by yourself @@ -31,10 +31,10 @@ def test_replication_eligibility_results_list(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_replication_eligibility_results_get(self, resource_group): - response = self.client.replication_eligibility_results.get( + def test_replication_eligibility_results_list(self, resource_group): + response = self.client.replication_eligibility_results.list( + resource_group_name=resource_group.name, virtual_machine_name="str", - api_version="2025-01-01", ) # please add some check logic here by yourself diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_eligibility_results_operations_async.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_eligibility_results_operations_async.py index 44051906bb37..21839fea2149 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_eligibility_results_operations_async.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_eligibility_results_operations_async.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 pytest @@ -21,10 +21,10 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_replication_eligibility_results_list(self, resource_group): - response = await self.client.replication_eligibility_results.list( + async def test_replication_eligibility_results_get(self, resource_group): + response = await self.client.replication_eligibility_results.get( + resource_group_name=resource_group.name, virtual_machine_name="str", - api_version="2025-01-01", ) # please add some check logic here by yourself @@ -32,10 +32,10 @@ async def test_replication_eligibility_results_list(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_replication_eligibility_results_get(self, resource_group): - response = await self.client.replication_eligibility_results.get( + async def test_replication_eligibility_results_list(self, resource_group): + response = await self.client.replication_eligibility_results.list( + resource_group_name=resource_group.name, virtual_machine_name="str", - api_version="2025-01-01", ) # please add some check logic here by yourself diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_events_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_events_operations.py index f0935962bade..48e542a4b210 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_events_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_events_operations.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 pytest @@ -20,21 +20,23 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_replication_events_list(self, resource_group): - response = self.client.replication_events.list( - api_version="2025-01-01", + def test_replication_events_get(self, resource_group): + response = self.client.replication_events.get( + resource_group_name=resource_group.name, + resource_name="str", + event_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_replication_events_get(self, resource_group): - response = self.client.replication_events.get( - event_name="str", - api_version="2025-01-01", + def test_replication_events_list(self, resource_group): + response = self.client.replication_events.list( + resource_group_name=resource_group.name, + resource_name="str", ) - + result = [r for r in response] # please add some check logic here by yourself # ... diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_events_operations_async.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_events_operations_async.py index 2c2ff4d83903..236821097a7c 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_events_operations_async.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_events_operations_async.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 pytest @@ -21,21 +21,23 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_replication_events_list(self, resource_group): - response = self.client.replication_events.list( - api_version="2025-01-01", + async def test_replication_events_get(self, resource_group): + response = await self.client.replication_events.get( + resource_group_name=resource_group.name, + resource_name="str", + event_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_replication_events_get(self, resource_group): - response = await self.client.replication_events.get( - event_name="str", - api_version="2025-01-01", + async def test_replication_events_list(self, resource_group): + response = self.client.replication_events.list( + resource_group_name=resource_group.name, + resource_name="str", ) - + result = [r async for r in response] # please add some check logic here by yourself # ... diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_fabrics_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_fabrics_operations.py index 2dd60f1ec629..bf2adfa9460b 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_fabrics_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_fabrics_operations.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 pytest @@ -18,22 +18,13 @@ class TestSiteRecoveryManagementReplicationFabricsOperations(AzureMgmtRecordedTe def setup_method(self, method): self.client = self.create_mgmt_client(SiteRecoveryManagementClient) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_replication_fabrics_list(self, resource_group): - response = self.client.replication_fabrics.list( - api_version="2025-01-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_replication_fabrics_get(self, resource_group): response = self.client.replication_fabrics.get( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", - api_version="2025-01-01", ) # please add some check logic here by yourself @@ -43,9 +34,10 @@ def test_replication_fabrics_get(self, resource_group): @recorded_by_proxy def test_replication_fabrics_begin_create(self, resource_group): response = self.client.replication_fabrics.begin_create( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", input={"properties": {"customDetails": "fabric_specific_creation_input"}}, - api_version="2025-01-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -55,19 +47,32 @@ def test_replication_fabrics_begin_create(self, resource_group): @recorded_by_proxy def test_replication_fabrics_begin_purge(self, resource_group): response = self.client.replication_fabrics.begin_purge( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", - api_version="2025-01-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_replication_fabrics_list(self, resource_group): + response = self.client.replication_fabrics.list( + resource_group_name=resource_group.name, + resource_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_replication_fabrics_begin_check_consistency(self, resource_group): response = self.client.replication_fabrics.begin_check_consistency( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", - api_version="2025-01-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -77,8 +82,9 @@ def test_replication_fabrics_begin_check_consistency(self, resource_group): @recorded_by_proxy def test_replication_fabrics_begin_migrate_to_aad(self, resource_group): response = self.client.replication_fabrics.begin_migrate_to_aad( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", - api_version="2025-01-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -88,6 +94,8 @@ def test_replication_fabrics_begin_migrate_to_aad(self, resource_group): @recorded_by_proxy def test_replication_fabrics_begin_reassociate_gateway(self, resource_group): response = self.client.replication_fabrics.begin_reassociate_gateway( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", failover_process_server_request={ "properties": { @@ -98,7 +106,6 @@ def test_replication_fabrics_begin_reassociate_gateway(self, resource_group): "vmsToMigrate": ["str"], } }, - api_version="2025-01-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -108,8 +115,9 @@ def test_replication_fabrics_begin_reassociate_gateway(self, resource_group): @recorded_by_proxy def test_replication_fabrics_begin_delete(self, resource_group): response = self.client.replication_fabrics.begin_delete( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", - api_version="2025-01-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -119,9 +127,10 @@ def test_replication_fabrics_begin_delete(self, resource_group): @recorded_by_proxy def test_replication_fabrics_begin_renew_certificate(self, resource_group): response = self.client.replication_fabrics.begin_renew_certificate( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", renew_certificate={"properties": {"renewCertificateType": "str"}}, - api_version="2025-01-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -131,9 +140,9 @@ def test_replication_fabrics_begin_renew_certificate(self, resource_group): @recorded_by_proxy def test_replication_fabrics_begin_remove_infra(self, resource_group): response = self.client.replication_fabrics.begin_remove_infra( + resource_group_name=resource_group.name, resource_name="str", fabric_name="str", - api_version="2025-01-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_fabrics_operations_async.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_fabrics_operations_async.py index 568bc920ed54..7d2013880cac 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_fabrics_operations_async.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_fabrics_operations_async.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 pytest @@ -19,22 +19,13 @@ class TestSiteRecoveryManagementReplicationFabricsOperationsAsync(AzureMgmtRecor def setup_method(self, method): self.client = self.create_mgmt_client(SiteRecoveryManagementClient, is_async=True) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_replication_fabrics_list(self, resource_group): - response = self.client.replication_fabrics.list( - api_version="2025-01-01", - ) - 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_replication_fabrics_get(self, resource_group): response = await self.client.replication_fabrics.get( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", - api_version="2025-01-01", ) # please add some check logic here by yourself @@ -45,9 +36,10 @@ async def test_replication_fabrics_get(self, resource_group): async def test_replication_fabrics_begin_create(self, resource_group): response = await ( await self.client.replication_fabrics.begin_create( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", input={"properties": {"customDetails": "fabric_specific_creation_input"}}, - api_version="2025-01-01", ) ).result() # call '.result()' to poll until service return final result @@ -59,21 +51,34 @@ async def test_replication_fabrics_begin_create(self, resource_group): async def test_replication_fabrics_begin_purge(self, resource_group): response = await ( await self.client.replication_fabrics.begin_purge( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", - api_version="2025-01-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_replication_fabrics_list(self, resource_group): + response = self.client.replication_fabrics.list( + resource_group_name=resource_group.name, + resource_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_replication_fabrics_begin_check_consistency(self, resource_group): response = await ( await self.client.replication_fabrics.begin_check_consistency( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", - api_version="2025-01-01", ) ).result() # call '.result()' to poll until service return final result @@ -85,8 +90,9 @@ async def test_replication_fabrics_begin_check_consistency(self, resource_group) async def test_replication_fabrics_begin_migrate_to_aad(self, resource_group): response = await ( await self.client.replication_fabrics.begin_migrate_to_aad( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", - api_version="2025-01-01", ) ).result() # call '.result()' to poll until service return final result @@ -98,6 +104,8 @@ async def test_replication_fabrics_begin_migrate_to_aad(self, resource_group): async def test_replication_fabrics_begin_reassociate_gateway(self, resource_group): response = await ( await self.client.replication_fabrics.begin_reassociate_gateway( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", failover_process_server_request={ "properties": { @@ -108,7 +116,6 @@ async def test_replication_fabrics_begin_reassociate_gateway(self, resource_grou "vmsToMigrate": ["str"], } }, - api_version="2025-01-01", ) ).result() # call '.result()' to poll until service return final result @@ -120,8 +127,9 @@ async def test_replication_fabrics_begin_reassociate_gateway(self, resource_grou async def test_replication_fabrics_begin_delete(self, resource_group): response = await ( await self.client.replication_fabrics.begin_delete( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", - api_version="2025-01-01", ) ).result() # call '.result()' to poll until service return final result @@ -133,9 +141,10 @@ async def test_replication_fabrics_begin_delete(self, resource_group): async def test_replication_fabrics_begin_renew_certificate(self, resource_group): response = await ( await self.client.replication_fabrics.begin_renew_certificate( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", renew_certificate={"properties": {"renewCertificateType": "str"}}, - api_version="2025-01-01", ) ).result() # call '.result()' to poll until service return final result @@ -147,9 +156,9 @@ async def test_replication_fabrics_begin_renew_certificate(self, resource_group) async def test_replication_fabrics_begin_remove_infra(self, resource_group): response = await ( await self.client.replication_fabrics.begin_remove_infra( + resource_group_name=resource_group.name, resource_name="str", fabric_name="str", - api_version="2025-01-01", ) ).result() # call '.result()' to poll until service return final result diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_jobs_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_jobs_operations.py index 5ff3dd9044d0..02d7286cdb64 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_jobs_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_jobs_operations.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 pytest @@ -20,22 +20,24 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_replication_jobs_list(self, resource_group): - response = self.client.replication_jobs.list( - api_version="2025-01-01", + def test_replication_jobs_get(self, resource_group): + response = self.client.replication_jobs.get( + resource_group_name=resource_group.name, + resource_name="str", + job_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_replication_jobs_get(self, resource_group): - response = self.client.replication_jobs.get( - job_name="str", - api_version="2025-01-01", + def test_replication_jobs_list(self, resource_group): + response = self.client.replication_jobs.list( + resource_group_name=resource_group.name, + resource_name="str", ) - + result = [r for r in response] # please add some check logic here by yourself # ... @@ -43,8 +45,9 @@ def test_replication_jobs_get(self, resource_group): @recorded_by_proxy def test_replication_jobs_begin_cancel(self, resource_group): response = self.client.replication_jobs.begin_cancel( + resource_group_name=resource_group.name, + resource_name="str", job_name="str", - api_version="2025-01-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -54,8 +57,9 @@ def test_replication_jobs_begin_cancel(self, resource_group): @recorded_by_proxy def test_replication_jobs_begin_restart(self, resource_group): response = self.client.replication_jobs.begin_restart( + resource_group_name=resource_group.name, + resource_name="str", job_name="str", - api_version="2025-01-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -65,9 +69,10 @@ def test_replication_jobs_begin_restart(self, resource_group): @recorded_by_proxy def test_replication_jobs_begin_resume(self, resource_group): response = self.client.replication_jobs.begin_resume( + resource_group_name=resource_group.name, + resource_name="str", job_name="str", resume_job_params={"properties": {"comments": "str"}}, - api_version="2025-01-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -77,6 +82,8 @@ def test_replication_jobs_begin_resume(self, resource_group): @recorded_by_proxy def test_replication_jobs_begin_export(self, resource_group): response = self.client.replication_jobs.begin_export( + resource_group_name=resource_group.name, + resource_name="str", job_query_parameter={ "affectedObjectTypes": "str", "endTime": "str", @@ -87,7 +94,6 @@ def test_replication_jobs_begin_export(self, resource_group): "startTime": "str", "timezoneOffset": 0.0, }, - api_version="2025-01-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_jobs_operations_async.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_jobs_operations_async.py index 17b3de2a65c4..d34d6928845d 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_jobs_operations_async.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_jobs_operations_async.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 pytest @@ -21,22 +21,24 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_replication_jobs_list(self, resource_group): - response = self.client.replication_jobs.list( - api_version="2025-01-01", + async def test_replication_jobs_get(self, resource_group): + response = await self.client.replication_jobs.get( + resource_group_name=resource_group.name, + resource_name="str", + job_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_replication_jobs_get(self, resource_group): - response = await self.client.replication_jobs.get( - job_name="str", - api_version="2025-01-01", + async def test_replication_jobs_list(self, resource_group): + response = self.client.replication_jobs.list( + resource_group_name=resource_group.name, + resource_name="str", ) - + result = [r async for r in response] # please add some check logic here by yourself # ... @@ -45,8 +47,9 @@ async def test_replication_jobs_get(self, resource_group): async def test_replication_jobs_begin_cancel(self, resource_group): response = await ( await self.client.replication_jobs.begin_cancel( + resource_group_name=resource_group.name, + resource_name="str", job_name="str", - api_version="2025-01-01", ) ).result() # call '.result()' to poll until service return final result @@ -58,8 +61,9 @@ async def test_replication_jobs_begin_cancel(self, resource_group): async def test_replication_jobs_begin_restart(self, resource_group): response = await ( await self.client.replication_jobs.begin_restart( + resource_group_name=resource_group.name, + resource_name="str", job_name="str", - api_version="2025-01-01", ) ).result() # call '.result()' to poll until service return final result @@ -71,9 +75,10 @@ async def test_replication_jobs_begin_restart(self, resource_group): async def test_replication_jobs_begin_resume(self, resource_group): response = await ( await self.client.replication_jobs.begin_resume( + resource_group_name=resource_group.name, + resource_name="str", job_name="str", resume_job_params={"properties": {"comments": "str"}}, - api_version="2025-01-01", ) ).result() # call '.result()' to poll until service return final result @@ -85,6 +90,8 @@ async def test_replication_jobs_begin_resume(self, resource_group): async def test_replication_jobs_begin_export(self, resource_group): response = await ( await self.client.replication_jobs.begin_export( + resource_group_name=resource_group.name, + resource_name="str", job_query_parameter={ "affectedObjectTypes": "str", "endTime": "str", @@ -95,7 +102,6 @@ async def test_replication_jobs_begin_export(self, resource_group): "startTime": "str", "timezoneOffset": 0.0, }, - api_version="2025-01-01", ) ).result() # call '.result()' to poll until service return final result diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_logical_networks_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_logical_networks_operations.py index 39c9ae68dc70..5c2a1cf41fea 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_logical_networks_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_logical_networks_operations.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 pytest @@ -20,23 +20,25 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_replication_logical_networks_list_by_replication_fabrics(self, resource_group): - response = self.client.replication_logical_networks.list_by_replication_fabrics( + def test_replication_logical_networks_get(self, resource_group): + response = self.client.replication_logical_networks.get( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", - api_version="2025-01-01", + logical_network_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_replication_logical_networks_get(self, resource_group): - response = self.client.replication_logical_networks.get( + def test_replication_logical_networks_list_by_replication_fabrics(self, resource_group): + response = self.client.replication_logical_networks.list_by_replication_fabrics( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", - logical_network_name="str", - api_version="2025-01-01", ) - + result = [r for r in response] # please add some check logic here by yourself # ... diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_logical_networks_operations_async.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_logical_networks_operations_async.py index a37e568228fa..776ec05c75b9 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_logical_networks_operations_async.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_logical_networks_operations_async.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 pytest @@ -21,23 +21,25 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_replication_logical_networks_list_by_replication_fabrics(self, resource_group): - response = self.client.replication_logical_networks.list_by_replication_fabrics( + async def test_replication_logical_networks_get(self, resource_group): + response = await self.client.replication_logical_networks.get( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", - api_version="2025-01-01", + logical_network_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_replication_logical_networks_get(self, resource_group): - response = await self.client.replication_logical_networks.get( + async def test_replication_logical_networks_list_by_replication_fabrics(self, resource_group): + response = self.client.replication_logical_networks.list_by_replication_fabrics( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", - logical_network_name="str", - api_version="2025-01-01", ) - + result = [r async for r in response] # please add some check logic here by yourself # ... diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_migration_items_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_migration_items_operations.py index cbf743310831..6c9b577cbca3 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_migration_items_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_migration_items_operations.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 pytest @@ -18,26 +18,15 @@ class TestSiteRecoveryManagementReplicationMigrationItemsOperations(AzureMgmtRec def setup_method(self, method): self.client = self.create_mgmt_client(SiteRecoveryManagementClient) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_replication_migration_items_list_by_replication_protection_containers(self, resource_group): - response = self.client.replication_migration_items.list_by_replication_protection_containers( - fabric_name="str", - protection_container_name="str", - api_version="2025-01-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_replication_migration_items_get(self, resource_group): response = self.client.replication_migration_items.get( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", migration_item_name="str", - api_version="2025-01-01", ) # please add some check logic here by yourself @@ -47,13 +36,14 @@ def test_replication_migration_items_get(self, resource_group): @recorded_by_proxy def test_replication_migration_items_begin_create(self, resource_group): response = self.client.replication_migration_items.begin_create( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", migration_item_name="str", input={ "properties": {"policyId": "str", "providerSpecificDetails": "enable_migration_provider_specific_input"} }, - api_version="2025-01-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -61,12 +51,14 @@ def test_replication_migration_items_begin_create(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_replication_migration_items_begin_delete(self, resource_group): - response = self.client.replication_migration_items.begin_delete( + def test_replication_migration_items_begin_update(self, resource_group): + response = self.client.replication_migration_items.begin_update( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", migration_item_name="str", - api_version="2025-01-01", + input={"properties": {"providerSpecificDetails": "update_migration_item_provider_specific_input"}}, ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -74,27 +66,41 @@ def test_replication_migration_items_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_replication_migration_items_begin_update(self, resource_group): - response = self.client.replication_migration_items.begin_update( + def test_replication_migration_items_begin_delete(self, resource_group): + response = self.client.replication_migration_items.begin_delete( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", migration_item_name="str", - input={"properties": {"providerSpecificDetails": "update_migration_item_provider_specific_input"}}, - api_version="2025-01-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_replication_migration_items_list_by_replication_protection_containers(self, resource_group): + response = self.client.replication_migration_items.list_by_replication_protection_containers( + resource_group_name=resource_group.name, + resource_name="str", + fabric_name="str", + protection_container_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_replication_migration_items_begin_migrate(self, resource_group): response = self.client.replication_migration_items.begin_migrate( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", migration_item_name="str", migrate_input={"properties": {"providerSpecificDetails": "migrate_provider_specific_input"}}, - api_version="2025-01-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -104,11 +110,12 @@ def test_replication_migration_items_begin_migrate(self, resource_group): @recorded_by_proxy def test_replication_migration_items_begin_pause_replication(self, resource_group): response = self.client.replication_migration_items.begin_pause_replication( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", migration_item_name="str", pause_replication_input={"properties": {"instanceType": "str"}}, - api_version="2025-01-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -118,13 +125,14 @@ def test_replication_migration_items_begin_pause_replication(self, resource_grou @recorded_by_proxy def test_replication_migration_items_begin_resume_replication(self, resource_group): response = self.client.replication_migration_items.begin_resume_replication( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", migration_item_name="str", resume_replication_input={ "properties": {"providerSpecificDetails": "resume_replication_provider_specific_input"} }, - api_version="2025-01-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -134,11 +142,12 @@ def test_replication_migration_items_begin_resume_replication(self, resource_gro @recorded_by_proxy def test_replication_migration_items_begin_resync(self, resource_group): response = self.client.replication_migration_items.begin_resync( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", migration_item_name="str", input={"properties": {"providerSpecificDetails": "resync_provider_specific_input"}}, - api_version="2025-01-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -148,11 +157,12 @@ def test_replication_migration_items_begin_resync(self, resource_group): @recorded_by_proxy def test_replication_migration_items_begin_test_migrate(self, resource_group): response = self.client.replication_migration_items.begin_test_migrate( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", migration_item_name="str", test_migrate_input={"properties": {"providerSpecificDetails": "test_migrate_provider_specific_input"}}, - api_version="2025-01-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -162,11 +172,12 @@ def test_replication_migration_items_begin_test_migrate(self, resource_group): @recorded_by_proxy def test_replication_migration_items_begin_test_migrate_cleanup(self, resource_group): response = self.client.replication_migration_items.begin_test_migrate_cleanup( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", migration_item_name="str", test_migrate_cleanup_input={"properties": {"comments": "str"}}, - api_version="2025-01-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -176,7 +187,8 @@ def test_replication_migration_items_begin_test_migrate_cleanup(self, resource_g @recorded_by_proxy def test_replication_migration_items_list(self, resource_group): response = self.client.replication_migration_items.list( - api_version="2025-01-01", + resource_group_name=resource_group.name, + resource_name="str", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_migration_items_operations_async.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_migration_items_operations_async.py index 36f8d92f54a2..8726c7effd5a 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_migration_items_operations_async.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_migration_items_operations_async.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 pytest @@ -19,26 +19,15 @@ class TestSiteRecoveryManagementReplicationMigrationItemsOperationsAsync(AzureMg def setup_method(self, method): self.client = self.create_mgmt_client(SiteRecoveryManagementClient, is_async=True) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_replication_migration_items_list_by_replication_protection_containers(self, resource_group): - response = self.client.replication_migration_items.list_by_replication_protection_containers( - fabric_name="str", - protection_container_name="str", - api_version="2025-01-01", - ) - 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_replication_migration_items_get(self, resource_group): response = await self.client.replication_migration_items.get( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", migration_item_name="str", - api_version="2025-01-01", ) # please add some check logic here by yourself @@ -49,6 +38,8 @@ async def test_replication_migration_items_get(self, resource_group): async def test_replication_migration_items_begin_create(self, resource_group): response = await ( await self.client.replication_migration_items.begin_create( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", migration_item_name="str", @@ -58,7 +49,6 @@ async def test_replication_migration_items_begin_create(self, resource_group): "providerSpecificDetails": "enable_migration_provider_specific_input", } }, - api_version="2025-01-01", ) ).result() # call '.result()' to poll until service return final result @@ -67,13 +57,15 @@ async def test_replication_migration_items_begin_create(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_replication_migration_items_begin_delete(self, resource_group): + async def test_replication_migration_items_begin_update(self, resource_group): response = await ( - await self.client.replication_migration_items.begin_delete( + await self.client.replication_migration_items.begin_update( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", migration_item_name="str", - api_version="2025-01-01", + input={"properties": {"providerSpecificDetails": "update_migration_item_provider_specific_input"}}, ) ).result() # call '.result()' to poll until service return final result @@ -82,30 +74,44 @@ async def test_replication_migration_items_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_replication_migration_items_begin_update(self, resource_group): + async def test_replication_migration_items_begin_delete(self, resource_group): response = await ( - await self.client.replication_migration_items.begin_update( + await self.client.replication_migration_items.begin_delete( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", migration_item_name="str", - input={"properties": {"providerSpecificDetails": "update_migration_item_provider_specific_input"}}, - api_version="2025-01-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_replication_migration_items_list_by_replication_protection_containers(self, resource_group): + response = self.client.replication_migration_items.list_by_replication_protection_containers( + resource_group_name=resource_group.name, + resource_name="str", + fabric_name="str", + protection_container_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_replication_migration_items_begin_migrate(self, resource_group): response = await ( await self.client.replication_migration_items.begin_migrate( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", migration_item_name="str", migrate_input={"properties": {"providerSpecificDetails": "migrate_provider_specific_input"}}, - api_version="2025-01-01", ) ).result() # call '.result()' to poll until service return final result @@ -117,11 +123,12 @@ async def test_replication_migration_items_begin_migrate(self, resource_group): async def test_replication_migration_items_begin_pause_replication(self, resource_group): response = await ( await self.client.replication_migration_items.begin_pause_replication( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", migration_item_name="str", pause_replication_input={"properties": {"instanceType": "str"}}, - api_version="2025-01-01", ) ).result() # call '.result()' to poll until service return final result @@ -133,13 +140,14 @@ async def test_replication_migration_items_begin_pause_replication(self, resourc async def test_replication_migration_items_begin_resume_replication(self, resource_group): response = await ( await self.client.replication_migration_items.begin_resume_replication( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", migration_item_name="str", resume_replication_input={ "properties": {"providerSpecificDetails": "resume_replication_provider_specific_input"} }, - api_version="2025-01-01", ) ).result() # call '.result()' to poll until service return final result @@ -151,11 +159,12 @@ async def test_replication_migration_items_begin_resume_replication(self, resour async def test_replication_migration_items_begin_resync(self, resource_group): response = await ( await self.client.replication_migration_items.begin_resync( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", migration_item_name="str", input={"properties": {"providerSpecificDetails": "resync_provider_specific_input"}}, - api_version="2025-01-01", ) ).result() # call '.result()' to poll until service return final result @@ -167,11 +176,12 @@ async def test_replication_migration_items_begin_resync(self, resource_group): async def test_replication_migration_items_begin_test_migrate(self, resource_group): response = await ( await self.client.replication_migration_items.begin_test_migrate( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", migration_item_name="str", test_migrate_input={"properties": {"providerSpecificDetails": "test_migrate_provider_specific_input"}}, - api_version="2025-01-01", ) ).result() # call '.result()' to poll until service return final result @@ -183,11 +193,12 @@ async def test_replication_migration_items_begin_test_migrate(self, resource_gro async def test_replication_migration_items_begin_test_migrate_cleanup(self, resource_group): response = await ( await self.client.replication_migration_items.begin_test_migrate_cleanup( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", migration_item_name="str", test_migrate_cleanup_input={"properties": {"comments": "str"}}, - api_version="2025-01-01", ) ).result() # call '.result()' to poll until service return final result @@ -198,7 +209,8 @@ async def test_replication_migration_items_begin_test_migrate_cleanup(self, reso @recorded_by_proxy_async async def test_replication_migration_items_list(self, resource_group): response = self.client.replication_migration_items.list( - api_version="2025-01-01", + resource_group_name=resource_group.name, + resource_name="str", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_network_mappings_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_network_mappings_operations.py index d427b18d1948..46993557d436 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_network_mappings_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_network_mappings_operations.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 pytest @@ -18,26 +18,15 @@ class TestSiteRecoveryManagementReplicationNetworkMappingsOperations(AzureMgmtRe def setup_method(self, method): self.client = self.create_mgmt_client(SiteRecoveryManagementClient) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_replication_network_mappings_list_by_replication_networks(self, resource_group): - response = self.client.replication_network_mappings.list_by_replication_networks( - fabric_name="str", - network_name="str", - api_version="2025-01-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_replication_network_mappings_get(self, resource_group): response = self.client.replication_network_mappings.get( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", network_name="str", network_mapping_name="str", - api_version="2025-01-01", ) # please add some check logic here by yourself @@ -47,6 +36,8 @@ def test_replication_network_mappings_get(self, resource_group): @recorded_by_proxy def test_replication_network_mappings_begin_create(self, resource_group): response = self.client.replication_network_mappings.begin_create( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", network_name="str", network_mapping_name="str", @@ -57,7 +48,6 @@ def test_replication_network_mappings_begin_create(self, resource_group): "recoveryFabricName": "str", } }, - api_version="2025-01-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -65,12 +55,20 @@ def test_replication_network_mappings_begin_create(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_replication_network_mappings_begin_delete(self, resource_group): - response = self.client.replication_network_mappings.begin_delete( + def test_replication_network_mappings_begin_update(self, resource_group): + response = self.client.replication_network_mappings.begin_update( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", network_name="str", network_mapping_name="str", - api_version="2025-01-01", + input={ + "properties": { + "fabricSpecificDetails": "fabric_specific_update_network_mapping_input", + "recoveryFabricName": "str", + "recoveryNetworkId": "str", + } + }, ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -78,29 +76,37 @@ def test_replication_network_mappings_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_replication_network_mappings_begin_update(self, resource_group): - response = self.client.replication_network_mappings.begin_update( + def test_replication_network_mappings_begin_delete(self, resource_group): + response = self.client.replication_network_mappings.begin_delete( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", network_name="str", network_mapping_name="str", - input={ - "properties": { - "fabricSpecificDetails": "fabric_specific_update_network_mapping_input", - "recoveryFabricName": "str", - "recoveryNetworkId": "str", - } - }, - api_version="2025-01-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_replication_network_mappings_list_by_replication_networks(self, resource_group): + response = self.client.replication_network_mappings.list_by_replication_networks( + resource_group_name=resource_group.name, + resource_name="str", + fabric_name="str", + network_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_replication_network_mappings_list(self, resource_group): response = self.client.replication_network_mappings.list( - api_version="2025-01-01", + resource_group_name=resource_group.name, + resource_name="str", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_network_mappings_operations_async.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_network_mappings_operations_async.py index 2c9002c04499..ccc57ec95966 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_network_mappings_operations_async.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_network_mappings_operations_async.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 pytest @@ -19,26 +19,15 @@ class TestSiteRecoveryManagementReplicationNetworkMappingsOperationsAsync(AzureM def setup_method(self, method): self.client = self.create_mgmt_client(SiteRecoveryManagementClient, is_async=True) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_replication_network_mappings_list_by_replication_networks(self, resource_group): - response = self.client.replication_network_mappings.list_by_replication_networks( - fabric_name="str", - network_name="str", - api_version="2025-01-01", - ) - 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_replication_network_mappings_get(self, resource_group): response = await self.client.replication_network_mappings.get( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", network_name="str", network_mapping_name="str", - api_version="2025-01-01", ) # please add some check logic here by yourself @@ -49,6 +38,8 @@ async def test_replication_network_mappings_get(self, resource_group): async def test_replication_network_mappings_begin_create(self, resource_group): response = await ( await self.client.replication_network_mappings.begin_create( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", network_name="str", network_mapping_name="str", @@ -59,7 +50,6 @@ async def test_replication_network_mappings_begin_create(self, resource_group): "recoveryFabricName": "str", } }, - api_version="2025-01-01", ) ).result() # call '.result()' to poll until service return final result @@ -68,13 +58,21 @@ async def test_replication_network_mappings_begin_create(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_replication_network_mappings_begin_delete(self, resource_group): + async def test_replication_network_mappings_begin_update(self, resource_group): response = await ( - await self.client.replication_network_mappings.begin_delete( + await self.client.replication_network_mappings.begin_update( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", network_name="str", network_mapping_name="str", - api_version="2025-01-01", + input={ + "properties": { + "fabricSpecificDetails": "fabric_specific_update_network_mapping_input", + "recoveryFabricName": "str", + "recoveryNetworkId": "str", + } + }, ) ).result() # call '.result()' to poll until service return final result @@ -83,31 +81,39 @@ async def test_replication_network_mappings_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_replication_network_mappings_begin_update(self, resource_group): + async def test_replication_network_mappings_begin_delete(self, resource_group): response = await ( - await self.client.replication_network_mappings.begin_update( + await self.client.replication_network_mappings.begin_delete( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", network_name="str", network_mapping_name="str", - input={ - "properties": { - "fabricSpecificDetails": "fabric_specific_update_network_mapping_input", - "recoveryFabricName": "str", - "recoveryNetworkId": "str", - } - }, - api_version="2025-01-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_replication_network_mappings_list_by_replication_networks(self, resource_group): + response = self.client.replication_network_mappings.list_by_replication_networks( + resource_group_name=resource_group.name, + resource_name="str", + fabric_name="str", + network_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_replication_network_mappings_list(self, resource_group): response = self.client.replication_network_mappings.list( - api_version="2025-01-01", + resource_group_name=resource_group.name, + resource_name="str", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_networks_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_networks_operations.py index 4d4d068081f6..ca899dcede5e 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_networks_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_networks_operations.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 pytest @@ -20,24 +20,26 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_replication_networks_list_by_replication_fabrics(self, resource_group): - response = self.client.replication_networks.list_by_replication_fabrics( + def test_replication_networks_get(self, resource_group): + response = self.client.replication_networks.get( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", - api_version="2025-01-01", + network_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_replication_networks_get(self, resource_group): - response = self.client.replication_networks.get( + def test_replication_networks_list_by_replication_fabrics(self, resource_group): + response = self.client.replication_networks.list_by_replication_fabrics( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", - network_name="str", - api_version="2025-01-01", ) - + result = [r for r in response] # please add some check logic here by yourself # ... @@ -45,7 +47,8 @@ def test_replication_networks_get(self, resource_group): @recorded_by_proxy def test_replication_networks_list(self, resource_group): response = self.client.replication_networks.list( - api_version="2025-01-01", + resource_group_name=resource_group.name, + resource_name="str", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_networks_operations_async.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_networks_operations_async.py index 62eec17b99d5..677ac25c4d99 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_networks_operations_async.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_networks_operations_async.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 pytest @@ -21,24 +21,26 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_replication_networks_list_by_replication_fabrics(self, resource_group): - response = self.client.replication_networks.list_by_replication_fabrics( + async def test_replication_networks_get(self, resource_group): + response = await self.client.replication_networks.get( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", - api_version="2025-01-01", + network_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_replication_networks_get(self, resource_group): - response = await self.client.replication_networks.get( + async def test_replication_networks_list_by_replication_fabrics(self, resource_group): + response = self.client.replication_networks.list_by_replication_fabrics( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", - network_name="str", - api_version="2025-01-01", ) - + result = [r async for r in response] # please add some check logic here by yourself # ... @@ -46,7 +48,8 @@ async def test_replication_networks_get(self, resource_group): @recorded_by_proxy_async async def test_replication_networks_list(self, resource_group): response = self.client.replication_networks.list( - api_version="2025-01-01", + resource_group_name=resource_group.name, + resource_name="str", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_policies_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_policies_operations.py index df0612b5c4a0..a0e31e9cac72 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_policies_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_policies_operations.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 pytest @@ -18,22 +18,13 @@ class TestSiteRecoveryManagementReplicationPoliciesOperations(AzureMgmtRecordedT def setup_method(self, method): self.client = self.create_mgmt_client(SiteRecoveryManagementClient) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_replication_policies_list(self, resource_group): - response = self.client.replication_policies.list( - api_version="2025-01-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_replication_policies_get(self, resource_group): response = self.client.replication_policies.get( + resource_group_name=resource_group.name, + resource_name="str", policy_name="str", - api_version="2025-01-01", ) # please add some check logic here by yourself @@ -43,9 +34,10 @@ def test_replication_policies_get(self, resource_group): @recorded_by_proxy def test_replication_policies_begin_create(self, resource_group): response = self.client.replication_policies.begin_create( + resource_group_name=resource_group.name, + resource_name="str", policy_name="str", input={"properties": {"providerSpecificInput": "policy_provider_specific_input"}}, - api_version="2025-01-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -53,10 +45,12 @@ def test_replication_policies_begin_create(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_replication_policies_begin_delete(self, resource_group): - response = self.client.replication_policies.begin_delete( + def test_replication_policies_begin_update(self, resource_group): + response = self.client.replication_policies.begin_update( + resource_group_name=resource_group.name, + resource_name="str", policy_name="str", - api_version="2025-01-01", + input={"properties": {"replicationProviderSettings": "policy_provider_specific_input"}}, ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -64,12 +58,23 @@ def test_replication_policies_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_replication_policies_begin_update(self, resource_group): - response = self.client.replication_policies.begin_update( + def test_replication_policies_begin_delete(self, resource_group): + response = self.client.replication_policies.begin_delete( + resource_group_name=resource_group.name, + resource_name="str", policy_name="str", - input={"properties": {"replicationProviderSettings": "policy_provider_specific_input"}}, - api_version="2025-01-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_replication_policies_list(self, resource_group): + response = self.client.replication_policies.list( + resource_group_name=resource_group.name, + resource_name="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_policies_operations_async.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_policies_operations_async.py index 9a0028a178e0..41c0d29a0cec 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_policies_operations_async.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_policies_operations_async.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 pytest @@ -19,22 +19,13 @@ class TestSiteRecoveryManagementReplicationPoliciesOperationsAsync(AzureMgmtReco def setup_method(self, method): self.client = self.create_mgmt_client(SiteRecoveryManagementClient, is_async=True) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_replication_policies_list(self, resource_group): - response = self.client.replication_policies.list( - api_version="2025-01-01", - ) - 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_replication_policies_get(self, resource_group): response = await self.client.replication_policies.get( + resource_group_name=resource_group.name, + resource_name="str", policy_name="str", - api_version="2025-01-01", ) # please add some check logic here by yourself @@ -45,9 +36,10 @@ async def test_replication_policies_get(self, resource_group): async def test_replication_policies_begin_create(self, resource_group): response = await ( await self.client.replication_policies.begin_create( + resource_group_name=resource_group.name, + resource_name="str", policy_name="str", input={"properties": {"providerSpecificInput": "policy_provider_specific_input"}}, - api_version="2025-01-01", ) ).result() # call '.result()' to poll until service return final result @@ -56,11 +48,13 @@ async def test_replication_policies_begin_create(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_replication_policies_begin_delete(self, resource_group): + async def test_replication_policies_begin_update(self, resource_group): response = await ( - await self.client.replication_policies.begin_delete( + await self.client.replication_policies.begin_update( + resource_group_name=resource_group.name, + resource_name="str", policy_name="str", - api_version="2025-01-01", + input={"properties": {"replicationProviderSettings": "policy_provider_specific_input"}}, ) ).result() # call '.result()' to poll until service return final result @@ -69,14 +63,25 @@ async def test_replication_policies_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_replication_policies_begin_update(self, resource_group): + async def test_replication_policies_begin_delete(self, resource_group): response = await ( - await self.client.replication_policies.begin_update( + await self.client.replication_policies.begin_delete( + resource_group_name=resource_group.name, + resource_name="str", policy_name="str", - input={"properties": {"replicationProviderSettings": "policy_provider_specific_input"}}, - api_version="2025-01-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_replication_policies_list(self, resource_group): + response = self.client.replication_policies.list( + resource_group_name=resource_group.name, + resource_name="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_protectable_items_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_protectable_items_operations.py index 53f69e44437d..f2a11d446d5a 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_protectable_items_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_protectable_items_operations.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 pytest @@ -20,25 +20,27 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_replication_protectable_items_list_by_replication_protection_containers(self, resource_group): - response = self.client.replication_protectable_items.list_by_replication_protection_containers( + def test_replication_protectable_items_get(self, resource_group): + response = self.client.replication_protectable_items.get( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", - api_version="2025-01-01", + protectable_item_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_replication_protectable_items_get(self, resource_group): - response = self.client.replication_protectable_items.get( + def test_replication_protectable_items_list_by_replication_protection_containers(self, resource_group): + response = self.client.replication_protectable_items.list_by_replication_protection_containers( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", - protectable_item_name="str", - api_version="2025-01-01", ) - + result = [r for r in response] # please add some check logic here by yourself # ... diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_protectable_items_operations_async.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_protectable_items_operations_async.py index 15427566634e..061b8a7c5e68 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_protectable_items_operations_async.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_protectable_items_operations_async.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 pytest @@ -21,25 +21,27 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_replication_protectable_items_list_by_replication_protection_containers(self, resource_group): - response = self.client.replication_protectable_items.list_by_replication_protection_containers( + async def test_replication_protectable_items_get(self, resource_group): + response = await self.client.replication_protectable_items.get( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", - api_version="2025-01-01", + protectable_item_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_replication_protectable_items_get(self, resource_group): - response = await self.client.replication_protectable_items.get( + async def test_replication_protectable_items_list_by_replication_protection_containers(self, resource_group): + response = self.client.replication_protectable_items.list_by_replication_protection_containers( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", - protectable_item_name="str", - api_version="2025-01-01", ) - + result = [r async for r in response] # please add some check logic here by yourself # ... diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_protected_items_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_protected_items_operations.py index 68e6f1643b27..7c4ab278a7cf 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_protected_items_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_protected_items_operations.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. # -------------------------------------------------------------------------- import pytest @@ -19,26 +19,15 @@ class TestSiteRecoveryManagementReplicationProtectedItemsOperations(AzureMgmtRec def setup_method(self, method): self.client = self.create_mgmt_client(SiteRecoveryManagementClient) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_replication_protected_items_list_by_replication_protection_containers(self, resource_group): - response = self.client.replication_protected_items.list_by_replication_protection_containers( - fabric_name="str", - protection_container_name="str", - api_version="2025-01-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_replication_protected_items_get(self, resource_group): response = self.client.replication_protected_items.get( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", replicated_protected_item_name="str", - api_version="2025-01-01", ) # please add some check logic here by yourself @@ -48,6 +37,8 @@ def test_replication_protected_items_get(self, resource_group): @recorded_by_proxy def test_replication_protected_items_begin_create(self, resource_group): response = self.client.replication_protected_items.begin_create( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", replicated_protected_item_name="str", @@ -58,20 +49,6 @@ def test_replication_protected_items_begin_create(self, resource_group): "providerSpecificDetails": "enable_protection_provider_specific_input", } }, - api_version="2025-01-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_replication_protected_items_begin_purge(self, resource_group): - response = self.client.replication_protected_items.begin_purge( - fabric_name="str", - protection_container_name="str", - replicated_protected_item_name="str", - api_version="2025-01-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -81,6 +58,8 @@ def test_replication_protected_items_begin_purge(self, resource_group): @recorded_by_proxy def test_replication_protected_items_begin_update(self, resource_group): response = self.client.replication_protected_items.begin_update( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", replicated_protected_item_name="str", @@ -129,21 +108,48 @@ def test_replication_protected_items_begin_update(self, resource_group): ], } }, - api_version="2025-01-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_replication_protected_items_begin_purge(self, resource_group): + response = self.client.replication_protected_items.begin_purge( + resource_group_name=resource_group.name, + resource_name="str", + fabric_name="str", + protection_container_name="str", + replicated_protected_item_name="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_replication_protected_items_list_by_replication_protection_containers(self, resource_group): + response = self.client.replication_protected_items.list_by_replication_protection_containers( + resource_group_name=resource_group.name, + resource_name="str", + fabric_name="str", + protection_container_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_replication_protected_items_begin_add_disks(self, resource_group): response = self.client.replication_protected_items.begin_add_disks( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", replicated_protected_item_name="str", add_disks_input={"properties": {"providerSpecificDetails": "add_disks_provider_specific_input"}}, - api_version="2025-01-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -153,6 +159,8 @@ def test_replication_protected_items_begin_add_disks(self, resource_group): @recorded_by_proxy def test_replication_protected_items_begin_apply_recovery_point(self, resource_group): response = self.client.replication_protected_items.begin_apply_recovery_point( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", replicated_protected_item_name="str", @@ -162,7 +170,6 @@ def test_replication_protected_items_begin_apply_recovery_point(self, resource_g "recoveryPointId": "str", } }, - api_version="2025-01-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -172,10 +179,11 @@ def test_replication_protected_items_begin_apply_recovery_point(self, resource_g @recorded_by_proxy def test_replication_protected_items_begin_failover_cancel(self, resource_group): response = self.client.replication_protected_items.begin_failover_cancel( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", replicated_protected_item_name="str", - api_version="2025-01-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -185,10 +193,11 @@ def test_replication_protected_items_begin_failover_cancel(self, resource_group) @recorded_by_proxy def test_replication_protected_items_begin_failover_commit(self, resource_group): response = self.client.replication_protected_items.begin_failover_commit( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", replicated_protected_item_name="str", - api_version="2025-01-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -198,6 +207,8 @@ def test_replication_protected_items_begin_failover_commit(self, resource_group) @recorded_by_proxy def test_replication_protected_items_begin_planned_failover(self, resource_group): response = self.client.replication_protected_items.begin_planned_failover( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", replicated_protected_item_name="str", @@ -207,7 +218,6 @@ def test_replication_protected_items_begin_planned_failover(self, resource_group "providerSpecificDetails": "planned_failover_provider_specific_failover_input", } }, - api_version="2025-01-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -217,6 +227,8 @@ def test_replication_protected_items_begin_planned_failover(self, resource_group @recorded_by_proxy def test_replication_protected_items_begin_delete(self, resource_group): response = self.client.replication_protected_items.begin_delete( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", replicated_protected_item_name="str", @@ -226,7 +238,6 @@ def test_replication_protected_items_begin_delete(self, resource_group): "replicationProviderInput": "disable_protection_provider_specific_input", } }, - api_version="2025-01-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -236,11 +247,12 @@ def test_replication_protected_items_begin_delete(self, resource_group): @recorded_by_proxy def test_replication_protected_items_begin_remove_disks(self, resource_group): response = self.client.replication_protected_items.begin_remove_disks( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", replicated_protected_item_name="str", remove_disks_input={"properties": {"providerSpecificDetails": "remove_disks_provider_specific_input"}}, - api_version="2025-01-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -250,10 +262,11 @@ def test_replication_protected_items_begin_remove_disks(self, resource_group): @recorded_by_proxy def test_replication_protected_items_begin_repair_replication(self, resource_group): response = self.client.replication_protected_items.begin_repair_replication( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", replicated_protected_item_name="str", - api_version="2025-01-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -263,6 +276,8 @@ def test_replication_protected_items_begin_repair_replication(self, resource_gro @recorded_by_proxy def test_replication_protected_items_begin_reprotect(self, resource_group): response = self.client.replication_protected_items.begin_reprotect( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", replicated_protected_item_name="str", @@ -272,7 +287,6 @@ def test_replication_protected_items_begin_reprotect(self, resource_group): "providerSpecificDetails": "reverse_replication_provider_specific_input", } }, - api_version="2025-01-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -282,11 +296,12 @@ def test_replication_protected_items_begin_reprotect(self, resource_group): @recorded_by_proxy def test_replication_protected_items_begin_resolve_health_errors(self, resource_group): response = self.client.replication_protected_items.begin_resolve_health_errors( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", replicated_protected_item_name="str", resolve_health_input={"properties": {"healthErrors": [{"healthErrorId": "str"}]}}, - api_version="2025-01-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -296,13 +311,14 @@ def test_replication_protected_items_begin_resolve_health_errors(self, resource_ @recorded_by_proxy def test_replication_protected_items_begin_switch_provider(self, resource_group): response = self.client.replication_protected_items.begin_switch_provider( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", replicated_protected_item_name="str", switch_provider_input={ "properties": {"providerSpecificDetails": "switch_provider_specific_input", "targetInstanceType": "str"} }, - api_version="2025-01-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -312,6 +328,8 @@ def test_replication_protected_items_begin_switch_provider(self, resource_group) @recorded_by_proxy def test_replication_protected_items_begin_test_failover(self, resource_group): response = self.client.replication_protected_items.begin_test_failover( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", replicated_protected_item_name="str", @@ -323,7 +341,6 @@ def test_replication_protected_items_begin_test_failover(self, resource_group): "providerSpecificDetails": "test_failover_provider_specific_input", } }, - api_version="2025-01-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -333,11 +350,12 @@ def test_replication_protected_items_begin_test_failover(self, resource_group): @recorded_by_proxy def test_replication_protected_items_begin_test_failover_cleanup(self, resource_group): response = self.client.replication_protected_items.begin_test_failover_cleanup( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", replicated_protected_item_name="str", cleanup_input={"properties": {"comments": "str"}}, - api_version="2025-01-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -347,6 +365,8 @@ def test_replication_protected_items_begin_test_failover_cleanup(self, resource_ @recorded_by_proxy def test_replication_protected_items_begin_unplanned_failover(self, resource_group): response = self.client.replication_protected_items.begin_unplanned_failover( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", replicated_protected_item_name="str", @@ -357,7 +377,6 @@ def test_replication_protected_items_begin_unplanned_failover(self, resource_gro "sourceSiteOperations": "str", } }, - api_version="2025-01-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -367,6 +386,8 @@ def test_replication_protected_items_begin_unplanned_failover(self, resource_gro @recorded_by_proxy def test_replication_protected_items_begin_update_appliance(self, resource_group): response = self.client.replication_protected_items.begin_update_appliance( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", replicated_protected_item_name="str", @@ -376,7 +397,6 @@ def test_replication_protected_items_begin_update_appliance(self, resource_group "targetApplianceId": "str", } }, - api_version="2025-01-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -386,11 +406,27 @@ def test_replication_protected_items_begin_update_appliance(self, resource_group @recorded_by_proxy def test_replication_protected_items_begin_update_mobility_service(self, resource_group): response = self.client.replication_protected_items.begin_update_mobility_service( + resource_group_name=resource_group.name, + resource_name="str", + fabric_name="str", + protection_container_name="str", + replicated_protected_item_name="str", + update_mobility_service_request={"properties": {"runAsAccountId": "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_replication_protected_items_begin_reinstall_mobility_service(self, resource_group): + response = self.client.replication_protected_items.begin_reinstall_mobility_service( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", replicated_protected_item_name="str", update_mobility_service_request={"properties": {"runAsAccountId": "str"}}, - api_version="2025-01-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -400,7 +436,8 @@ def test_replication_protected_items_begin_update_mobility_service(self, resourc @recorded_by_proxy def test_replication_protected_items_list(self, resource_group): response = self.client.replication_protected_items.list( - api_version="2025-01-01", + resource_group_name=resource_group.name, + resource_name="str", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_protected_items_operations_async.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_protected_items_operations_async.py index 861d8fb09487..57bc21aff758 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_protected_items_operations_async.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_protected_items_operations_async.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. # -------------------------------------------------------------------------- import pytest @@ -20,26 +20,15 @@ class TestSiteRecoveryManagementReplicationProtectedItemsOperationsAsync(AzureMg def setup_method(self, method): self.client = self.create_mgmt_client(SiteRecoveryManagementClient, is_async=True) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_replication_protected_items_list_by_replication_protection_containers(self, resource_group): - response = self.client.replication_protected_items.list_by_replication_protection_containers( - fabric_name="str", - protection_container_name="str", - api_version="2025-01-01", - ) - 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_replication_protected_items_get(self, resource_group): response = await self.client.replication_protected_items.get( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", replicated_protected_item_name="str", - api_version="2025-01-01", ) # please add some check logic here by yourself @@ -50,6 +39,8 @@ async def test_replication_protected_items_get(self, resource_group): async def test_replication_protected_items_begin_create(self, resource_group): response = await ( await self.client.replication_protected_items.begin_create( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", replicated_protected_item_name="str", @@ -60,22 +51,6 @@ async def test_replication_protected_items_begin_create(self, resource_group): "providerSpecificDetails": "enable_protection_provider_specific_input", } }, - api_version="2025-01-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_replication_protected_items_begin_purge(self, resource_group): - response = await ( - await self.client.replication_protected_items.begin_purge( - fabric_name="str", - protection_container_name="str", - replicated_protected_item_name="str", - api_version="2025-01-01", ) ).result() # call '.result()' to poll until service return final result @@ -87,6 +62,8 @@ async def test_replication_protected_items_begin_purge(self, resource_group): async def test_replication_protected_items_begin_update(self, resource_group): response = await ( await self.client.replication_protected_items.begin_update( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", replicated_protected_item_name="str", @@ -135,23 +112,52 @@ async def test_replication_protected_items_begin_update(self, resource_group): ], } }, - api_version="2025-01-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_replication_protected_items_begin_purge(self, resource_group): + response = await ( + await self.client.replication_protected_items.begin_purge( + resource_group_name=resource_group.name, + resource_name="str", + fabric_name="str", + protection_container_name="str", + replicated_protected_item_name="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_replication_protected_items_list_by_replication_protection_containers(self, resource_group): + response = self.client.replication_protected_items.list_by_replication_protection_containers( + resource_group_name=resource_group.name, + resource_name="str", + fabric_name="str", + protection_container_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_replication_protected_items_begin_add_disks(self, resource_group): response = await ( await self.client.replication_protected_items.begin_add_disks( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", replicated_protected_item_name="str", add_disks_input={"properties": {"providerSpecificDetails": "add_disks_provider_specific_input"}}, - api_version="2025-01-01", ) ).result() # call '.result()' to poll until service return final result @@ -163,6 +169,8 @@ async def test_replication_protected_items_begin_add_disks(self, resource_group) async def test_replication_protected_items_begin_apply_recovery_point(self, resource_group): response = await ( await self.client.replication_protected_items.begin_apply_recovery_point( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", replicated_protected_item_name="str", @@ -172,7 +180,6 @@ async def test_replication_protected_items_begin_apply_recovery_point(self, reso "recoveryPointId": "str", } }, - api_version="2025-01-01", ) ).result() # call '.result()' to poll until service return final result @@ -184,10 +191,11 @@ async def test_replication_protected_items_begin_apply_recovery_point(self, reso async def test_replication_protected_items_begin_failover_cancel(self, resource_group): response = await ( await self.client.replication_protected_items.begin_failover_cancel( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", replicated_protected_item_name="str", - api_version="2025-01-01", ) ).result() # call '.result()' to poll until service return final result @@ -199,10 +207,11 @@ async def test_replication_protected_items_begin_failover_cancel(self, resource_ async def test_replication_protected_items_begin_failover_commit(self, resource_group): response = await ( await self.client.replication_protected_items.begin_failover_commit( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", replicated_protected_item_name="str", - api_version="2025-01-01", ) ).result() # call '.result()' to poll until service return final result @@ -214,6 +223,8 @@ async def test_replication_protected_items_begin_failover_commit(self, resource_ async def test_replication_protected_items_begin_planned_failover(self, resource_group): response = await ( await self.client.replication_protected_items.begin_planned_failover( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", replicated_protected_item_name="str", @@ -223,7 +234,6 @@ async def test_replication_protected_items_begin_planned_failover(self, resource "providerSpecificDetails": "planned_failover_provider_specific_failover_input", } }, - api_version="2025-01-01", ) ).result() # call '.result()' to poll until service return final result @@ -235,6 +245,8 @@ async def test_replication_protected_items_begin_planned_failover(self, resource async def test_replication_protected_items_begin_delete(self, resource_group): response = await ( await self.client.replication_protected_items.begin_delete( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", replicated_protected_item_name="str", @@ -244,7 +256,6 @@ async def test_replication_protected_items_begin_delete(self, resource_group): "replicationProviderInput": "disable_protection_provider_specific_input", } }, - api_version="2025-01-01", ) ).result() # call '.result()' to poll until service return final result @@ -256,11 +267,12 @@ async def test_replication_protected_items_begin_delete(self, resource_group): async def test_replication_protected_items_begin_remove_disks(self, resource_group): response = await ( await self.client.replication_protected_items.begin_remove_disks( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", replicated_protected_item_name="str", remove_disks_input={"properties": {"providerSpecificDetails": "remove_disks_provider_specific_input"}}, - api_version="2025-01-01", ) ).result() # call '.result()' to poll until service return final result @@ -272,10 +284,11 @@ async def test_replication_protected_items_begin_remove_disks(self, resource_gro async def test_replication_protected_items_begin_repair_replication(self, resource_group): response = await ( await self.client.replication_protected_items.begin_repair_replication( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", replicated_protected_item_name="str", - api_version="2025-01-01", ) ).result() # call '.result()' to poll until service return final result @@ -287,6 +300,8 @@ async def test_replication_protected_items_begin_repair_replication(self, resour async def test_replication_protected_items_begin_reprotect(self, resource_group): response = await ( await self.client.replication_protected_items.begin_reprotect( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", replicated_protected_item_name="str", @@ -296,7 +311,6 @@ async def test_replication_protected_items_begin_reprotect(self, resource_group) "providerSpecificDetails": "reverse_replication_provider_specific_input", } }, - api_version="2025-01-01", ) ).result() # call '.result()' to poll until service return final result @@ -308,11 +322,12 @@ async def test_replication_protected_items_begin_reprotect(self, resource_group) async def test_replication_protected_items_begin_resolve_health_errors(self, resource_group): response = await ( await self.client.replication_protected_items.begin_resolve_health_errors( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", replicated_protected_item_name="str", resolve_health_input={"properties": {"healthErrors": [{"healthErrorId": "str"}]}}, - api_version="2025-01-01", ) ).result() # call '.result()' to poll until service return final result @@ -324,6 +339,8 @@ async def test_replication_protected_items_begin_resolve_health_errors(self, res async def test_replication_protected_items_begin_switch_provider(self, resource_group): response = await ( await self.client.replication_protected_items.begin_switch_provider( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", replicated_protected_item_name="str", @@ -333,7 +350,6 @@ async def test_replication_protected_items_begin_switch_provider(self, resource_ "targetInstanceType": "str", } }, - api_version="2025-01-01", ) ).result() # call '.result()' to poll until service return final result @@ -345,6 +361,8 @@ async def test_replication_protected_items_begin_switch_provider(self, resource_ async def test_replication_protected_items_begin_test_failover(self, resource_group): response = await ( await self.client.replication_protected_items.begin_test_failover( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", replicated_protected_item_name="str", @@ -356,7 +374,6 @@ async def test_replication_protected_items_begin_test_failover(self, resource_gr "providerSpecificDetails": "test_failover_provider_specific_input", } }, - api_version="2025-01-01", ) ).result() # call '.result()' to poll until service return final result @@ -368,11 +385,12 @@ async def test_replication_protected_items_begin_test_failover(self, resource_gr async def test_replication_protected_items_begin_test_failover_cleanup(self, resource_group): response = await ( await self.client.replication_protected_items.begin_test_failover_cleanup( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", replicated_protected_item_name="str", cleanup_input={"properties": {"comments": "str"}}, - api_version="2025-01-01", ) ).result() # call '.result()' to poll until service return final result @@ -384,6 +402,8 @@ async def test_replication_protected_items_begin_test_failover_cleanup(self, res async def test_replication_protected_items_begin_unplanned_failover(self, resource_group): response = await ( await self.client.replication_protected_items.begin_unplanned_failover( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", replicated_protected_item_name="str", @@ -394,7 +414,6 @@ async def test_replication_protected_items_begin_unplanned_failover(self, resour "sourceSiteOperations": "str", } }, - api_version="2025-01-01", ) ).result() # call '.result()' to poll until service return final result @@ -406,6 +425,8 @@ async def test_replication_protected_items_begin_unplanned_failover(self, resour async def test_replication_protected_items_begin_update_appliance(self, resource_group): response = await ( await self.client.replication_protected_items.begin_update_appliance( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", replicated_protected_item_name="str", @@ -415,7 +436,6 @@ async def test_replication_protected_items_begin_update_appliance(self, resource "targetApplianceId": "str", } }, - api_version="2025-01-01", ) ).result() # call '.result()' to poll until service return final result @@ -427,11 +447,29 @@ async def test_replication_protected_items_begin_update_appliance(self, resource async def test_replication_protected_items_begin_update_mobility_service(self, resource_group): response = await ( await self.client.replication_protected_items.begin_update_mobility_service( + resource_group_name=resource_group.name, + resource_name="str", + fabric_name="str", + protection_container_name="str", + replicated_protected_item_name="str", + update_mobility_service_request={"properties": {"runAsAccountId": "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_replication_protected_items_begin_reinstall_mobility_service(self, resource_group): + response = await ( + await self.client.replication_protected_items.begin_reinstall_mobility_service( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", replicated_protected_item_name="str", update_mobility_service_request={"properties": {"runAsAccountId": "str"}}, - api_version="2025-01-01", ) ).result() # call '.result()' to poll until service return final result @@ -442,7 +480,8 @@ async def test_replication_protected_items_begin_update_mobility_service(self, r @recorded_by_proxy_async async def test_replication_protected_items_list(self, resource_group): response = self.client.replication_protected_items.list( - api_version="2025-01-01", + resource_group_name=resource_group.name, + resource_name="str", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_protection_clusters_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_protection_clusters_operations.py index 8bb96829969e..5129bbbea620 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_protection_clusters_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_protection_clusters_operations.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 pytest @@ -18,28 +18,15 @@ class TestSiteRecoveryManagementReplicationProtectionClustersOperations(AzureMgm def setup_method(self, method): self.client = self.create_mgmt_client(SiteRecoveryManagementClient) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_replication_protection_clusters_list_by_replication_protection_containers(self, resource_group): - response = self.client.replication_protection_clusters.list_by_replication_protection_containers( - resource_name="str", - fabric_name="str", - protection_container_name="str", - api_version="2025-01-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_replication_protection_clusters_get(self, resource_group): response = self.client.replication_protection_clusters.get( + resource_group_name=resource_group.name, resource_name="str", fabric_name="str", protection_container_name="str", replication_protection_cluster_name="str", - api_version="2025-01-01", ) # please add some check logic here by yourself @@ -49,6 +36,8 @@ def test_replication_protection_clusters_get(self, resource_group): @recorded_by_proxy def test_replication_protection_clusters_begin_create(self, resource_group): response = self.client.replication_protection_clusters.begin_create( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", replication_protection_cluster_name="str", @@ -168,9 +157,16 @@ def test_replication_protection_clusters_begin_create(self, resource_group): "testFailoverState": "str", "testFailoverStateDescription": "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", }, - api_version="2025-01-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -180,10 +176,11 @@ def test_replication_protection_clusters_begin_create(self, resource_group): @recorded_by_proxy def test_replication_protection_clusters_begin_purge(self, resource_group): response = self.client.replication_protection_clusters.begin_purge( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", replication_protection_cluster_name="str", - api_version="2025-01-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -193,6 +190,7 @@ def test_replication_protection_clusters_begin_purge(self, resource_group): @recorded_by_proxy def test_replication_protection_clusters_begin_apply_recovery_point(self, resource_group): response = self.client.replication_protection_clusters.begin_apply_recovery_point( + resource_group_name=resource_group.name, resource_name="str", fabric_name="str", protection_container_name="str", @@ -204,7 +202,6 @@ def test_replication_protection_clusters_begin_apply_recovery_point(self, resour "individualNodeRecoveryPoints": ["str"], } }, - api_version="2025-01-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -214,40 +211,25 @@ def test_replication_protection_clusters_begin_apply_recovery_point(self, resour @recorded_by_proxy def test_replication_protection_clusters_begin_failover_commit(self, resource_group): response = self.client.replication_protection_clusters.begin_failover_commit( + resource_group_name=resource_group.name, resource_name="str", fabric_name="str", protection_container_name="str", replication_protection_cluster_name="str", - api_version="2025-01-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_replication_protection_clusters_get_operation_results(self, resource_group): - response = self.client.replication_protection_clusters.get_operation_results( - resource_name="str", - fabric_name="str", - protection_container_name="str", - replication_protection_cluster_name="str", - job_id="str", - api_version="2025-01-01", - ) - - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_replication_protection_clusters_begin_repair_replication(self, resource_group): response = self.client.replication_protection_clusters.begin_repair_replication( + resource_group_name=resource_group.name, resource_name="str", fabric_name="str", protection_container_name="str", replication_protection_cluster_name="str", - api_version="2025-01-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -257,6 +239,7 @@ def test_replication_protection_clusters_begin_repair_replication(self, resource @recorded_by_proxy def test_replication_protection_clusters_begin_test_failover(self, resource_group): response = self.client.replication_protection_clusters.begin_test_failover( + resource_group_name=resource_group.name, resource_name="str", fabric_name="str", protection_container_name="str", @@ -269,7 +252,6 @@ def test_replication_protection_clusters_begin_test_failover(self, resource_grou "providerSpecificDetails": "cluster_test_failover_provider_specific_input", } }, - api_version="2025-01-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -279,12 +261,12 @@ def test_replication_protection_clusters_begin_test_failover(self, resource_grou @recorded_by_proxy def test_replication_protection_clusters_begin_test_failover_cleanup(self, resource_group): response = self.client.replication_protection_clusters.begin_test_failover_cleanup( + resource_group_name=resource_group.name, resource_name="str", fabric_name="str", protection_container_name="str", replication_protection_cluster_name="str", cleanup_input={"properties": {"comments": "str"}}, - api_version="2025-01-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -294,6 +276,7 @@ def test_replication_protection_clusters_begin_test_failover_cleanup(self, resou @recorded_by_proxy def test_replication_protection_clusters_begin_unplanned_failover(self, resource_group): response = self.client.replication_protection_clusters.begin_unplanned_failover( + resource_group_name=resource_group.name, resource_name="str", fabric_name="str", protection_container_name="str", @@ -305,18 +288,45 @@ def test_replication_protection_clusters_begin_unplanned_failover(self, resource "sourceSiteOperations": "str", } }, - api_version="2025-01-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_replication_protection_clusters_get_operation_results(self, resource_group): + response = self.client.replication_protection_clusters.get_operation_results( + resource_group_name=resource_group.name, + resource_name="str", + fabric_name="str", + protection_container_name="str", + replication_protection_cluster_name="str", + job_id="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_replication_protection_clusters_list_by_replication_protection_containers(self, resource_group): + response = self.client.replication_protection_clusters.list_by_replication_protection_containers( + resource_group_name=resource_group.name, + resource_name="str", + fabric_name="str", + protection_container_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_replication_protection_clusters_list(self, resource_group): response = self.client.replication_protection_clusters.list( + resource_group_name=resource_group.name, resource_name="str", - api_version="2025-01-01", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_protection_clusters_operations_async.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_protection_clusters_operations_async.py index 59c098b3574c..5a6321364f6e 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_protection_clusters_operations_async.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_protection_clusters_operations_async.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 pytest @@ -19,28 +19,15 @@ class TestSiteRecoveryManagementReplicationProtectionClustersOperationsAsync(Azu def setup_method(self, method): self.client = self.create_mgmt_client(SiteRecoveryManagementClient, is_async=True) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_replication_protection_clusters_list_by_replication_protection_containers(self, resource_group): - response = self.client.replication_protection_clusters.list_by_replication_protection_containers( - resource_name="str", - fabric_name="str", - protection_container_name="str", - api_version="2025-01-01", - ) - 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_replication_protection_clusters_get(self, resource_group): response = await self.client.replication_protection_clusters.get( + resource_group_name=resource_group.name, resource_name="str", fabric_name="str", protection_container_name="str", replication_protection_cluster_name="str", - api_version="2025-01-01", ) # please add some check logic here by yourself @@ -51,6 +38,8 @@ async def test_replication_protection_clusters_get(self, resource_group): async def test_replication_protection_clusters_begin_create(self, resource_group): response = await ( await self.client.replication_protection_clusters.begin_create( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", replication_protection_cluster_name="str", @@ -179,9 +168,16 @@ async def test_replication_protection_clusters_begin_create(self, resource_group "testFailoverState": "str", "testFailoverStateDescription": "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", }, - api_version="2025-01-01", ) ).result() # call '.result()' to poll until service return final result @@ -193,10 +189,11 @@ async def test_replication_protection_clusters_begin_create(self, resource_group async def test_replication_protection_clusters_begin_purge(self, resource_group): response = await ( await self.client.replication_protection_clusters.begin_purge( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", replication_protection_cluster_name="str", - api_version="2025-01-01", ) ).result() # call '.result()' to poll until service return final result @@ -208,6 +205,7 @@ async def test_replication_protection_clusters_begin_purge(self, resource_group) async def test_replication_protection_clusters_begin_apply_recovery_point(self, resource_group): response = await ( await self.client.replication_protection_clusters.begin_apply_recovery_point( + resource_group_name=resource_group.name, resource_name="str", fabric_name="str", protection_container_name="str", @@ -219,7 +217,6 @@ async def test_replication_protection_clusters_begin_apply_recovery_point(self, "individualNodeRecoveryPoints": ["str"], } }, - api_version="2025-01-01", ) ).result() # call '.result()' to poll until service return final result @@ -231,42 +228,27 @@ async def test_replication_protection_clusters_begin_apply_recovery_point(self, async def test_replication_protection_clusters_begin_failover_commit(self, resource_group): response = await ( await self.client.replication_protection_clusters.begin_failover_commit( + resource_group_name=resource_group.name, resource_name="str", fabric_name="str", protection_container_name="str", replication_protection_cluster_name="str", - api_version="2025-01-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_replication_protection_clusters_get_operation_results(self, resource_group): - response = await self.client.replication_protection_clusters.get_operation_results( - resource_name="str", - fabric_name="str", - protection_container_name="str", - replication_protection_cluster_name="str", - job_id="str", - api_version="2025-01-01", - ) - - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_replication_protection_clusters_begin_repair_replication(self, resource_group): response = await ( await self.client.replication_protection_clusters.begin_repair_replication( + resource_group_name=resource_group.name, resource_name="str", fabric_name="str", protection_container_name="str", replication_protection_cluster_name="str", - api_version="2025-01-01", ) ).result() # call '.result()' to poll until service return final result @@ -278,6 +260,7 @@ async def test_replication_protection_clusters_begin_repair_replication(self, re async def test_replication_protection_clusters_begin_test_failover(self, resource_group): response = await ( await self.client.replication_protection_clusters.begin_test_failover( + resource_group_name=resource_group.name, resource_name="str", fabric_name="str", protection_container_name="str", @@ -290,7 +273,6 @@ async def test_replication_protection_clusters_begin_test_failover(self, resourc "providerSpecificDetails": "cluster_test_failover_provider_specific_input", } }, - api_version="2025-01-01", ) ).result() # call '.result()' to poll until service return final result @@ -302,12 +284,12 @@ async def test_replication_protection_clusters_begin_test_failover(self, resourc async def test_replication_protection_clusters_begin_test_failover_cleanup(self, resource_group): response = await ( await self.client.replication_protection_clusters.begin_test_failover_cleanup( + resource_group_name=resource_group.name, resource_name="str", fabric_name="str", protection_container_name="str", replication_protection_cluster_name="str", cleanup_input={"properties": {"comments": "str"}}, - api_version="2025-01-01", ) ).result() # call '.result()' to poll until service return final result @@ -319,6 +301,7 @@ async def test_replication_protection_clusters_begin_test_failover_cleanup(self, async def test_replication_protection_clusters_begin_unplanned_failover(self, resource_group): response = await ( await self.client.replication_protection_clusters.begin_unplanned_failover( + resource_group_name=resource_group.name, resource_name="str", fabric_name="str", protection_container_name="str", @@ -330,19 +313,46 @@ async def test_replication_protection_clusters_begin_unplanned_failover(self, re "sourceSiteOperations": "str", } }, - api_version="2025-01-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_replication_protection_clusters_get_operation_results(self, resource_group): + response = await self.client.replication_protection_clusters.get_operation_results( + resource_group_name=resource_group.name, + resource_name="str", + fabric_name="str", + protection_container_name="str", + replication_protection_cluster_name="str", + job_id="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_replication_protection_clusters_list_by_replication_protection_containers(self, resource_group): + response = self.client.replication_protection_clusters.list_by_replication_protection_containers( + resource_group_name=resource_group.name, + resource_name="str", + fabric_name="str", + protection_container_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_replication_protection_clusters_list(self, resource_group): response = self.client.replication_protection_clusters.list( + resource_group_name=resource_group.name, resource_name="str", - api_version="2025-01-01", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_protection_container_mappings_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_protection_container_mappings_operations.py index d8e0832f3b80..f01a03179caa 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_protection_container_mappings_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_protection_container_mappings_operations.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 pytest @@ -18,26 +18,15 @@ class TestSiteRecoveryManagementReplicationProtectionContainerMappingsOperations def setup_method(self, method): self.client = self.create_mgmt_client(SiteRecoveryManagementClient) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_replication_protection_container_mappings_list_by_replication_protection_containers(self, resource_group): - response = self.client.replication_protection_container_mappings.list_by_replication_protection_containers( - fabric_name="str", - protection_container_name="str", - api_version="2025-01-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_replication_protection_container_mappings_get(self, resource_group): response = self.client.replication_protection_container_mappings.get( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", mapping_name="str", - api_version="2025-01-01", ) # please add some check logic here by yourself @@ -47,6 +36,8 @@ def test_replication_protection_container_mappings_get(self, resource_group): @recorded_by_proxy def test_replication_protection_container_mappings_begin_create(self, resource_group): response = self.client.replication_protection_container_mappings.begin_create( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", mapping_name="str", @@ -57,7 +48,6 @@ def test_replication_protection_container_mappings_begin_create(self, resource_g "targetProtectionContainerId": "str", } }, - api_version="2025-01-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -65,12 +55,16 @@ def test_replication_protection_container_mappings_begin_create(self, resource_g @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_replication_protection_container_mappings_begin_purge(self, resource_group): - response = self.client.replication_protection_container_mappings.begin_purge( + def test_replication_protection_container_mappings_begin_update(self, resource_group): + response = self.client.replication_protection_container_mappings.begin_update( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", mapping_name="str", - api_version="2025-01-01", + update_input={ + "properties": {"providerSpecificInput": "replication_provider_specific_update_container_mapping_input"} + }, ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -78,29 +72,41 @@ def test_replication_protection_container_mappings_begin_purge(self, resource_gr @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_replication_protection_container_mappings_begin_update(self, resource_group): - response = self.client.replication_protection_container_mappings.begin_update( + def test_replication_protection_container_mappings_begin_purge(self, resource_group): + response = self.client.replication_protection_container_mappings.begin_purge( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", mapping_name="str", - update_input={ - "properties": {"providerSpecificInput": "replication_provider_specific_update_container_mapping_input"} - }, - api_version="2025-01-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_replication_protection_container_mappings_list_by_replication_protection_containers(self, resource_group): + response = self.client.replication_protection_container_mappings.list_by_replication_protection_containers( + resource_group_name=resource_group.name, + resource_name="str", + fabric_name="str", + protection_container_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_replication_protection_container_mappings_begin_delete(self, resource_group): response = self.client.replication_protection_container_mappings.begin_delete( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", mapping_name="str", removal_input={"properties": {"providerSpecificInput": {"instanceType": "str"}}}, - api_version="2025-01-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -110,7 +116,8 @@ def test_replication_protection_container_mappings_begin_delete(self, resource_g @recorded_by_proxy def test_replication_protection_container_mappings_list(self, resource_group): response = self.client.replication_protection_container_mappings.list( - api_version="2025-01-01", + resource_group_name=resource_group.name, + resource_name="str", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_protection_container_mappings_operations_async.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_protection_container_mappings_operations_async.py index a481bc7ae811..84cd3604c805 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_protection_container_mappings_operations_async.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_protection_container_mappings_operations_async.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 pytest @@ -19,28 +19,15 @@ class TestSiteRecoveryManagementReplicationProtectionContainerMappingsOperations def setup_method(self, method): self.client = self.create_mgmt_client(SiteRecoveryManagementClient, is_async=True) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_replication_protection_container_mappings_list_by_replication_protection_containers( - self, resource_group - ): - response = self.client.replication_protection_container_mappings.list_by_replication_protection_containers( - fabric_name="str", - protection_container_name="str", - api_version="2025-01-01", - ) - 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_replication_protection_container_mappings_get(self, resource_group): response = await self.client.replication_protection_container_mappings.get( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", mapping_name="str", - api_version="2025-01-01", ) # please add some check logic here by yourself @@ -51,6 +38,8 @@ async def test_replication_protection_container_mappings_get(self, resource_grou async def test_replication_protection_container_mappings_begin_create(self, resource_group): response = await ( await self.client.replication_protection_container_mappings.begin_create( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", mapping_name="str", @@ -61,7 +50,6 @@ async def test_replication_protection_container_mappings_begin_create(self, reso "targetProtectionContainerId": "str", } }, - api_version="2025-01-01", ) ).result() # call '.result()' to poll until service return final result @@ -70,13 +58,19 @@ async def test_replication_protection_container_mappings_begin_create(self, reso @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_replication_protection_container_mappings_begin_purge(self, resource_group): + async def test_replication_protection_container_mappings_begin_update(self, resource_group): response = await ( - await self.client.replication_protection_container_mappings.begin_purge( + await self.client.replication_protection_container_mappings.begin_update( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", mapping_name="str", - api_version="2025-01-01", + update_input={ + "properties": { + "providerSpecificInput": "replication_provider_specific_update_container_mapping_input" + } + }, ) ).result() # call '.result()' to poll until service return final result @@ -85,34 +79,46 @@ async def test_replication_protection_container_mappings_begin_purge(self, resou @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_replication_protection_container_mappings_begin_update(self, resource_group): + async def test_replication_protection_container_mappings_begin_purge(self, resource_group): response = await ( - await self.client.replication_protection_container_mappings.begin_update( + await self.client.replication_protection_container_mappings.begin_purge( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", mapping_name="str", - update_input={ - "properties": { - "providerSpecificInput": "replication_provider_specific_update_container_mapping_input" - } - }, - api_version="2025-01-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_replication_protection_container_mappings_list_by_replication_protection_containers( + self, resource_group + ): + response = self.client.replication_protection_container_mappings.list_by_replication_protection_containers( + resource_group_name=resource_group.name, + resource_name="str", + fabric_name="str", + protection_container_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_replication_protection_container_mappings_begin_delete(self, resource_group): response = await ( await self.client.replication_protection_container_mappings.begin_delete( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", mapping_name="str", removal_input={"properties": {"providerSpecificInput": {"instanceType": "str"}}}, - api_version="2025-01-01", ) ).result() # call '.result()' to poll until service return final result @@ -123,7 +129,8 @@ async def test_replication_protection_container_mappings_begin_delete(self, reso @recorded_by_proxy_async async def test_replication_protection_container_mappings_list(self, resource_group): response = self.client.replication_protection_container_mappings.list( - api_version="2025-01-01", + resource_group_name=resource_group.name, + resource_name="str", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_protection_containers_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_protection_containers_operations.py index 10d12e614760..7a4d21414227 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_protection_containers_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_protection_containers_operations.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 pytest @@ -18,24 +18,14 @@ class TestSiteRecoveryManagementReplicationProtectionContainersOperations(AzureM def setup_method(self, method): self.client = self.create_mgmt_client(SiteRecoveryManagementClient) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_replication_protection_containers_list_by_replication_fabrics(self, resource_group): - response = self.client.replication_protection_containers.list_by_replication_fabrics( - fabric_name="str", - api_version="2025-01-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_replication_protection_containers_get(self, resource_group): response = self.client.replication_protection_containers.get( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", - api_version="2025-01-01", ) # please add some check logic here by yourself @@ -45,27 +35,41 @@ def test_replication_protection_containers_get(self, resource_group): @recorded_by_proxy def test_replication_protection_containers_begin_create(self, resource_group): response = self.client.replication_protection_containers.begin_create( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", creation_input={ "properties": {"providerSpecificInput": ["replication_provider_specific_container_creation_input"]} }, - api_version="2025-01-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_replication_protection_containers_list_by_replication_fabrics(self, resource_group): + response = self.client.replication_protection_containers.list_by_replication_fabrics( + resource_group_name=resource_group.name, + resource_name="str", + fabric_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_replication_protection_containers_begin_discover_protectable_item(self, resource_group): response = self.client.replication_protection_containers.begin_discover_protectable_item( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", discover_protectable_item_request={ "properties": {"friendlyName": "str", "ipAddress": "str", "osType": "str"} }, - api_version="2025-01-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -75,9 +79,10 @@ def test_replication_protection_containers_begin_discover_protectable_item(self, @recorded_by_proxy def test_replication_protection_containers_begin_delete(self, resource_group): response = self.client.replication_protection_containers.begin_delete( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", - api_version="2025-01-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -87,6 +92,7 @@ def test_replication_protection_containers_begin_delete(self, resource_group): @recorded_by_proxy def test_replication_protection_containers_begin_switch_cluster_protection(self, resource_group): response = self.client.replication_protection_containers.begin_switch_cluster_protection( + resource_group_name=resource_group.name, resource_name="str", fabric_name="str", protection_container_name="str", @@ -96,7 +102,6 @@ def test_replication_protection_containers_begin_switch_cluster_protection(self, "replicationProtectionClusterName": "str", } }, - api_version="2025-01-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -106,6 +111,8 @@ def test_replication_protection_containers_begin_switch_cluster_protection(self, @recorded_by_proxy def test_replication_protection_containers_begin_switch_protection(self, resource_group): response = self.client.replication_protection_containers.begin_switch_protection( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", switch_input={ @@ -114,7 +121,6 @@ def test_replication_protection_containers_begin_switch_protection(self, resourc "replicationProtectedItemName": "str", } }, - api_version="2025-01-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -124,7 +130,8 @@ def test_replication_protection_containers_begin_switch_protection(self, resourc @recorded_by_proxy def test_replication_protection_containers_list(self, resource_group): response = self.client.replication_protection_containers.list( - api_version="2025-01-01", + resource_group_name=resource_group.name, + resource_name="str", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_protection_containers_operations_async.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_protection_containers_operations_async.py index d76e07e67c47..fb10eabe9efb 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_protection_containers_operations_async.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_protection_containers_operations_async.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 pytest @@ -19,24 +19,14 @@ class TestSiteRecoveryManagementReplicationProtectionContainersOperationsAsync(A def setup_method(self, method): self.client = self.create_mgmt_client(SiteRecoveryManagementClient, is_async=True) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_replication_protection_containers_list_by_replication_fabrics(self, resource_group): - response = self.client.replication_protection_containers.list_by_replication_fabrics( - fabric_name="str", - api_version="2025-01-01", - ) - 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_replication_protection_containers_get(self, resource_group): response = await self.client.replication_protection_containers.get( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", - api_version="2025-01-01", ) # please add some check logic here by yourself @@ -47,29 +37,43 @@ async def test_replication_protection_containers_get(self, resource_group): async def test_replication_protection_containers_begin_create(self, resource_group): response = await ( await self.client.replication_protection_containers.begin_create( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", creation_input={ "properties": {"providerSpecificInput": ["replication_provider_specific_container_creation_input"]} }, - api_version="2025-01-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_replication_protection_containers_list_by_replication_fabrics(self, resource_group): + response = self.client.replication_protection_containers.list_by_replication_fabrics( + resource_group_name=resource_group.name, + resource_name="str", + fabric_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_replication_protection_containers_begin_discover_protectable_item(self, resource_group): response = await ( await self.client.replication_protection_containers.begin_discover_protectable_item( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", discover_protectable_item_request={ "properties": {"friendlyName": "str", "ipAddress": "str", "osType": "str"} }, - api_version="2025-01-01", ) ).result() # call '.result()' to poll until service return final result @@ -81,9 +85,10 @@ async def test_replication_protection_containers_begin_discover_protectable_item async def test_replication_protection_containers_begin_delete(self, resource_group): response = await ( await self.client.replication_protection_containers.begin_delete( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", - api_version="2025-01-01", ) ).result() # call '.result()' to poll until service return final result @@ -95,6 +100,7 @@ async def test_replication_protection_containers_begin_delete(self, resource_gro async def test_replication_protection_containers_begin_switch_cluster_protection(self, resource_group): response = await ( await self.client.replication_protection_containers.begin_switch_cluster_protection( + resource_group_name=resource_group.name, resource_name="str", fabric_name="str", protection_container_name="str", @@ -104,7 +110,6 @@ async def test_replication_protection_containers_begin_switch_cluster_protection "replicationProtectionClusterName": "str", } }, - api_version="2025-01-01", ) ).result() # call '.result()' to poll until service return final result @@ -116,6 +121,8 @@ async def test_replication_protection_containers_begin_switch_cluster_protection async def test_replication_protection_containers_begin_switch_protection(self, resource_group): response = await ( await self.client.replication_protection_containers.begin_switch_protection( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", switch_input={ @@ -124,7 +131,6 @@ async def test_replication_protection_containers_begin_switch_protection(self, r "replicationProtectedItemName": "str", } }, - api_version="2025-01-01", ) ).result() # call '.result()' to poll until service return final result @@ -135,7 +141,8 @@ async def test_replication_protection_containers_begin_switch_protection(self, r @recorded_by_proxy_async async def test_replication_protection_containers_list(self, resource_group): response = self.client.replication_protection_containers.list( - api_version="2025-01-01", + resource_group_name=resource_group.name, + resource_name="str", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_protection_intents_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_protection_intents_operations.py index 6f56d8e2418c..c8440043b9b1 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_protection_intents_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_protection_intents_operations.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 pytest @@ -18,22 +18,13 @@ class TestSiteRecoveryManagementReplicationProtectionIntentsOperations(AzureMgmt def setup_method(self, method): self.client = self.create_mgmt_client(SiteRecoveryManagementClient) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_replication_protection_intents_list(self, resource_group): - response = self.client.replication_protection_intents.list( - api_version="2025-01-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_replication_protection_intents_get(self, resource_group): response = self.client.replication_protection_intents.get( + resource_group_name=resource_group.name, + resource_name="str", intent_object_name="str", - api_version="2025-01-01", ) # please add some check logic here by yourself @@ -43,10 +34,22 @@ def test_replication_protection_intents_get(self, resource_group): @recorded_by_proxy def test_replication_protection_intents_create(self, resource_group): response = self.client.replication_protection_intents.create( + resource_group_name=resource_group.name, + resource_name="str", intent_object_name="str", input={"properties": {"providerSpecificDetails": "create_protection_intent_provider_specific_details"}}, - api_version="2025-01-01", ) # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_replication_protection_intents_list(self, resource_group): + response = self.client.replication_protection_intents.list( + resource_group_name=resource_group.name, + resource_name="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_protection_intents_operations_async.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_protection_intents_operations_async.py index 0344d1db0ea5..65db1cb8fef9 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_protection_intents_operations_async.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_protection_intents_operations_async.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 pytest @@ -19,22 +19,13 @@ class TestSiteRecoveryManagementReplicationProtectionIntentsOperationsAsync(Azur def setup_method(self, method): self.client = self.create_mgmt_client(SiteRecoveryManagementClient, is_async=True) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_replication_protection_intents_list(self, resource_group): - response = self.client.replication_protection_intents.list( - api_version="2025-01-01", - ) - 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_replication_protection_intents_get(self, resource_group): response = await self.client.replication_protection_intents.get( + resource_group_name=resource_group.name, + resource_name="str", intent_object_name="str", - api_version="2025-01-01", ) # please add some check logic here by yourself @@ -44,10 +35,22 @@ async def test_replication_protection_intents_get(self, resource_group): @recorded_by_proxy_async async def test_replication_protection_intents_create(self, resource_group): response = await self.client.replication_protection_intents.create( + resource_group_name=resource_group.name, + resource_name="str", intent_object_name="str", input={"properties": {"providerSpecificDetails": "create_protection_intent_provider_specific_details"}}, - api_version="2025-01-01", ) # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_replication_protection_intents_list(self, resource_group): + response = self.client.replication_protection_intents.list( + resource_group_name=resource_group.name, + resource_name="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_recovery_plans_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_recovery_plans_operations.py index 52c05573cf37..a4ea827f8c91 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_recovery_plans_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_recovery_plans_operations.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 pytest @@ -18,22 +18,13 @@ class TestSiteRecoveryManagementReplicationRecoveryPlansOperations(AzureMgmtReco def setup_method(self, method): self.client = self.create_mgmt_client(SiteRecoveryManagementClient) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_replication_recovery_plans_list(self, resource_group): - response = self.client.replication_recovery_plans.list( - api_version="2025-01-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_replication_recovery_plans_get(self, resource_group): response = self.client.replication_recovery_plans.get( + resource_group_name=resource_group.name, + resource_name="str", recovery_plan_name="str", - api_version="2025-01-01", ) # please add some check logic here by yourself @@ -43,6 +34,8 @@ def test_replication_recovery_plans_get(self, resource_group): @recorded_by_proxy def test_replication_recovery_plans_begin_create(self, resource_group): response = self.client.replication_recovery_plans.begin_create( + resource_group_name=resource_group.name, + resource_name="str", recovery_plan_name="str", input={ "properties": { @@ -74,18 +67,6 @@ def test_replication_recovery_plans_begin_create(self, resource_group): "providerSpecificInput": ["recovery_plan_provider_specific_input"], } }, - api_version="2025-01-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_replication_recovery_plans_begin_delete(self, resource_group): - response = self.client.replication_recovery_plans.begin_delete( - recovery_plan_name="str", - api_version="2025-01-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -95,6 +76,8 @@ def test_replication_recovery_plans_begin_delete(self, resource_group): @recorded_by_proxy def test_replication_recovery_plans_begin_update(self, resource_group): response = self.client.replication_recovery_plans.begin_update( + resource_group_name=resource_group.name, + resource_name="str", recovery_plan_name="str", input={ "properties": { @@ -122,18 +105,41 @@ def test_replication_recovery_plans_begin_update(self, resource_group): ] } }, - api_version="2025-01-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_replication_recovery_plans_begin_delete(self, resource_group): + response = self.client.replication_recovery_plans.begin_delete( + resource_group_name=resource_group.name, + resource_name="str", + recovery_plan_name="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_replication_recovery_plans_list(self, resource_group): + response = self.client.replication_recovery_plans.list( + resource_group_name=resource_group.name, + resource_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_replication_recovery_plans_begin_failover_cancel(self, resource_group): response = self.client.replication_recovery_plans.begin_failover_cancel( + resource_group_name=resource_group.name, + resource_name="str", recovery_plan_name="str", - api_version="2025-01-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -143,8 +149,9 @@ def test_replication_recovery_plans_begin_failover_cancel(self, resource_group): @recorded_by_proxy def test_replication_recovery_plans_begin_failover_commit(self, resource_group): response = self.client.replication_recovery_plans.begin_failover_commit( + resource_group_name=resource_group.name, + resource_name="str", recovery_plan_name="str", - api_version="2025-01-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -154,6 +161,8 @@ def test_replication_recovery_plans_begin_failover_commit(self, resource_group): @recorded_by_proxy def test_replication_recovery_plans_begin_planned_failover(self, resource_group): response = self.client.replication_recovery_plans.begin_planned_failover( + resource_group_name=resource_group.name, + resource_name="str", recovery_plan_name="str", input={ "properties": { @@ -161,7 +170,6 @@ def test_replication_recovery_plans_begin_planned_failover(self, resource_group) "providerSpecificDetails": ["recovery_plan_provider_specific_failover_input"], } }, - api_version="2025-01-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -171,8 +179,9 @@ def test_replication_recovery_plans_begin_planned_failover(self, resource_group) @recorded_by_proxy def test_replication_recovery_plans_begin_reprotect(self, resource_group): response = self.client.replication_recovery_plans.begin_reprotect( + resource_group_name=resource_group.name, + resource_name="str", recovery_plan_name="str", - api_version="2025-01-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -182,6 +191,8 @@ def test_replication_recovery_plans_begin_reprotect(self, resource_group): @recorded_by_proxy def test_replication_recovery_plans_begin_test_failover(self, resource_group): response = self.client.replication_recovery_plans.begin_test_failover( + resource_group_name=resource_group.name, + resource_name="str", recovery_plan_name="str", input={ "properties": { @@ -191,7 +202,6 @@ def test_replication_recovery_plans_begin_test_failover(self, resource_group): "providerSpecificDetails": ["recovery_plan_provider_specific_failover_input"], } }, - api_version="2025-01-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -201,9 +211,10 @@ def test_replication_recovery_plans_begin_test_failover(self, resource_group): @recorded_by_proxy def test_replication_recovery_plans_begin_test_failover_cleanup(self, resource_group): response = self.client.replication_recovery_plans.begin_test_failover_cleanup( + resource_group_name=resource_group.name, + resource_name="str", recovery_plan_name="str", input={"properties": {"comments": "str"}}, - api_version="2025-01-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -213,6 +224,8 @@ def test_replication_recovery_plans_begin_test_failover_cleanup(self, resource_g @recorded_by_proxy def test_replication_recovery_plans_begin_unplanned_failover(self, resource_group): response = self.client.replication_recovery_plans.begin_unplanned_failover( + resource_group_name=resource_group.name, + resource_name="str", recovery_plan_name="str", input={ "properties": { @@ -221,7 +234,6 @@ def test_replication_recovery_plans_begin_unplanned_failover(self, resource_grou "providerSpecificDetails": ["recovery_plan_provider_specific_failover_input"], } }, - api_version="2025-01-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_recovery_plans_operations_async.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_recovery_plans_operations_async.py index 067123c605bb..01c4cc38b0be 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_recovery_plans_operations_async.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_recovery_plans_operations_async.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 pytest @@ -19,22 +19,13 @@ class TestSiteRecoveryManagementReplicationRecoveryPlansOperationsAsync(AzureMgm def setup_method(self, method): self.client = self.create_mgmt_client(SiteRecoveryManagementClient, is_async=True) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_replication_recovery_plans_list(self, resource_group): - response = self.client.replication_recovery_plans.list( - api_version="2025-01-01", - ) - 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_replication_recovery_plans_get(self, resource_group): response = await self.client.replication_recovery_plans.get( + resource_group_name=resource_group.name, + resource_name="str", recovery_plan_name="str", - api_version="2025-01-01", ) # please add some check logic here by yourself @@ -45,6 +36,8 @@ async def test_replication_recovery_plans_get(self, resource_group): async def test_replication_recovery_plans_begin_create(self, resource_group): response = await ( await self.client.replication_recovery_plans.begin_create( + resource_group_name=resource_group.name, + resource_name="str", recovery_plan_name="str", input={ "properties": { @@ -76,20 +69,6 @@ async def test_replication_recovery_plans_begin_create(self, resource_group): "providerSpecificInput": ["recovery_plan_provider_specific_input"], } }, - api_version="2025-01-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_replication_recovery_plans_begin_delete(self, resource_group): - response = await ( - await self.client.replication_recovery_plans.begin_delete( - recovery_plan_name="str", - api_version="2025-01-01", ) ).result() # call '.result()' to poll until service return final result @@ -101,6 +80,8 @@ async def test_replication_recovery_plans_begin_delete(self, resource_group): async def test_replication_recovery_plans_begin_update(self, resource_group): response = await ( await self.client.replication_recovery_plans.begin_update( + resource_group_name=resource_group.name, + resource_name="str", recovery_plan_name="str", input={ "properties": { @@ -128,20 +109,45 @@ async def test_replication_recovery_plans_begin_update(self, resource_group): ] } }, - api_version="2025-01-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_replication_recovery_plans_begin_delete(self, resource_group): + response = await ( + await self.client.replication_recovery_plans.begin_delete( + resource_group_name=resource_group.name, + resource_name="str", + recovery_plan_name="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_replication_recovery_plans_list(self, resource_group): + response = self.client.replication_recovery_plans.list( + resource_group_name=resource_group.name, + resource_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_replication_recovery_plans_begin_failover_cancel(self, resource_group): response = await ( await self.client.replication_recovery_plans.begin_failover_cancel( + resource_group_name=resource_group.name, + resource_name="str", recovery_plan_name="str", - api_version="2025-01-01", ) ).result() # call '.result()' to poll until service return final result @@ -153,8 +159,9 @@ async def test_replication_recovery_plans_begin_failover_cancel(self, resource_g async def test_replication_recovery_plans_begin_failover_commit(self, resource_group): response = await ( await self.client.replication_recovery_plans.begin_failover_commit( + resource_group_name=resource_group.name, + resource_name="str", recovery_plan_name="str", - api_version="2025-01-01", ) ).result() # call '.result()' to poll until service return final result @@ -166,6 +173,8 @@ async def test_replication_recovery_plans_begin_failover_commit(self, resource_g async def test_replication_recovery_plans_begin_planned_failover(self, resource_group): response = await ( await self.client.replication_recovery_plans.begin_planned_failover( + resource_group_name=resource_group.name, + resource_name="str", recovery_plan_name="str", input={ "properties": { @@ -173,7 +182,6 @@ async def test_replication_recovery_plans_begin_planned_failover(self, resource_ "providerSpecificDetails": ["recovery_plan_provider_specific_failover_input"], } }, - api_version="2025-01-01", ) ).result() # call '.result()' to poll until service return final result @@ -185,8 +193,9 @@ async def test_replication_recovery_plans_begin_planned_failover(self, resource_ async def test_replication_recovery_plans_begin_reprotect(self, resource_group): response = await ( await self.client.replication_recovery_plans.begin_reprotect( + resource_group_name=resource_group.name, + resource_name="str", recovery_plan_name="str", - api_version="2025-01-01", ) ).result() # call '.result()' to poll until service return final result @@ -198,6 +207,8 @@ async def test_replication_recovery_plans_begin_reprotect(self, resource_group): async def test_replication_recovery_plans_begin_test_failover(self, resource_group): response = await ( await self.client.replication_recovery_plans.begin_test_failover( + resource_group_name=resource_group.name, + resource_name="str", recovery_plan_name="str", input={ "properties": { @@ -207,7 +218,6 @@ async def test_replication_recovery_plans_begin_test_failover(self, resource_gro "providerSpecificDetails": ["recovery_plan_provider_specific_failover_input"], } }, - api_version="2025-01-01", ) ).result() # call '.result()' to poll until service return final result @@ -219,9 +229,10 @@ async def test_replication_recovery_plans_begin_test_failover(self, resource_gro async def test_replication_recovery_plans_begin_test_failover_cleanup(self, resource_group): response = await ( await self.client.replication_recovery_plans.begin_test_failover_cleanup( + resource_group_name=resource_group.name, + resource_name="str", recovery_plan_name="str", input={"properties": {"comments": "str"}}, - api_version="2025-01-01", ) ).result() # call '.result()' to poll until service return final result @@ -233,6 +244,8 @@ async def test_replication_recovery_plans_begin_test_failover_cleanup(self, reso async def test_replication_recovery_plans_begin_unplanned_failover(self, resource_group): response = await ( await self.client.replication_recovery_plans.begin_unplanned_failover( + resource_group_name=resource_group.name, + resource_name="str", recovery_plan_name="str", input={ "properties": { @@ -241,7 +254,6 @@ async def test_replication_recovery_plans_begin_unplanned_failover(self, resourc "providerSpecificDetails": ["recovery_plan_provider_specific_failover_input"], } }, - api_version="2025-01-01", ) ).result() # call '.result()' to poll until service return final result diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_recovery_services_providers_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_recovery_services_providers_operations.py index a4fa6835888b..f82102355595 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_recovery_services_providers_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_recovery_services_providers_operations.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 pytest @@ -18,24 +18,14 @@ class TestSiteRecoveryManagementReplicationRecoveryServicesProvidersOperations(A def setup_method(self, method): self.client = self.create_mgmt_client(SiteRecoveryManagementClient) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_replication_recovery_services_providers_list_by_replication_fabrics(self, resource_group): - response = self.client.replication_recovery_services_providers.list_by_replication_fabrics( - fabric_name="str", - api_version="2025-01-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_replication_recovery_services_providers_get(self, resource_group): response = self.client.replication_recovery_services_providers.get( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", provider_name="str", - api_version="2025-01-01", ) # please add some check logic here by yourself @@ -45,6 +35,8 @@ def test_replication_recovery_services_providers_get(self, resource_group): @recorded_by_proxy def test_replication_recovery_services_providers_begin_create(self, resource_group): response = self.client.replication_recovery_services_providers.begin_create( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", provider_name="str", add_provider_input={ @@ -75,7 +67,6 @@ def test_replication_recovery_services_providers_begin_create(self, resource_gro "machineId": "str", } }, - api_version="2025-01-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -85,21 +76,35 @@ def test_replication_recovery_services_providers_begin_create(self, resource_gro @recorded_by_proxy def test_replication_recovery_services_providers_begin_purge(self, resource_group): response = self.client.replication_recovery_services_providers.begin_purge( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", provider_name="str", - api_version="2025-01-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_replication_recovery_services_providers_list_by_replication_fabrics(self, resource_group): + response = self.client.replication_recovery_services_providers.list_by_replication_fabrics( + resource_group_name=resource_group.name, + resource_name="str", + fabric_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_replication_recovery_services_providers_begin_refresh_provider(self, resource_group): response = self.client.replication_recovery_services_providers.begin_refresh_provider( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", provider_name="str", - api_version="2025-01-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -109,9 +114,10 @@ def test_replication_recovery_services_providers_begin_refresh_provider(self, re @recorded_by_proxy def test_replication_recovery_services_providers_begin_delete(self, resource_group): response = self.client.replication_recovery_services_providers.begin_delete( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", provider_name="str", - api_version="2025-01-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -121,7 +127,8 @@ def test_replication_recovery_services_providers_begin_delete(self, resource_gro @recorded_by_proxy def test_replication_recovery_services_providers_list(self, resource_group): response = self.client.replication_recovery_services_providers.list( - api_version="2025-01-01", + resource_group_name=resource_group.name, + resource_name="str", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_recovery_services_providers_operations_async.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_recovery_services_providers_operations_async.py index 8504a9f714fe..8e71df27794a 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_recovery_services_providers_operations_async.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_recovery_services_providers_operations_async.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 pytest @@ -19,24 +19,14 @@ class TestSiteRecoveryManagementReplicationRecoveryServicesProvidersOperationsAs def setup_method(self, method): self.client = self.create_mgmt_client(SiteRecoveryManagementClient, is_async=True) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_replication_recovery_services_providers_list_by_replication_fabrics(self, resource_group): - response = self.client.replication_recovery_services_providers.list_by_replication_fabrics( - fabric_name="str", - api_version="2025-01-01", - ) - 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_replication_recovery_services_providers_get(self, resource_group): response = await self.client.replication_recovery_services_providers.get( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", provider_name="str", - api_version="2025-01-01", ) # please add some check logic here by yourself @@ -47,6 +37,8 @@ async def test_replication_recovery_services_providers_get(self, resource_group) async def test_replication_recovery_services_providers_begin_create(self, resource_group): response = await ( await self.client.replication_recovery_services_providers.begin_create( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", provider_name="str", add_provider_input={ @@ -77,7 +69,6 @@ async def test_replication_recovery_services_providers_begin_create(self, resour "machineId": "str", } }, - api_version="2025-01-01", ) ).result() # call '.result()' to poll until service return final result @@ -89,23 +80,37 @@ async def test_replication_recovery_services_providers_begin_create(self, resour async def test_replication_recovery_services_providers_begin_purge(self, resource_group): response = await ( await self.client.replication_recovery_services_providers.begin_purge( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", provider_name="str", - api_version="2025-01-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_replication_recovery_services_providers_list_by_replication_fabrics(self, resource_group): + response = self.client.replication_recovery_services_providers.list_by_replication_fabrics( + resource_group_name=resource_group.name, + resource_name="str", + fabric_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_replication_recovery_services_providers_begin_refresh_provider(self, resource_group): response = await ( await self.client.replication_recovery_services_providers.begin_refresh_provider( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", provider_name="str", - api_version="2025-01-01", ) ).result() # call '.result()' to poll until service return final result @@ -117,9 +122,10 @@ async def test_replication_recovery_services_providers_begin_refresh_provider(se async def test_replication_recovery_services_providers_begin_delete(self, resource_group): response = await ( await self.client.replication_recovery_services_providers.begin_delete( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", provider_name="str", - api_version="2025-01-01", ) ).result() # call '.result()' to poll until service return final result @@ -130,7 +136,8 @@ async def test_replication_recovery_services_providers_begin_delete(self, resour @recorded_by_proxy_async async def test_replication_recovery_services_providers_list(self, resource_group): response = self.client.replication_recovery_services_providers.list( - api_version="2025-01-01", + resource_group_name=resource_group.name, + resource_name="str", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_storage_classification_mappings_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_storage_classification_mappings_operations.py index bb3ee97b6bb5..fef952255fe2 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_storage_classification_mappings_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_storage_classification_mappings_operations.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 pytest @@ -18,28 +18,15 @@ class TestSiteRecoveryManagementReplicationStorageClassificationMappingsOperatio def setup_method(self, method): self.client = self.create_mgmt_client(SiteRecoveryManagementClient) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_replication_storage_classification_mappings_list_by_replication_storage_classifications( - self, resource_group - ): - response = self.client.replication_storage_classification_mappings.list_by_replication_storage_classifications( - fabric_name="str", - storage_classification_name="str", - api_version="2025-01-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_replication_storage_classification_mappings_get(self, resource_group): response = self.client.replication_storage_classification_mappings.get( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", storage_classification_name="str", storage_classification_mapping_name="str", - api_version="2025-01-01", ) # please add some check logic here by yourself @@ -49,11 +36,12 @@ def test_replication_storage_classification_mappings_get(self, resource_group): @recorded_by_proxy def test_replication_storage_classification_mappings_begin_create(self, resource_group): response = self.client.replication_storage_classification_mappings.begin_create( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", storage_classification_name="str", storage_classification_mapping_name="str", pairing_input={"properties": {"targetStorageClassificationId": "str"}}, - api_version="2025-01-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -63,20 +51,37 @@ def test_replication_storage_classification_mappings_begin_create(self, resource @recorded_by_proxy def test_replication_storage_classification_mappings_begin_delete(self, resource_group): response = self.client.replication_storage_classification_mappings.begin_delete( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", storage_classification_name="str", storage_classification_mapping_name="str", - api_version="2025-01-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_replication_storage_classification_mappings_list_by_replication_storage_classifications( + self, resource_group + ): + response = self.client.replication_storage_classification_mappings.list_by_replication_storage_classifications( + resource_group_name=resource_group.name, + resource_name="str", + fabric_name="str", + storage_classification_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_replication_storage_classification_mappings_list(self, resource_group): response = self.client.replication_storage_classification_mappings.list( - api_version="2025-01-01", + resource_group_name=resource_group.name, + resource_name="str", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_storage_classification_mappings_operations_async.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_storage_classification_mappings_operations_async.py index 936297c9d2b8..49ff0e15c1ba 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_storage_classification_mappings_operations_async.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_storage_classification_mappings_operations_async.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 pytest @@ -19,28 +19,15 @@ class TestSiteRecoveryManagementReplicationStorageClassificationMappingsOperatio def setup_method(self, method): self.client = self.create_mgmt_client(SiteRecoveryManagementClient, is_async=True) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_replication_storage_classification_mappings_list_by_replication_storage_classifications( - self, resource_group - ): - response = self.client.replication_storage_classification_mappings.list_by_replication_storage_classifications( - fabric_name="str", - storage_classification_name="str", - api_version="2025-01-01", - ) - 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_replication_storage_classification_mappings_get(self, resource_group): response = await self.client.replication_storage_classification_mappings.get( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", storage_classification_name="str", storage_classification_mapping_name="str", - api_version="2025-01-01", ) # please add some check logic here by yourself @@ -51,11 +38,12 @@ async def test_replication_storage_classification_mappings_get(self, resource_gr async def test_replication_storage_classification_mappings_begin_create(self, resource_group): response = await ( await self.client.replication_storage_classification_mappings.begin_create( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", storage_classification_name="str", storage_classification_mapping_name="str", pairing_input={"properties": {"targetStorageClassificationId": "str"}}, - api_version="2025-01-01", ) ).result() # call '.result()' to poll until service return final result @@ -67,21 +55,38 @@ async def test_replication_storage_classification_mappings_begin_create(self, re async def test_replication_storage_classification_mappings_begin_delete(self, resource_group): response = await ( await self.client.replication_storage_classification_mappings.begin_delete( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", storage_classification_name="str", storage_classification_mapping_name="str", - api_version="2025-01-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_replication_storage_classification_mappings_list_by_replication_storage_classifications( + self, resource_group + ): + response = self.client.replication_storage_classification_mappings.list_by_replication_storage_classifications( + resource_group_name=resource_group.name, + resource_name="str", + fabric_name="str", + storage_classification_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_replication_storage_classification_mappings_list(self, resource_group): response = self.client.replication_storage_classification_mappings.list( - api_version="2025-01-01", + resource_group_name=resource_group.name, + resource_name="str", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_storage_classifications_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_storage_classifications_operations.py index ce1ebae77bd0..33ace25d2e3d 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_storage_classifications_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_storage_classifications_operations.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 pytest @@ -20,24 +20,26 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_replication_storage_classifications_list_by_replication_fabrics(self, resource_group): - response = self.client.replication_storage_classifications.list_by_replication_fabrics( + def test_replication_storage_classifications_get(self, resource_group): + response = self.client.replication_storage_classifications.get( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", - api_version="2025-01-01", + storage_classification_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_replication_storage_classifications_get(self, resource_group): - response = self.client.replication_storage_classifications.get( + def test_replication_storage_classifications_list_by_replication_fabrics(self, resource_group): + response = self.client.replication_storage_classifications.list_by_replication_fabrics( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", - storage_classification_name="str", - api_version="2025-01-01", ) - + result = [r for r in response] # please add some check logic here by yourself # ... @@ -45,7 +47,8 @@ def test_replication_storage_classifications_get(self, resource_group): @recorded_by_proxy def test_replication_storage_classifications_list(self, resource_group): response = self.client.replication_storage_classifications.list( - api_version="2025-01-01", + resource_group_name=resource_group.name, + resource_name="str", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_storage_classifications_operations_async.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_storage_classifications_operations_async.py index b5b011c3b4c0..0b84f44caf10 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_storage_classifications_operations_async.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_storage_classifications_operations_async.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 pytest @@ -21,24 +21,26 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_replication_storage_classifications_list_by_replication_fabrics(self, resource_group): - response = self.client.replication_storage_classifications.list_by_replication_fabrics( + async def test_replication_storage_classifications_get(self, resource_group): + response = await self.client.replication_storage_classifications.get( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", - api_version="2025-01-01", + storage_classification_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_replication_storage_classifications_get(self, resource_group): - response = await self.client.replication_storage_classifications.get( + async def test_replication_storage_classifications_list_by_replication_fabrics(self, resource_group): + response = self.client.replication_storage_classifications.list_by_replication_fabrics( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", - storage_classification_name="str", - api_version="2025-01-01", ) - + result = [r async for r in response] # please add some check logic here by yourself # ... @@ -46,7 +48,8 @@ async def test_replication_storage_classifications_get(self, resource_group): @recorded_by_proxy_async async def test_replication_storage_classifications_list(self, resource_group): response = self.client.replication_storage_classifications.list( - api_version="2025-01-01", + resource_group_name=resource_group.name, + resource_name="str", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_vault_health_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_vault_health_operations.py index 152d29e6dfe6..006bed451ed7 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_vault_health_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_vault_health_operations.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 pytest @@ -22,7 +22,8 @@ def setup_method(self, method): @recorded_by_proxy def test_replication_vault_health_get(self, resource_group): response = self.client.replication_vault_health.get( - api_version="2025-01-01", + resource_group_name=resource_group.name, + resource_name="str", ) # please add some check logic here by yourself @@ -32,7 +33,8 @@ def test_replication_vault_health_get(self, resource_group): @recorded_by_proxy def test_replication_vault_health_begin_refresh(self, resource_group): response = self.client.replication_vault_health.begin_refresh( - api_version="2025-01-01", + resource_group_name=resource_group.name, + resource_name="str", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_vault_health_operations_async.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_vault_health_operations_async.py index dcc9b70ff052..5dc9445f0a19 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_vault_health_operations_async.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_vault_health_operations_async.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 pytest @@ -23,7 +23,8 @@ def setup_method(self, method): @recorded_by_proxy_async async def test_replication_vault_health_get(self, resource_group): response = await self.client.replication_vault_health.get( - api_version="2025-01-01", + resource_group_name=resource_group.name, + resource_name="str", ) # please add some check logic here by yourself @@ -34,7 +35,8 @@ async def test_replication_vault_health_get(self, resource_group): async def test_replication_vault_health_begin_refresh(self, resource_group): response = await ( await self.client.replication_vault_health.begin_refresh( - api_version="2025-01-01", + resource_group_name=resource_group.name, + resource_name="str", ) ).result() # call '.result()' to poll until service return final result diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_vault_setting_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_vault_setting_operations.py index a9cbb470688f..2688522b03f9 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_vault_setting_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_vault_setting_operations.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 pytest @@ -18,22 +18,13 @@ class TestSiteRecoveryManagementReplicationVaultSettingOperations(AzureMgmtRecor def setup_method(self, method): self.client = self.create_mgmt_client(SiteRecoveryManagementClient) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_replication_vault_setting_list(self, resource_group): - response = self.client.replication_vault_setting.list( - api_version="2025-01-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_replication_vault_setting_get(self, resource_group): response = self.client.replication_vault_setting.get( + resource_group_name=resource_group.name, + resource_name="str", vault_setting_name="str", - api_version="2025-01-01", ) # please add some check logic here by yourself @@ -43,10 +34,22 @@ def test_replication_vault_setting_get(self, resource_group): @recorded_by_proxy def test_replication_vault_setting_begin_create(self, resource_group): response = self.client.replication_vault_setting.begin_create( + resource_group_name=resource_group.name, + resource_name="str", vault_setting_name="str", input={"properties": {"migrationSolutionId": "str", "vmwareToAzureProviderType": "str"}}, - api_version="2025-01-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_replication_vault_setting_list(self, resource_group): + response = self.client.replication_vault_setting.list( + resource_group_name=resource_group.name, + resource_name="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_vault_setting_operations_async.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_vault_setting_operations_async.py index 538d618314fc..7b09b2695981 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_vault_setting_operations_async.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replication_vault_setting_operations_async.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 pytest @@ -19,22 +19,13 @@ class TestSiteRecoveryManagementReplicationVaultSettingOperationsAsync(AzureMgmt def setup_method(self, method): self.client = self.create_mgmt_client(SiteRecoveryManagementClient, is_async=True) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_replication_vault_setting_list(self, resource_group): - response = self.client.replication_vault_setting.list( - api_version="2025-01-01", - ) - 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_replication_vault_setting_get(self, resource_group): response = await self.client.replication_vault_setting.get( + resource_group_name=resource_group.name, + resource_name="str", vault_setting_name="str", - api_version="2025-01-01", ) # please add some check logic here by yourself @@ -45,11 +36,23 @@ async def test_replication_vault_setting_get(self, resource_group): async def test_replication_vault_setting_begin_create(self, resource_group): response = await ( await self.client.replication_vault_setting.begin_create( + resource_group_name=resource_group.name, + resource_name="str", vault_setting_name="str", input={"properties": {"migrationSolutionId": "str", "vmwareToAzureProviderType": "str"}}, - api_version="2025-01-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_replication_vault_setting_list(self, resource_group): + response = self.client.replication_vault_setting.list( + resource_group_name=resource_group.name, + resource_name="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replicationv_centers_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replicationv_centers_operations.py index df8e5c588254..39597678dca7 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replicationv_centers_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replicationv_centers_operations.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 pytest @@ -18,24 +18,14 @@ class TestSiteRecoveryManagementReplicationvCentersOperations(AzureMgmtRecordedT def setup_method(self, method): self.client = self.create_mgmt_client(SiteRecoveryManagementClient) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_replicationv_centers_list_by_replication_fabrics(self, resource_group): - response = self.client.replicationv_centers.list_by_replication_fabrics( - fabric_name="str", - api_version="2025-01-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_replicationv_centers_get(self, resource_group): response = self.client.replicationv_centers.get( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", vcenter_name="str", - api_version="2025-01-01", ) # please add some check logic here by yourself @@ -45,6 +35,8 @@ def test_replicationv_centers_get(self, resource_group): @recorded_by_proxy def test_replicationv_centers_begin_create(self, resource_group): response = self.client.replicationv_centers.begin_create( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", vcenter_name="str", add_v_center_request={ @@ -56,19 +48,6 @@ def test_replicationv_centers_begin_create(self, resource_group): "runAsAccountId": "str", } }, - api_version="2025-01-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_replicationv_centers_begin_delete(self, resource_group): - response = self.client.replicationv_centers.begin_delete( - fabric_name="str", - vcenter_name="str", - api_version="2025-01-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -78,6 +57,8 @@ def test_replicationv_centers_begin_delete(self, resource_group): @recorded_by_proxy def test_replicationv_centers_begin_update(self, resource_group): response = self.client.replicationv_centers.begin_update( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", vcenter_name="str", update_v_center_request={ @@ -89,17 +70,42 @@ def test_replicationv_centers_begin_update(self, resource_group): "runAsAccountId": "str", } }, - api_version="2025-01-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_replicationv_centers_begin_delete(self, resource_group): + response = self.client.replicationv_centers.begin_delete( + resource_group_name=resource_group.name, + resource_name="str", + fabric_name="str", + vcenter_name="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_replicationv_centers_list_by_replication_fabrics(self, resource_group): + response = self.client.replicationv_centers.list_by_replication_fabrics( + resource_group_name=resource_group.name, + resource_name="str", + fabric_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_replicationv_centers_list(self, resource_group): response = self.client.replicationv_centers.list( - api_version="2025-01-01", + resource_group_name=resource_group.name, + resource_name="str", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replicationv_centers_operations_async.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replicationv_centers_operations_async.py index 48e6f5354640..621c64907087 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replicationv_centers_operations_async.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_replicationv_centers_operations_async.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 pytest @@ -19,24 +19,14 @@ class TestSiteRecoveryManagementReplicationvCentersOperationsAsync(AzureMgmtReco def setup_method(self, method): self.client = self.create_mgmt_client(SiteRecoveryManagementClient, is_async=True) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_replicationv_centers_list_by_replication_fabrics(self, resource_group): - response = self.client.replicationv_centers.list_by_replication_fabrics( - fabric_name="str", - api_version="2025-01-01", - ) - 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_replicationv_centers_get(self, resource_group): response = await self.client.replicationv_centers.get( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", vcenter_name="str", - api_version="2025-01-01", ) # please add some check logic here by yourself @@ -47,6 +37,8 @@ async def test_replicationv_centers_get(self, resource_group): async def test_replicationv_centers_begin_create(self, resource_group): response = await ( await self.client.replicationv_centers.begin_create( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", vcenter_name="str", add_v_center_request={ @@ -58,21 +50,6 @@ async def test_replicationv_centers_begin_create(self, resource_group): "runAsAccountId": "str", } }, - api_version="2025-01-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_replicationv_centers_begin_delete(self, resource_group): - response = await ( - await self.client.replicationv_centers.begin_delete( - fabric_name="str", - vcenter_name="str", - api_version="2025-01-01", ) ).result() # call '.result()' to poll until service return final result @@ -84,6 +61,8 @@ async def test_replicationv_centers_begin_delete(self, resource_group): async def test_replicationv_centers_begin_update(self, resource_group): response = await ( await self.client.replicationv_centers.begin_update( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", vcenter_name="str", update_v_center_request={ @@ -95,18 +74,45 @@ async def test_replicationv_centers_begin_update(self, resource_group): "runAsAccountId": "str", } }, - api_version="2025-01-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_replicationv_centers_begin_delete(self, resource_group): + response = await ( + await self.client.replicationv_centers.begin_delete( + resource_group_name=resource_group.name, + resource_name="str", + fabric_name="str", + vcenter_name="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_replicationv_centers_list_by_replication_fabrics(self, resource_group): + response = self.client.replicationv_centers.list_by_replication_fabrics( + resource_group_name=resource_group.name, + resource_name="str", + fabric_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_replicationv_centers_list(self, resource_group): response = self.client.replicationv_centers.list( - api_version="2025-01-01", + resource_group_name=resource_group.name, + resource_name="str", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_supported_operating_systems_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_supported_operating_systems_operations.py index 29969776eade..e0c16390b53c 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_supported_operating_systems_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_supported_operating_systems_operations.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 pytest @@ -22,7 +22,8 @@ def setup_method(self, method): @recorded_by_proxy def test_supported_operating_systems_get(self, resource_group): response = self.client.supported_operating_systems.get( - api_version="2025-01-01", + resource_group_name=resource_group.name, + resource_name="str", ) # please add some check logic here by yourself diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_supported_operating_systems_operations_async.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_supported_operating_systems_operations_async.py index 66b79a55deb9..57ff1d4739a4 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_supported_operating_systems_operations_async.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_supported_operating_systems_operations_async.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 pytest @@ -23,7 +23,8 @@ def setup_method(self, method): @recorded_by_proxy_async async def test_supported_operating_systems_get(self, resource_group): response = await self.client.supported_operating_systems.get( - api_version="2025-01-01", + resource_group_name=resource_group.name, + resource_name="str", ) # please add some check logic here by yourself diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_target_compute_sizes_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_target_compute_sizes_operations.py index ce46940cf343..2c592db3b798 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_target_compute_sizes_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_target_compute_sizes_operations.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 pytest @@ -22,10 +22,11 @@ def setup_method(self, method): @recorded_by_proxy def test_target_compute_sizes_list_by_replication_protected_items(self, resource_group): response = self.client.target_compute_sizes.list_by_replication_protected_items( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", replicated_protected_item_name="str", - api_version="2025-01-01", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_target_compute_sizes_operations_async.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_target_compute_sizes_operations_async.py index 3200df69f8f7..28bfe53680f0 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_target_compute_sizes_operations_async.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_tests/test_site_recovery_management_target_compute_sizes_operations_async.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 pytest @@ -23,10 +23,11 @@ def setup_method(self, method): @recorded_by_proxy_async async def test_target_compute_sizes_list_by_replication_protected_items(self, resource_group): response = self.client.target_compute_sizes.list_by_replication_protected_items( + resource_group_name=resource_group.name, + resource_name="str", fabric_name="str", protection_container_name="str", replicated_protected_item_name="str", - api_version="2025-01-01", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/pyproject.toml b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/pyproject.toml index 540da07d41af..5a650eaccd28 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/pyproject.toml +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/pyproject.toml @@ -1,6 +1,88 @@ +[build-system] +requires = [ + "setuptools>=77.0.3", + "wheel", +] +build-backend = "setuptools.build_meta" + +[project] +name = "azure-mgmt-recoveryservicessiterecovery" +authors = [ + { name = "Microsoft Corporation", email = "azpysdkhelp@microsoft.com" }, +] +description = "Microsoft Azure Recoveryservicessiterecovery Management Client Library for Python" +license = "MIT" +classifiers = [ + "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", +] +requires-python = ">=3.9" +keywords = [ + "azure", + "azure sdk", +] +dependencies = [ + "isodate>=0.6.1", + "azure-mgmt-core>=1.6.0", + "typing-extensions>=4.6.0", +] +dynamic = [ + "version", + "readme", +] + +[project.urls] +repository = "https://github.com/Azure/azure-sdk-for-python" + +[tool.setuptools.dynamic.version] +attr = "azure.mgmt.recoveryservicessiterecovery._version.VERSION" + +[tool.setuptools.dynamic.readme] +file = [ + "README.md", + "CHANGELOG.md", +] +content-type = "text/markdown" + +[tool.setuptools.packages.find] +exclude = [ + "tests*", + "generated_tests*", + "samples*", + "generated_samples*", + "doc*", + "azure", + "azure.mgmt", +] + +[tool.setuptools.package-data] +pytyped = [ + "py.typed", +] + [tool.azure-sdk-build] breaking = false mypy = false pyright = false type_check_samples = false verifytypes = false + +[packaging] +package_name = "azure-mgmt-recoveryservicessiterecovery" +package_nspkg = "azure-mgmt-nspkg" +package_pprint_name = "Recovery Services Site Recovery Management" +package_doc_id = "" +is_stable = false +is_arm = true +title = "SiteRecoveryManagementClient" +need_msrestazure = false +need_azuremgmtcore = true +sample_link = "" +exclude_folders = "" diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/sdk_packaging.toml b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/sdk_packaging.toml deleted file mode 100644 index 19befa7f508c..000000000000 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/sdk_packaging.toml +++ /dev/null @@ -1,8 +0,0 @@ -[packaging] -package_name = "azure-mgmt-recoveryservicessiterecovery" -package_nspkg = "azure-mgmt-nspkg" -package_pprint_name = "Recovery Services Site Recovery Management" -package_doc_id = "" -is_stable = true -is_arm = true -title = "SiteRecoveryManagementClient" diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/setup.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/setup.py deleted file mode 100644 index 0229e7056e16..000000000000 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/setup.py +++ /dev/null @@ -1,82 +0,0 @@ -#!/usr/bin/env python - -# ------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- - -import re -import os.path -from io import open -from setuptools import find_packages, setup - -# Change the PACKAGE_NAME only to change folder and different name -PACKAGE_NAME = "azure-mgmt-recoveryservicessiterecovery" -PACKAGE_PPRINT_NAME = "Recovery Services Site Recovery Management" - -# a-b-c => a/b/c -package_folder_path = PACKAGE_NAME.replace("-", "/") -# a-b-c => a.b.c -namespace_name = PACKAGE_NAME.replace("-", ".") - -# Version extraction inspired from 'requests' -with open( - os.path.join(package_folder_path, "version.py") - if os.path.exists(os.path.join(package_folder_path, "version.py")) - else os.path.join(package_folder_path, "_version.py"), - "r", -) as fd: - version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', fd.read(), re.MULTILINE).group(1) - -if not version: - raise RuntimeError("Cannot find version information") - -with open("README.md", encoding="utf-8") as f: - readme = f.read() -with open("CHANGELOG.md", encoding="utf-8") as f: - changelog = f.read() - -setup( - name=PACKAGE_NAME, - version=version, - description="Microsoft Azure {} Client Library for Python".format(PACKAGE_PPRINT_NAME), - long_description=readme + "\n\n" + changelog, - long_description_content_type="text/markdown", - license="MIT License", - author="Microsoft Corporation", - author_email="azpysdkhelp@microsoft.com", - url="https://github.com/Azure/azure-sdk-for-python", - keywords="azure, azure sdk", # update with search keywords relevant to the azure service / product - classifiers=[ - "Development Status :: 5 - Production/Stable", - "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", - "License :: OSI Approved :: MIT License", - ], - zip_safe=False, - packages=find_packages( - exclude=[ - "tests", - # Exclude packages that will be covered by PEP420 or nspkg - "azure", - "azure.mgmt", - ] - ), - include_package_data=True, - package_data={ - "pytyped": ["py.typed"], - }, - install_requires=[ - "isodate>=0.6.1", - "typing-extensions>=4.6.0", - "azure-common>=1.1", - "azure-mgmt-core>=1.3.2", - ], - python_requires=">=3.9", -) diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/tests/conftest.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/tests/conftest.py new file mode 100644 index 000000000000..07f6112ca76c --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/tests/conftest.py @@ -0,0 +1,41 @@ +# 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. +# -------------------------------------------------------------------------- +import os +import pytest +from dotenv import load_dotenv +from devtools_testutils import ( + test_proxy, + add_general_regex_sanitizer, + add_body_key_sanitizer, + add_header_regex_sanitizer, +) + +load_dotenv() + + +# For security, please avoid record sensitive identity information in recordings +@pytest.fixture(scope="session", autouse=True) +def add_sanitizers(test_proxy): + siterecoverymanagement_subscription_id = os.environ.get( + "AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000" + ) + siterecoverymanagement_tenant_id = os.environ.get("AZURE_TENANT_ID", "00000000-0000-0000-0000-000000000000") + siterecoverymanagement_client_id = os.environ.get("AZURE_CLIENT_ID", "00000000-0000-0000-0000-000000000000") + siterecoverymanagement_client_secret = os.environ.get("AZURE_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer( + regex=siterecoverymanagement_subscription_id, value="00000000-0000-0000-0000-000000000000" + ) + add_general_regex_sanitizer(regex=siterecoverymanagement_tenant_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=siterecoverymanagement_client_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer( + regex=siterecoverymanagement_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;") + add_body_key_sanitizer(json_path="$..access_token", value="access_token") diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/tests/test_site_recovery_management_operations_async_test.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/tests/test_site_recovery_management_operations_async_test.py new file mode 100644 index 000000000000..8ce6f4e3282e --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/tests/test_site_recovery_management_operations_async_test.py @@ -0,0 +1,29 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.recoveryservicessiterecovery.aio import SiteRecoveryManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.live_test_only +class TestSiteRecoveryManagementOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(SiteRecoveryManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_operations_list(self, resource_group): + response = self.client.operations.list( + resource_group_name=resource_group.name, + ) + result = [r async for r in response] + assert len(result) == 0 diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/tests/test_site_recovery_management_operations_test.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/tests/test_site_recovery_management_operations_test.py new file mode 100644 index 000000000000..4386a816cbce --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/tests/test_site_recovery_management_operations_test.py @@ -0,0 +1,28 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# 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.recoveryservicessiterecovery import SiteRecoveryManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.live_test_only +class TestSiteRecoveryManagementOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(SiteRecoveryManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_operations_list(self, resource_group): + response = self.client.operations.list( + resource_group_name=resource_group.name, + ) + result = [r for r in response] + assert len(result) == 0 diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/tsp-location.yaml b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/tsp-location.yaml new file mode 100644 index 000000000000..1725549832d6 --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/SiteRecovery +commit: 1346e6b895a9091a6adbeec3505ee47f55d3ecee +repo: Azure/azure-rest-api-specs +additionalDirectories: